java - Serving jetty webapp from two directories simultaneously -


In development, I use Jetlet as servlet container.

  • The web project includes the wabapp directory
  • A derivative project that overrides some files in the webapp directory

    Master project webpayments can be started in development mode because jetties are appropriate Thanks for providing WebAppContext .

    Now I want to start indexing a derivative project, assuming that when requested,

  • get resources from the webpage directory of the generated project < Li> If it does not exist, then get it from the master project's webpage directory

    I know that it overrides the WebAppContext #getResource () method It is possible, however, that we can be used in this project Six library automatically perform IO operations on wabapp directory. For example, reading files without using the ServletContext #getRealPath ("/") , and then using the ServletContext #getResource () method problem At the top of the file some virtual files may be resolved at the lower level of the system, but it does not appear to be supported in JDK 1.6, any suggestions?

    It seems that using something like ResourceCollection is enough:

    Unfortunately, the devod of GWT which I use is based on JT6, where resource protocol is unavailable. I have enhanced the resource class itself, and with its own GWT Jetty Launcher , and Resourcebase to set the defaultServlet Thanks for the little trick for Through Code> Reflection, I was able to serve the webpad with two directories simultaneously.

      Protects zero doStart () throws exception {setClassLoader (new launcher webpackel loader ()); Super.doStart (); Service holder holder = getServletHandler (). GetServlet ("default"); Servlet servlet = holder. Gateservelet (); Field field = servlet.getClass (). GetDeclaredField ("_ _ _" resource); Field.setAccessible (true); Field.set (servlet, combined resource base); }    

  • Comments