this is a *great* recap of how to manage multiple web application (webapp)
contexts withing a single jsdk2.1 configuration (eg. default.cfg). this may not
apply to all servlet engines.

> frustration! I would very appreciate if someone could confirm and cover the
> still dark areas of the .cfg file.

what dark areas remain?

- james

pascal jacob wrote:

> I personally use another solution. It works with the servletrunner, I don't
> know if it works with other servlet engine (feeback would be appreciated).
>
> Servletrunner knows the concept of webbapp (a set of classes and HTML files
> that compose a web application) for this to work you have to manipulate the
> servletrunner default.cfg file. Here's how to do:
>
> in the default.cfg add a the two lines:
> server.webbapp.your_app_alias_name.mapping=/your_app_alias_name
> server.webbapp.your_app_alias_name.docbase=dir_where_your_app_reside
>
> The default.cfg file that commes with the JSDK 2.1 contains a example of
> this. Lets examine it
> server.webapp.examples.mapping=/examples
> server.webapp.examples.docbase=examples
>
> the first line indicate that whenever you type
> http://your_host:8080/examples
> you tell the servletrunner that you want to access the examples web
> application. The second line tells the servletrunner where is the folder
> containning all your application file (.class and .HTML files)
>
> Lets buid a more complex exemple.
> suppose my_compagnie have two web applications and for the simplicity of
> installation you want to have these applications in a separate folder in the
> servletrunner folder. Here is the hierachie:
>
> jsdk2.1
>     webpages
>     examples
>     my_compagnie   // the folder that contains applications for my_compagnie
>         my_application1
>             index.html
>             WEB-INF
>                 servlets   // servlet classes for my_application1
>                 mappings.properties
>                 mime.properties
>                 servlets.properties
>                 webapp.properties
>             images
>             html
>         my_application2
>             WEB-INF
>                 servlets   // servlet classes for my_application2
>                 mappings.properties
>                 mime.properties
>                 servlets.properties
>                 webapp.properties
>            images
>            html
>
> here is the default.cfg:
> server.webapp.my_application1.mapping=/cool_appl
> server.webapp.my_application1.docbase=my_compagnie/my_application1
>
> server.webapp.my_application2.mapping=/big_appl
> server.webapp.my_application2.docbase=my_compagnie/my_application2
>
> Here is how to access your 1st application from a web browser:
> http://your_host:8080/cool_appl
> "/cool_appl" will map to the "server.webapp.my_application1.mapping=..." in
> de default.cfg file. The servlet runner will then use the
> "server.webapp.my_application1.docbase=..." to know where to found the file
> that compose this application. Because you didn't mention any particular
> file or servlet in your URL, the servlet runner will try to return a file
> named "index.html" located at the root of your application folder. (This
> file is called the welcomefile and its name and location can be change in
> the webapp.properties file located in the WEB-INF folder inside your
> application folder)
>
> Here is how to access your 2nd application:
> http://your_host:8080/big_appl/servlet/start
> "/big_appl" id mapped to "server.webapp.my_application2.mapping=/big_appl"
> so the folder containing your application stuff is
> "jsdk2.1/my_compagnie/my_application2". The difference it that you don't
> have a welcomefile ("index.html") in the "my_application2" folder so you can
> not simply type "http://your_host:8080/big_appl". (In this exemple I assume
> you have a servlet named start)
>
> Of course instead of modifying default.cfg you can write your own
> "my_compagnie.cfg" file and start the servlet runner with this file:
> "startserver -config my_compagnie.cfg"
>
> Last but not least: you can even pour my_compagnie.cfg inside the
> my_compagnie folder and start the servlet runner with "startserver -config
> my_compagnie/my_compagnie.cfg". But don't forget that the path in the
> "my_compagnie.cfg" must be relative to location of the config file itself
> thus the line:
>     server.webapp.my_application1.mapping=/cool_appl
>     server.webapp.my_application1.docbase=my_compagnie/my_application1
>     server.webapp.my_application2.mapping=/big_appl
>     server.webapp.my_application2.docbase=my_compagnie/my_application2
> becomes:
>     server.webapp.my_application1.mapping=/cool_appl
>     server.webapp.my_application1.docbase=my_application1
>     server.webapp.my_application2.mapping=/big_appl
>     server.webapp.my_application2.docbase=my_application2
>
> OK, that's all, hope this help.
>
> I've learn all this the hard way! many days of trial and errors and
> frustration! I would very appreciate if someone could confirm and cover the
> still dark areas of the .cfg file.
>
> ZartC++
>
> >     One  possible solution would be to organize your servlets in packages
> > like this:
> >
> >     package counter;
> >     ...
> >     public   class MyServlet .....
> >
> >     ...
> >
> >     than you should put this in a subdirectory called counter and acces it:
> >
> >     http://www.somewhere.com/servlet/counter/MyServlet
> >     or
> >      http://www.somewhere.com/servlet/counter.MyServlet
> >
> >
> >     Hope it helps,
> >
> >       Best wishes,
> >                                      Andras
> >         -----Original Message-----
> >         From: Alec Matias <[EMAIL PROTECTED]>
> >         To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> >         Date: Wednesday, June 09, 1999 8:51 AM
> >         Subject: virtusl directory
> >
> >
> >         Hi!,
> >
> >         I'm using Java Web Server and I want to know if it is possible to
> > create a subdirectory on the servlets directory of java web server so that
> > I can group my servlets classes. If possible, how can I access those
> > servlets on browser? what things to do or setups on java web server in
> > order for me to refer to that servlets on the subdirectory of servlets?Thanks.
> >
> >         Alec Matias
> >         Programmer/Analysts
> >         Information Systems Services
> >         ASPANET Resources, Inc.
> >         www.aspanet.com
> >
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to