We are trying to deploy existing (legacy application) in jetty, we got the issue for double slash (//) in path , then got solution to set compactPath=true, its working fine for the URL which are getting hit from browser bar, but does not work for the URL which are get called from JSPServlet.
Got below difference: when hit from browser bar it call rewrite rule and that rewrote the path as shown in below trace. But when it get called from JSPServlet this does not call the rewrite rule.
2017-01-09T16:15:41.209-0800 DEBUG : loggerName="o.e.j.r.h.RuleContainer" threadName="qtp1790421142-95" rewrote /WebApp/views//path/mypage.jsp to /WebApp/views//worklist/roleOptPrivilage.jsp
2017-01-09T16:15:41.209-0800 DEBUG : loggerName="o.e.j.r.h.RuleContainer" threadName="qtp1790421142-95" applied org.eclipse.jetty.rewrite.handler.CompactPathRule[ht]
2017-01-09T16:15:41.209-0800 DEBUG : loggerName="o.e.j.r.h.RuleContainer" threadName="qtp1790421142-95" rewrote /WebApp/views//path/mypage.jsp to /WebApp/views/path/mypage.jsp
Below is code snippet for setting up compactPath:
<Call name="setHandler">
<Arg>
<New id="repair-consignment-services" class="org.eclipse.jetty.webapp.WebAppContext">
<Arg>
<Property name="jetty.base" default=".." />/webapp/webApp-1.0.war
</Arg>
<Arg>/</Arg>
<Set name="contextPath">/WebApp</Set>
<Set name="configurations">
<Set name="parentLoaderPriority">true</Set>
<Set name="tempDirectory"><Property name="jetty.base" default=".." />/work</Set>
<Set name="defaultsDescriptor"><Property name="jetty.base" default=".." />/conf/webdefault.xml</Set>
**<Set name="compactPath">true</Set>**
</New>
</Arg>
</Call>
We are using below config for JSP
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<servlet-class>org.eclipse.jetty.jsp.JettyJspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>errorOnUseBeanInvalidClassAttribute</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>xpoweredBy</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>compilerTargetVM</param-name>
<param-value>1.8</param-value>
</init-param>
<init-param>
<param-name>compilerSourceVM</param-name>
<param-value>1.8</param-value>
</init-param>
<!--
<init-param>
<param-name>classpath</param-name>
<param-value>?</param-value>
</init-param>
-->
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jsp</url-pattern>
<url-pattern>*.jspf</url-pattern>
<url-pattern>*.jspx</url-pattern>
<url-pattern>*.xsp</url-pattern>
<url-pattern>*.JSP</url-pattern>
<url-pattern>*.JSPF</url-pattern>
<url-pattern>*.JSPX</url-pattern>
<url-pattern>*.XSP</url-pattern>
</servlet-mapping>
As jetty rewrite didn't apply for JSP engine, we have added tuckey rewrite filter to resolve this issue. how to use tuckey can be found in below link. http://tuckey.org/urlrewrite/