You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ross Merritt <ro...@longhairtech.com> on 2001/05/18 16:06:12 UTC

RE: Servlet Placement

wrapper.properties need to add to the classpath
something liker
wrapper.class_path=$(wrapper.tomcat_home)\lib\coreservlets 

Ross


-----Original Message-----
From: Purcell, Scott [mailto:spurcell@dcspremedia.com]
Sent: Friday, May 18, 2001 8:07 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: Servlet Placement


Hello,
I am following Martys book and I am missing something slight.

I created a HelloWorld servlet and placed it in the
D:\tomcat\jakarta-tomcat-3.2.2b2\webapps\ROOT\WEB-INF\classes
and also set my ENV on NT for the servlet.jar and jasper and I CAN YES
compile and all is well.
In my browser if I call http://localhost:8080/servlet/HelloWorld all is
good.

So now I created a directory under classes called coreservlets and moved
that HelloWorld.java file into there, added the package coreservlets; at the
top of the file, recompiled the file (that went well) but I can't get it to
show up in the browser.
I tried
http://localhost:8080/servlet/HelloWorld that does not work.
http://localhost:8080/servlet/coreservlet and that does not work.? Do I need
to set some other ENV for that coreservlet directory? which is where I am
going to put all my testing files?

Thanks,

Scott Purcell

Contexts, Classes, Variables

Posted by Zach Hollandsworth <zh...@quarem.com>.
1) In Tomcat 3.2.1 do separate contexts see static variables of a class the
same?  Or do they have separate ones?

2) different versions of the same class in two contexts on the same tomcat?
(placed in the /WEB-INF/classes directory of that context)

Zach Hollandsworth


RE: web.xml layout

Posted by Richard Draucker <ri...@draucker.com>.
Hmm... correct me where I may be wrong, please.  

If the xml doc doesn't conform to the DTD, it is
not 'valid' xml.  But, so long as it is 'well formed' the
parser will accept it just the same.  

The parser may look to the DTD for a parsing structure, but
the callback utilization of SAX (assuming Tomcat uses SAX to
parse web.xml) will negate any need to have a 'valid' --
as opposed to 'well formed' -- xml document. 

And that is the crux of my question.  Does it really
matter whether web.xml is 'valid' or simply 'well formed'? 



On Sat, 19 May 2001, you wrote:
> It matters, and doesn't have to do with SAX vs. DOM, it's because
> of the DTD - check out this bit of the DTD:
> <!ELEMENT web-app (icon?, display-name?, description?, distribut-able?,
> context-param*, filter*, filter-mapping*, listener*, servlet*,
> servlet-mapping*,
> session-config?, mime-mapping*, welcome-file-list?, error-page*,
> taglib*, resource-env-ref*, resource-ref*, security-constraint*,
> login-config?,
> security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>
> 
> This says that the "servlet-mapping" tags must follow all of the "servlet".
> Basically the
> tags must be in the order above.
> 
> - Robert Petersen
> http://www.orangefood.com
> 
> 
> -----Original Message-----
> From: Richard Draucker [mailto:richard@draucker.com]
> Sent: Saturday, May 19, 2001 9:24 AM
> To: tomcat-user@jakarta.apache.org
> Subject: web.xml layout
> 
> 
> Does anyone know if it makes any difference whether I group
> servlet contexts with servlet mappings or keep all contexts
> together and below them keep all mappings together.
> 
> Assuming the xml file is being processed by SAX, the
> callback handling would make this irrelevant I would think.
> 
> Thoughts?....
> 
> Thanks,
> Richard
-- 
Richard Draucker,  richard@protected-data.com
Protected-Data.Com  www.protected-data.com
Remote data support for web developers.









RE: web.xml layout

Posted by Richard Draucker <ri...@draucker.com>.
Great! Thanks for the link, and cudos to Mike Slinn et.al. 
for the good work.


On Sat, 19 May 2001, you wrote:
> FWIW, I think Mike Slinn has put up a web.xml validator (and other
> useful tools/documentation) at
> 
> http://tomcat.mslinn.com/
> 
> 
> On Sat, 19 May 2001, Robert Petersen wrote:
> 
> > It matters, and doesn't have to do with SAX vs. DOM, it's because
> > of the DTD - check out this bit of the DTD:
> > <!ELEMENT web-app (icon?, display-name?, description?, distribut-able?,
> > context-param*, filter*, filter-mapping*, listener*, servlet*,
> > servlet-mapping*,
> > session-config?, mime-mapping*, welcome-file-list?, error-page*,
> > taglib*, resource-env-ref*, resource-ref*, security-constraint*,
> > login-config?,
> > security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>
> >
> > This says that the "servlet-mapping" tags must follow all of the "servlet".
> > Basically the
> > tags must be in the order above.
> >
> > - Robert Petersen
> > http://www.orangefood.com
> >
> >
> > -----Original Message-----
> > From: Richard Draucker [mailto:richard@draucker.com]
> > Sent: Saturday, May 19, 2001 9:24 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: web.xml layout
> >
> >
> > Does anyone know if it makes any difference whether I group
> > servlet contexts with servlet mappings or keep all contexts
> > together and below them keep all mappings together.
> >
> > Assuming the xml file is being processed by SAX, the
> > callback handling would make this irrelevant I would think.
> >
> > Thoughts?....
> >
> > Thanks,
> > Richard
> >
> >
> >
> >
> >
> >
> >
> >
> 
> Milt Epstein
> Research Programmer
> Software/Systems Development Group
> Computing and Communications Services Office (CCSO)
> University of Illinois at Urbana-Champaign (UIUC)
> mepstein@uiuc.edu
-- 
Richard Draucker,  richard@protected-data.com
Protected-Data.Com  www.protected-data.com
Remote data support for web developers.









RE: web.xml layout

Posted by Milt Epstein <me...@uiuc.edu>.
FWIW, I think Mike Slinn has put up a web.xml validator (and other
useful tools/documentation) at

http://tomcat.mslinn.com/


On Sat, 19 May 2001, Robert Petersen wrote:

> It matters, and doesn't have to do with SAX vs. DOM, it's because
> of the DTD - check out this bit of the DTD:
> <!ELEMENT web-app (icon?, display-name?, description?, distribut-able?,
> context-param*, filter*, filter-mapping*, listener*, servlet*,
> servlet-mapping*,
> session-config?, mime-mapping*, welcome-file-list?, error-page*,
> taglib*, resource-env-ref*, resource-ref*, security-constraint*,
> login-config?,
> security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>
>
> This says that the "servlet-mapping" tags must follow all of the "servlet".
> Basically the
> tags must be in the order above.
>
> - Robert Petersen
> http://www.orangefood.com
>
>
> -----Original Message-----
> From: Richard Draucker [mailto:richard@draucker.com]
> Sent: Saturday, May 19, 2001 9:24 AM
> To: tomcat-user@jakarta.apache.org
> Subject: web.xml layout
>
>
> Does anyone know if it makes any difference whether I group
> servlet contexts with servlet mappings or keep all contexts
> together and below them keep all mappings together.
>
> Assuming the xml file is being processed by SAX, the
> callback handling would make this irrelevant I would think.
>
> Thoughts?....
>
> Thanks,
> Richard
>
>
>
>
>
>
>
>

Milt Epstein
Research Programmer
Software/Systems Development Group
Computing and Communications Services Office (CCSO)
University of Illinois at Urbana-Champaign (UIUC)
mepstein@uiuc.edu


RE: web.xml layout

Posted by Robert Petersen <ro...@orangefood.com>.
It matters, and doesn't have to do with SAX vs. DOM, it's because
of the DTD - check out this bit of the DTD:
<!ELEMENT web-app (icon?, display-name?, description?, distribut-able?,
context-param*, filter*, filter-mapping*, listener*, servlet*,
servlet-mapping*,
session-config?, mime-mapping*, welcome-file-list?, error-page*,
taglib*, resource-env-ref*, resource-ref*, security-constraint*,
login-config?,
security-role*, env-entry*, ejb-ref*, ejb-local-ref*)>

This says that the "servlet-mapping" tags must follow all of the "servlet".
Basically the
tags must be in the order above.

- Robert Petersen
http://www.orangefood.com


-----Original Message-----
From: Richard Draucker [mailto:richard@draucker.com]
Sent: Saturday, May 19, 2001 9:24 AM
To: tomcat-user@jakarta.apache.org
Subject: web.xml layout


Does anyone know if it makes any difference whether I group
servlet contexts with servlet mappings or keep all contexts
together and below them keep all mappings together.

Assuming the xml file is being processed by SAX, the
callback handling would make this irrelevant I would think.

Thoughts?....

Thanks,
Richard









RE: web.xml layout

Posted by CPC Livelink Admin <cp...@fitzpatrick.cc>.
I believe that the web.xml is parsed using the DTD, so rearranging the
elements will make it complain that the format of the file is incorrect.
Even if you find a container which lets you rearrange, the spec says you
should follow the DTD. So to be portable . . . .

Regards,
Paul


-----Original Message-----
From: Richard Draucker [mailto:richard@draucker.com]
Sent: Saturday, May 19, 2001 12:24 PM
To: tomcat-user@jakarta.apache.org
Subject: web.xml layout


Does anyone know if it makes any difference whether I group
servlet contexts with servlet mappings or keep all contexts
together and below them keep all mappings together.

Assuming the xml file is being processed by SAX, the
callback handling would make this irrelevant I would think.

Thoughts?....

Thanks,
Richard









web.xml layout

Posted by Richard Draucker <ri...@draucker.com>.
Does anyone know if it makes any difference whether I group
servlet contexts with servlet mappings or keep all contexts
together and below them keep all mappings together. 

Assuming the xml file is being processed by SAX, the
callback handling would make this irrelevant I would think.

Thoughts?....

Thanks,
Richard








Re: mapping servlets

Posted by Tim Arnold <ar...@stage1.com>.
thanks alot!

Actually the way I got this to work was to change the <url-pattern> below to
this:
<url-pattern>/ServletName</url-pattern>

instead of
<url-pattern>/bin/ServletName</url-pattern>

Richard Draucker wrote:

> Sure.  Set up a servlet context in the WEB-INF/web.xml
> file.  Then, setup an alias (servlet mapping) to the alias
> url you want to use.
>
> Example:
> Servlet Context
> <servlet>
> <servlet-name>myServletAlias</servlet-name>
> <servlet-class>myServlet</servlet-class>
> </servlet>
>
> Servlet Mapping
> <servlet-mapping>
> <servlet-name>myServletAlias</servlet-name>
> <url-pattern>/bin/ServletName</url-pattern>
> </servlet-mapping>
>
> This example will run 'myServlet' whenever the url
> http://www.domainname.com/bin/ServletName is requested.
>
> You can also append .html or whatever to the url-patterns
> to get friendly urls like:
> http://www.domainname.com/users/login.html
>
> If you're using packages, remember to include the package
> name with the <servlet-class>, e.g., Users.myServlet
>
> -Richard
>
> On Sat, 19 May 2001, you wrote:
> > Is it possible to execute a servlet off of anything that does not start
> > with
> > /servlet?
> >
> > I want to start servlets off of:
> > http://www.domainname.com/bin/ServletName
> >
> > Thanks for any help
> > Tim Arnold
> --
> Richard Draucker,  richard@protected-data.com
> Protected-Data.Com  www.protected-data.com
> Remote data support for web developers.


Re: mapping servlets

Posted by Richard Draucker <ri...@draucker.com>.
Sure.  Set up a servlet context in the WEB-INF/web.xml
file.  Then, setup an alias (servlet mapping) to the alias
url you want to use. 

Example:
Servlet Context
<servlet>
<servlet-name>myServletAlias</servlet-name>
<servlet-class>myServlet</servlet-class>
</servlet>

Servlet Mapping
<servlet-mapping>
<servlet-name>myServletAlias</servlet-name>
<url-pattern>/bin/ServletName</url-pattern>
</servlet-mapping>

This example will run 'myServlet' whenever the url
http://www.domainname.com/bin/ServletName is requested.

You can also append .html or whatever to the url-patterns
to get friendly urls like:
http://www.domainname.com/users/login.html

If you're using packages, remember to include the package
name with the <servlet-class>, e.g., Users.myServlet

-Richard


On Sat, 19 May 2001, you wrote:
> Is it possible to execute a servlet off of anything that does not start
> with
> /servlet?
> 
> I want to start servlets off of:
> http://www.domainname.com/bin/ServletName
> 
> Thanks for any help
> Tim Arnold
-- 
Richard Draucker,  richard@protected-data.com
Protected-Data.Com  www.protected-data.com
Remote data support for web developers.









mapping servlets

Posted by Tim Arnold <ar...@stage1.com>.
Is it possible to execute a servlet off of anything that does not start
with
/servlet?

I want to start servlets off of:
http://www.domainname.com/bin/ServletName

Thanks for any help
Tim Arnold


mapping servlets

Posted by ar...@stage1.com.
I just upgraded from jserv to Tomcat. I used to have my servlets
under
/bin instead of /servlet
with:
ApJServMount /bin /root

I still want to use these servlets under Tomcat. But I am struggling
a
bit to configure it. One method I tried was creating a context
called
bin under webapps. Then in the web.xml file I put in:
<web-app>
<servlet-mapping>
        <servlet-name>
            invoker
        </servlet-name>
        <url-pattern>
            *
        </url-pattern>
    </servlet-mapping>

</web-app>


but this didn't work.

I tried also putting in :
ApJServMount /bin /root in the .conf file and then modifying the
default
web.xml file to use invoker for /bin/*

I know this is trivial!

Anyhelp would be appreciated.

Tim Arnold