powered by Jive Software

Need Jetty to work with my jsps -- strange happenings

Hi there,

You folks helped me get a basic servlet wrapper up a couple of days ago and all seems good but I’'m still hitting some issues.

Here’'s my code for reference:

this.manager = HttpBindManager.getInstance();

this.pluginDirectory = pluginDirectory;

}

public void startWebServices(){

String webloc = pluginDirectory.getAbsolutePath();

System.out.println(webloc);

ContextHandlerCollection contexts = manager.getContexts();

context = new WebAppContext(webloc, “/” + pluginDirectory.getName());

System.out.println(pluginDirectory.separator);

System.out.println(pluginDirectory.getAbsolutePath() + File.separator + “web”);

context.addServlet(new ServletHolder(new A7PageSrcServlet()), “/ride/pagesource/*”);

context.addServlet(new ServletHolder(new A7HttpController()), “/ride/*”);

context.setClassLoader(A7HttpController.class.getClassLoader());

context.setWelcomeFiles(new String[]{“index.jsp”});

contexts.addHandler(context);

try {

context.start();

}catch (Exception e) {

Log.error(e);

}

So this code works, but I have no way of loading jsps out of the plugin – because it seems like it’'s not reading my web.xml file in the WEB-INF directory.

Also, it exposes my entire plugin over port 8080 and again, since I’'m not pointing to my web directory, I have no config file to block access with.

When I re-map the WebAppContext so that it points to the web folder the jar won’'t load.

So I guess I wish that jetty were better documented - or is it?

What config file will get loaded from within Openfire using Jetty this way?

-Walt

I figured it out. Turns out that the web.xml file that was part of the plugin was causing the servlet to crash before it ever became active.

One thing that helped for anyone who’‘s trying to wade through this stuff – download jetty and set your WebAppContext to use one of Jetty’'s example apps to see whether or not your code is working.