...
There are several options for modifying the Jasper JSP servlet configuration. Which is most suitale suitable will depend on your requirements.
...
You can make a copy of the webdefault.xml shipped with jetty, apply your changes and use it instead of the shipped version. The example below shows
how to do this when using the maven jetty plugin.
| Info |
|---|
| title | "Overiding webdefault.xml" |
|---|
|
| Code Block |
|---|
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webAppConfig>
<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
</webAppConfig>
<connectors>
..
|
|
If you're using jetty standalone, and you want to change the jsp settings for just one or a few of your webapps, then copy the $JETTY_HOME/etc/webdefault.xml file somewhere, modify it, and then use a context xml file to set this file as the webdefaults for your webapp. Here's a snippet:
| Code Block |
|---|
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Set name="contextPath">/foo</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/foobar.war</Set>
<Set name="defaultsDescriptor">/home/smith/dev/webdefault.xml</Set>
</Configure>
|
Configure JSP Servlet in web.xml
Another option is to add an ebtry entry for the Jasper JSP servlet to the web.xml file of your webapp.
You can use the entry in webdefault.xml as a starting point.
| Info |
|---|
| title | "Configuring JSP Servlet in web.xml" |
|---|
|
| Code Block |
|---|
<servlet id="jsp">
<servlet-name>jsp</servlet-name>
<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
<param-name>logVerbosityLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>fork</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>keepgenerated</param-name>
<param-value>true</param-value>
</init-param>
...
<load-on-startup>0</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>
<servlet id="my-servlet">
<servlet-name>myServlet</servlet-name>
<servlet-class>com.acme.servlet.MyServlet</servlet-class>
...
|
|