W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 1998

Re: Fw: Servlet Aliases/Loading

From: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
Date: Fri, 11 Dec 1998 10:26:44 +0100
Message-ID: <3670E553.31D5B0A4@sophia.inria.fr>
To: Kenneth Persson <kenneth@veosystems.com>
CC: www-jigsaw@w3.org
Well you can write something like that (in httpd.java)

 try {
     LookupState ls = new LookupState("/servlets/MyServlet.class");
     LookupResult  lr  = new LookupResult(root.getResourceReference());

     if (root.lookup(ls,lr)) {
         ResourceReference  target = lr.getTarget();
         if (target != null) {
             try {
                 Resource res = target.lock();
                 if (res instanceof ServletWrapper) {
                     ServletWrapper wrapper = (ServletWrapper) res;
                     wrapper.getServlet(); // initialize the servlet.
                } else {
                    // error ...
                }
            } catch (InvalidResourceException ex) {
               // error ...
            } finally {
               target.unlock();
            }
        }
     } else {
         //error ...
     }
 } catch (ProtocolException ex) {
     //error ...
 }

This is just a sample, not compiled, not tested.

Regards, Benoit.

Kenneth Persson wrote:

> Thanks,
>
> So, how do I in Jigsaw create the ServletResource, which is created
> when:
>
> http://host:port/servlets/MyServlet.class
>
> is called. It would feel strange to make an outbound http request to
> myself just to get it pre loaded.
>
> /Kenneth
>
> -----Original Message-----
> From: Benoit Mahe <Benoit.Mahe@sophia.inria.fr>
> To: Kenneth Persson <kenneth@veosystems.com>
> Cc: <www-jigsaw@w3.org>
> Date: Thursday, December 10, 1998 1:41 AM
> Subject: Re: Fw: Servlet Aliases/Loading
>
> >Kenneth Persson wrote:
> >
> >> Am I trying to do something Jigsaw is not designed for? I don't think so
> >> the Resource lookup looks very flexible. Just that I don't understand all
> >> the arguments to the resources.
> >>
> >> 1. Servlet alias
> >
> >You can use the RedirecterFrame [1] to do that kind of things. But you can
> also
> >modify the
> >ServletWrapper Identifier (if you only want to change the servlet's name).
> >
> >> 2. Forced init at Server startup
> >>
> >> If not yet implemented, could somebody point me to the right code
> fragments
> >> and I can see what I can do!
> >
> >This is not implemented yet, It could be done in
> org.w3c.jigsaw.http.httpd.java
> >with an internal lookup on the servlet at server startup.
> >
> >>
> >>
> >> /Kenneth
> >
> >[1]
> >http://www.w3.org/Jigsaw/Doc/Reference/org.w3c.jigsaw.frames.RedirecterFram
> e.html
> >
> >Regards, Benoit.
> >
> >>
> >>
> >> ---- Original Message -----
> >> From: Kenneth Persson <kenneth@veosystems.com>
> >> To: <www-jigsaw@w3.org>
> >> Sent: Sunday, December 06, 1998 10:53 PM
> >> Subject: Servlet Aliases/Loading
> >>
> >> I haven't yet figured out how to create an alias for a servlet, I also
> want to
> >> control the initialization of the servlet better. Hints anyone?
> >>
> >> In Java code how would I create the resource
> >>
> >> http://x.y.com/veoport to bind com.veo.server.ServletPort
> >>
> >> I would like to initialize it when the server starts up and only then. To
> me
> >> it seem like the current model is, if I use the .class extension. loading
> >> is enforced (even if it is already loaded), while class name without the
> >> extension only work if it is already loaded.
> >>
> >> Advice very much appreciated
> >>
> >> /Kenneth
> >>
> >> --
> >> Kenneth Persson, Server Architect, kenneth@veosystems.com, (650)623 2815
> >> Veo Systems, 2440 W. El Camino Real, Suite 710, Mountain View, CA 94040
> >
> >--
> >- Benoît Mahé -------------------------------------------------------
> >                      World Wide Web Consortium (W3C)
> >                    Architecture domain - Jigsaw Team
> >
> >  http://www.w3.org/People/Mahe - bmahe@w3.org - +33.4.92.38.79.89
> >---------------------------------------------------------------------
> >
> >
> >

--
- Benoît Mahé -------------------------------------------------------
                      World Wide Web Consortium (W3C)
                    Architecture domain - Jigsaw Team

  http://www.w3.org/People/Mahe - bmahe@w3.org - +33.4.92.38.79.89
---------------------------------------------------------------------
Received on Friday, 11 December 1998 04:26:55 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:28 GMT