3 Replies Latest reply on Feb 20, 2003 10:47 AM by jpjjansen

    Jetty : Default context behaviour ?

    jpjjansen

      Hi,

      Let me break down the situation:
      I have got 3 virtual hosts (host1, host2, host3) mapped to 1 WAR on the context root "/" using the lovely JBoss303-Jetty combo. This works, which is good. Now, the thing that I want is that all requests which give a "HTTP ERROR: /xxx 404 Not Found" or for which is no resource or context to be redirected to another "default" URL/Servlet/context. How do I accomplish this ? I read something about notFoundHandler's in Jetty but I have no clue how to set them up using the XML config schema.
      So what im looking for is default context behaviour, all requests that reach the server and for which there is no context should be redirected to this default place where the request is taken care of appropriately.

      Any ideas greatly appreciated!

      Regards,
      Jeroen.

        • 1. Re: Jetty : Default context behaviour ?
          erikture

          Hello!

          You can add something like this in the web.xml file.

          <error-page>
          <error-code>404</error-code>
          /eror.jsp
          </error-page>

          /Erik

          • 2. Re: Jetty : Default context behaviour ?
            jpjjansen

            Hi, thanks for the suggestion, it's appreciated.
            However, I need different behaviour, the 404 is limited to the WAR, you can't specify another context or host it seems, then Jetty throws a 400 or 404 error.
            I'd like to be able to define some sort of central context where ALL 404 come together of all deployed WAR's. I want one WAR to handle the 404 errors that are thrown in other WAR's.

            Jeroen


            • 3. Re: Jetty : Default context behaviour ?
              jpjjansen

              Here i am again. Im still having problems configuring Jetty properly and am a little bit confused about how it's handling virtual hosts and HttpContexts. Is it possible to map multiple WAR's on the same machine to a / context root if those WAR's use seperate virtual host names ? I need behaviour that when the user types www.war1.com Jetty serves WAR1, and for www.war2.com serves the other web app. However, if you deploy 2 app's to a / request dispatching to those contexts would be impossible right ? Since the server can't distinguish between the apps. I guess ill just drop in 1 RequestDispatch servlet on the root of jetty and define names instead of just "/" for the contexts of my web apps.

              Im a little bit puzzled, am I missing something ?

              Jeroen