Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

There are several options for modifying the Jasper JSP servlet configuration. Which is most suitale will depend on your requirements.

Override webdefault.xml

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>
   ..

Configure JSP Servlet in web.xml

Another option is to add an ebtry 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>
     ...
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery