Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get an embedded Jetty webserver to dump its interim Java code for JSPs

Tags:

I keep running into this problem when debugging JSP pages in OpenNMS. The Jetty wiki talks about keepGenerated (http://docs.codehaus.org/display/JETTY/KeepGenerated) in webdefault.xml but it seems unclear how this works in embedded setups.

like image 287
stsquad Avatar asked Sep 18 '08 10:09

stsquad


1 Answers

I know this is ages old, but I haven't found the answer anywhere else on the internet and it doesn't seem as though this has gotten any easier. Hopefully this will help someone:

extract your webdefault.xml from the jetty-version.jar, mine was in :C:\Documents and Settings\JB.m2\repository\org\mortbay\jetty\jetty\6.1.22\jetty-6.1.22.jar inside the org/mortbay/jetty/webapp/webdefault.xml file

Put the webdefault.xml into my project directory

Edit the webdefault.xml and add the following line:

<servlet id="jsp">
 ....
  <init-param>
    <param-name>keepgenerated</param-name>
    <param-value>true</param-value>
  </init-param>

Add the following into your maven pom.xml config:

<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>maven-jetty-plugin</artifactId>
  <configuration>    
    <webDefaultXml>webdefault.xml</webDefaultXml>
  </configuration>
</plugin>

When you run the mvn jetty:run maven goal my jsp code is now kept in target\work\jsp\org\apache\jsp\WEB_002dINF\jsp

like image 153
James B Avatar answered Sep 30 '22 18:09

James B