You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christian Parpart <tr...@gmx.de> on 2000/12/23 10:44:56 UTC

How to access servlets without prefixes

Hi all

how can I access a servlet wich is 
mapped to any *.xml file without giving him
any prefix like /mywebapp?

 <servlet>
  <servlet-name>XmlFilter</servlet-name>
  <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
 </servlet>
 <servlet-mapping>
  <servlet-name>XmlFilter</servlet-name>
  <url-pattern>*.xml</url-pattern>
 </servlet-mapping>

This should be accessable from every sub directory on my host.

 <Host name="www.myhost.org">
   <Context path=""
            docBase="C:/path/to/htdocs"
            debug="0" reloadable="true" trusted="true" >
   </Context>
 </Host>

This data is stored in $tomcat/conf/web.xml, because I thought
these information are available for all hosts defined in server.xml.

But it doesn't work. Why and how should I define it?

Thanks in advance,

Christian Parpart
SurakWare
cparpart@surakware.com
http://www.surakware.com

Re: How to access servlets without prefixes

Posted by Anand Raman <ar...@india-today.com>.
Hi
I think this url could be of some help though i havent tested it out
myself..
http://www.iris.dti.ne.jp/~u-osamu/indexfreebsd122.html
Hope this helps
Anand

On Sat, Dec 23, 2000 at 05:59:06PM +0100, Christian Parpart wrote:
>> -----Ursprungliche Nachricht-----
>> Von: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
>> Christian Parpart wrote:
>> 
>> > Hi all
>> >
>> > how can I access a servlet wich is
>> > mapped to any *.xml file without giving him
>> > any prefix like /mywebapp?
>> >
>> >  <servlet>
>> >   <servlet-name>XmlFilter</servlet-name>
>> >   <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
>> >  </servlet>
>> >  <servlet-mapping>
>> >   <servlet-name>XmlFilter</servlet-name>
>> >   <url-pattern>*.xml</url-pattern>
>> >  </servlet-mapping>
>> >
>> > This should be accessable from every sub directory on my host.
>> >
>> >  <Host name="www.myhost.org">
>> >    <Context path=""
>> >             docBase="C:/path/to/htdocs"
>> >             debug="0" reloadable="true" trusted="true" >
>> >    </Context>
>> >  </Host>
>> >
>> > This data is stored in $tomcat/conf/web.xml, because I thought
>> > these information are available for all hosts defined in server.xml.
>> >
>> 
>> That was true in Tomcat 3.1 (and 4.0), but was changed in 3.2.  
>> You will need to
>> put your servlet and servlet-mapping definitions in the 
>> WEB-INF/web.xml file for
>> each application.
>
>Wonderfull, I think you know how to do that with 4.0, 'cause 
>I downloaded it and configured it without success.
>What should I do to use Cocoon2 or 1.8.1 dev for all my *.xml files.
>I had spend my hole nights to find that out - without any good results.
>Please give me an example if you know how to define that.
>
>> 
>> >
>> > But it doesn't work. Why and how should I define it?
>> >
>> > Thanks in advance,
>> >
>> > Christian Parpart
>> > SurakWare
>> > cparpart@surakware.com
>> > http://www.surakware.com
>> 
>> Craig McClanahan
>> 
>Christian Parpart

AW: How to access servlets without prefixes

Posted by Christian Parpart <tr...@gmx.de>.
> -----Ursprungliche Nachricht-----
> Von: Craig R. McClanahan [mailto:Craig.McClanahan@eng.sun.com]
> Christian Parpart wrote:
> 
> > Hi all
> >
> > how can I access a servlet wich is
> > mapped to any *.xml file without giving him
> > any prefix like /mywebapp?
> >
> >  <servlet>
> >   <servlet-name>XmlFilter</servlet-name>
> >   <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
> >  </servlet>
> >  <servlet-mapping>
> >   <servlet-name>XmlFilter</servlet-name>
> >   <url-pattern>*.xml</url-pattern>
> >  </servlet-mapping>
> >
> > This should be accessable from every sub directory on my host.
> >
> >  <Host name="www.myhost.org">
> >    <Context path=""
> >             docBase="C:/path/to/htdocs"
> >             debug="0" reloadable="true" trusted="true" >
> >    </Context>
> >  </Host>
> >
> > This data is stored in $tomcat/conf/web.xml, because I thought
> > these information are available for all hosts defined in server.xml.
> >
> 
> That was true in Tomcat 3.1 (and 4.0), but was changed in 3.2.  
> You will need to
> put your servlet and servlet-mapping definitions in the 
> WEB-INF/web.xml file for
> each application.

Wonderfull, I think you know how to do that with 4.0, 'cause 
I downloaded it and configured it without success.
What should I do to use Cocoon2 or 1.8.1 dev for all my *.xml files.
I had spend my hole nights to find that out - without any good results.
Please give me an example if you know how to define that.

> 
> >
> > But it doesn't work. Why and how should I define it?
> >
> > Thanks in advance,
> >
> > Christian Parpart
> > SurakWare
> > cparpart@surakware.com
> > http://www.surakware.com
> 
> Craig McClanahan
> 
Christian Parpart


Re: How to access servlets without prefixes

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Christian Parpart wrote:

> Hi all
>
> how can I access a servlet wich is
> mapped to any *.xml file without giving him
> any prefix like /mywebapp?
>
>  <servlet>
>   <servlet-name>XmlFilter</servlet-name>
>   <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
>  </servlet>
>  <servlet-mapping>
>   <servlet-name>XmlFilter</servlet-name>
>   <url-pattern>*.xml</url-pattern>
>  </servlet-mapping>
>
> This should be accessable from every sub directory on my host.
>
>  <Host name="www.myhost.org">
>    <Context path=""
>             docBase="C:/path/to/htdocs"
>             debug="0" reloadable="true" trusted="true" >
>    </Context>
>  </Host>
>
> This data is stored in $tomcat/conf/web.xml, because I thought
> these information are available for all hosts defined in server.xml.
>

That was true in Tomcat 3.1 (and 4.0), but was changed in 3.2.  You will need to
put your servlet and servlet-mapping definitions in the WEB-INF/web.xml file for
each application.

>
> But it doesn't work. Why and how should I define it?
>
> Thanks in advance,
>
> Christian Parpart
> SurakWare
> cparpart@surakware.com
> http://www.surakware.com

Craig McClanahan



Re: How to access servlets without prefixes

Posted by Kurt Bernhard Pruenner <le...@gmx.at>.
Christian Parpart wrote:
>           <Ejb   name="ejb/EmplRecord" type="Entity"
>                  home="com.wombat.empl.EmployeeRecordHome"
>                remote="com.wombat.empl.EmployeeRecord"/>
>
> What does it mean, perhaps 'Extended java bean'?

I'd guess "Enterprise Java Bean", but it's unlikely that this will fix
your problem...

> docBase="C:/Eigene Dateien/projects/surakware/htdocs"

Try using either "Eigene~1" or whatever short name there is for "Eigene
Dateien", as Tomcat isn't all too happy about directory/file names with
spaces in them, and also use a "/" instead of "\" - that's what works
fine for me on Windows NT 4.0... oh - and make sure you get the case of
all your directory/file names correct, as Tomcat doesn't do case
insensitive matching like Windows does; if in doubt, use a DOS prompt
and good old "dir" to be on the safe side... :)

Also, the only "home" attribute I know of would be the ContextManager's,
but that only sets the root to use for relative paths, i.e. it won't do
anything if you're using absolute paths like you're doing.

Anyway, I guess avoiding spaces in file names, using slashes instead of
backslashes and making sure you get the case of all names right should
fix your problem...

-- 
Kurt Bernhard Pruenner --- Haendelstrasse 17 --- 4020 Linz --- Austria
Music: http://www.mp3.com/Leak --- Work: http://www.ssw.uni-linz.ac.at
.......It might be written "Mindfuck", but it's spelt "L-A-I-N".......
np: Kit Clayton - Nia-Ikala (Nek Sanalet)

AW: How to access servlets without prefixes

Posted by Christian Parpart <tr...@gmx.de>.
Hi,

unfortunately there was no description of any home
attribute. I just found in all Tomcat version I
downloaded the following:

          <Ejb   name="ejb/EmplRecord" type="Entity"
                 home="com.wombat.empl.EmployeeRecordHome"
               remote="com.wombat.empl.EmployeeRecord"/>

What does it mean, perhaps 'Extended java bean'?
But you meant to add the home attribute to the context
(the Context-tag?).

      <Host name="cparpart.homeip.net">
        <Context path=""
                 home="??????" <---- [ place it here?, for what ]
                 docBase="C:/Eigene Dateien/projects/surakware/htdocs"
                 debug="0" reloadable="true" trusted="true" >

          <Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="logs"  prefix="surakware_access_log."
suffix=".txt"
                 pattern="common"/>

          <Logger className="org.apache.catalina.logger.FileLogger"
                  directory="logs"  prefix="surakware_log." suffix=".txt"
                  timestamp="true"/>

        </Context>
      </Host>

Thanks, Christian.

> -----Ursprüngliche Nachricht-----
> Von: Dave Smith [mailto:sat-guru@home.com]
> Gesendet: Samstag, 7. Oktober 2000 19:32
> An: tomcat-user@jakarta.apache.org
> Betreff: Re: How to access servlets without prefixes
>
>
> Christian,
>
> add the "home" parameter to the Context. This is
> explained in the the server.xml comments near the
> Context entries. This seems to be required whenever you
> use a directory as docbase which is not in webapps.
>
> Dave
> ----- Original Message -----
> From: "Christian Parpart" <tr...@gmx.de>
> To: "Apache Tomcat (User) MailingList" <to...@jakarta.apache.org>
> Sent: Saturday, December 23, 2000 4:44 AM
> Subject: How to access servlets without prefixes
>
>
> > Hi all
> >
> > how can I access a servlet wich is
> > mapped to any *.xml file without giving him
> > any prefix like /mywebapp?
> >
> >  <servlet>
> >   <servlet-name>XmlFilter</servlet-name>
> >   <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
> >  </servlet>
> >  <servlet-mapping>
> >   <servlet-name>XmlFilter</servlet-name>
> >   <url-pattern>*.xml</url-pattern>
> >  </servlet-mapping>
> >
> > This should be accessable from every sub directory on my host.
> >
> >  <Host name="www.myhost.org">
> >    <Context path=""
> >             docBase="C:/path/to/htdocs"
> >             debug="0" reloadable="true" trusted="true" >
> >    </Context>
> >  </Host>
> >
> > This data is stored in $tomcat/conf/web.xml, because I thought
> > these information are available for all hosts defined in server.xml.
> >
> > But it doesn't work. Why and how should I define it?
> >
> > Thanks in advance,
> >
> > Christian Parpart
> > SurakWare
> > cparpart@surakware.com
> > http://www.surakware.com
>


Re: How to access servlets without prefixes

Posted by Dave Smith <sa...@home.com>.
Christian,

add the "home" parameter to the Context. This is
explained in the the server.xml comments near the
Context entries. This seems to be required whenever you
use a directory as docbase which is not in webapps.

Dave
----- Original Message ----- 
From: "Christian Parpart" <tr...@gmx.de>
To: "Apache Tomcat (User) MailingList" <to...@jakarta.apache.org>
Sent: Saturday, December 23, 2000 4:44 AM
Subject: How to access servlets without prefixes


> Hi all
> 
> how can I access a servlet wich is 
> mapped to any *.xml file without giving him
> any prefix like /mywebapp?
> 
>  <servlet>
>   <servlet-name>XmlFilter</servlet-name>
>   <servlet-class>myServlets.xmlFilter.XmlFilter</servlet-class>
>  </servlet>
>  <servlet-mapping>
>   <servlet-name>XmlFilter</servlet-name>
>   <url-pattern>*.xml</url-pattern>
>  </servlet-mapping>
> 
> This should be accessable from every sub directory on my host.
> 
>  <Host name="www.myhost.org">
>    <Context path=""
>             docBase="C:/path/to/htdocs"
>             debug="0" reloadable="true" trusted="true" >
>    </Context>
>  </Host>
> 
> This data is stored in $tomcat/conf/web.xml, because I thought
> these information are available for all hosts defined in server.xml.
> 
> But it doesn't work. Why and how should I define it?
> 
> Thanks in advance,
> 
> Christian Parpart
> SurakWare
> cparpart@surakware.com
> http://www.surakware.com