tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Isaacs <Larry.Isa...@sas.com>
Subject RE: --- Please helpme: Tomcat visibility (I think!)
Date Wed, 16 Jan 2002 19:53:00 GMT


> -----Original Message-----
> From: Marcelo Demestri [mailto:kausario@hotmail.com]
> Sent: Wednesday, January 16, 2002 6:38 PM
> To: Tomcat Users List
> Subject: Re: --- Please helpme: Tomcat visibility (I think!)
> 
> 
> Thanks you very much Larry but...
> What do you mean with "or allow that docBase to be auto-served" ?

You don't have to specify a <Context...> in server.xml.  It will
auto-serve subdirectories of the <Host> appBase directory which
is "webapps" in the default installation.

> 
> My servlet receives user's parameters (the "webapp"-but here 
> this concepts
> is personal and a little different for the "official" term- 
> to deploy) and
> according to them it looks for the information that needs to 
> display the
> contents of this application (i.e. jsp pages). I wanted to be 
> able to locate
> this information in any place, but only works when I locate it in the
> webapps/ROOT.
> 
> If I put the jsp pages in a anyone directory (i.e.
> c:/projects/MyApp/html/*.jsp) and wanted that the call of my servlet
> "/MyApp/html/arch.jsp" worked, how I would have to do it? 
> Defining a context
> "project"? Defining to "project" like context root?

Here you would typically include a <Context> declaration in your
server.xml since the web application is outside the auto-served
"webapps" directory, i.e.

    <Context path="/MyApp" docBase="c:/projects/MyApp" ...>

> 
> In IIS I can define an "application" (can be anyone folder) and
> automatically it enters under the publication hierarchy
> "inetpub/wwwroot/folder", and as "inetpub/wwwroot" is 
> publication's root,
> request of the type "/folder/html/arch.jsp" is made without errors.

Note that IIS's "inetpub/wwwroot" folder is equivalent to
Tomcat's "webapps/ROOT" folder, not the "webapps" folder.
Both "wwwroot" and "ROOT" are "root" contexts.

Your servlet appears to be hard coded to work only if your content
is deployed under a "root" context.  You will have to choose between
keeping this restriction or fixing your servlet to be more flexible.
Not knowing much about your servlet, I can't speculate what the fix
would be.

Cheers,
Larry

> 
> I hope not to have entangled much! and Pardon by my English, 
> is not very
> good: -)
> 
>             Marcelo
> 
> ----- Original Message -----
> From: "Larry Isaacs" <Larry.Isaacs@sas.com>
> To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> Sent: Wednesday, January 16, 2002 7:58 AM
> Subject: RE: --- Please helpme: Tomcat visibility (I think!)
> 
> 
> > If you use:
> >
> >     <Context path="/MyApp" docBase="MyApp" ...
> >
> > or allow that docBase to be auto-served and have:
> >
> >     CATALINA_HOME/webapps/MyApp
> >     CATALINA_HOME/webapps/MyApp/html/arch.jsp
> >     CATALINA_HOME/webapps/MyApp/WEB-INF
> >     ... etc.
> >
> > then "/html/arch.jsp" is the correct URL.
> >
> > If you use:
> >
> >     <Context path="" docBase="ROOT" ...
> >
> > or allow that docBase to be auto and have:
> >
> >     CATALINA_HOME/webapps/ROOT/MyApp
> >     CATALINA_HOME/webapps/ROOT/MyApp/html/arch.jsp
> >     CATALINA_HOME/webapps/ROOT/WEB-INF
> >     ... etc.
> >
> > then "/MyApp/html/arch.jsp" is the correct URL.
> > In this case MyApp gets treated as an ordinary directory
> > rather than as a web application.
> >
> > If the IIS+JRun was working, I would assume you
> > were using a deployment similar to the later case
> > above.
> >
> > Note, you don't state exactly what the servlet is
> > doing.  I could be wrong in my interpretation of what you
> > mean by "call" in "creating the path to call certain jsp".
> > I'm assuming a RequestDispatcher include or forward.
> >
> > Cheers,
> > Larry
> >
> > > -----Original Message-----
> > > From: Marcelo Demestri [mailto:kausario@hotmail.com]
> > > Sent: Wednesday, January 16, 2002 3:01 PM
> > > To: Tomcat Users List
> > > Subject: Re: --- Please helpme: Tomcat visibility (I think!)
> > >
> > >
> > > Thanks Larry for the answer!
> > >
> > > I try with "/html/arch.jsp" instead of "/MyApp/html/arch.jsp"
> > > but still
> > > don't work.
> > > By default, it would not have to be "%CATALINA_HOME%/webapps"
> > > the context
> > > root? This is correct? I worked with IIS(+JRun), the request
> > > generated by my
> > > servlet ("/MyApp/html/arch.jsp") work in this environment,
> > > and when I began
> > > with Tomcat I thought that wwwroot=webapps.
> > > I must migrate all to Apache(1.3.22)+Tomcat(4.0.1) and what
> > > wanted is not to
> > > have to modify the servlet (built by other person), and to
> > > make it work in
> > > Apache+Tomcat as it works with IIS+JRun.
> > >
> > > More suggestions are appreciate!
> > > Thanks
> > >
> > >             Marcelo
> > >
> > > ----- Original Message -----
> > > From: "Larry Isaacs" <Larry.Isaacs@sas.com>
> > > To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> > > Sent: Wednesday, January 16, 2002 5:13 AM
> > > Subject: RE: --- Please helpme: Tomcat visibility (I think!)
> > >
> > >
> > > > It looks like your relative path should be "/html/arch.jsp",
> > > > not "/MyApp/html/arch.jsp".  When refering to a page
> > > > within the same web application, you shouldn't include
> > > > the context name. It worked under ROOT because "/MyApp"
> > > > in this case isn't a context name but a directory name,
> > > > making "/MyApp/html/arch.jsp" the correct URL.
> > > >
> > > > Cheers,
> > > > Larry
> > > >
> > > > > -----Original Message-----
> > > > > From: Marcelo Demestri [mailto:kausario@hotmail.com]
> > > > > Sent: Wednesday, January 16, 2002 12:14 PM
> > > > > To: Tomcat Users List
> > > > > Subject: --- Please helpme: Tomcat visibility (I think!)
> > > > >
> > > > >
> > > > > Hi all!
> > > > > I hope that someone can help me, since this is urgent for me.
> > > > > I have a servlet that processes certain information according
> > > > > to the data
> > > > > provided by the user.
> > > > > My problem is: this servlet, when creating the path to call
> > > > > certain jsp,
> > > > > uses a relative path of the type " / MyApp/html/arch.jsp ".
> > > > > My arch.jsp is
> > > > > in the path %CATALINA_HOME%/webapps/MyApp/html/arch.jsp
> > > > > If this structure of directories is not under ROOT (that
> > > is to say,
> > > > > ROOT/MyApp/html/arch.jsp), Tomcat gives back an Error to me
> > > > > "404 Not Found".
> > > > > As I said, I have a folder " MyApp " within " /webapps " but
> > > > > Tomcat does not
> > > > > find the jsp page. Inclusively I created a context for this
> > > > > application, but
> > > > > it does not work. Also it tries servlet mapping within
> > > web.xml without
> > > > > results (good, in fact this is not related to the problem,
> > > > > since servlet is
> > > > > located by Tomcat... what it cannot find are the pages jsp).
> > > > > This is a prove to do anything more general:  locate the jsp
> > > > > pages outside
> > > > > the structure of directories of Tomcat.
> > > > > Any advice or suggestions?
> > > > > Thanks in advance.
> > > > >
> > > > > ****************** My Server.xml
> > > > >     <!-- Define the top level container in our container
> > > hierarchy -->
> > > > >     <Engine name="Standalone" defaultHost="localhost" 
> debug="0">
> > > > >         ...
> > > > >         <!-- Define the default virtual host -->
> > > > >         <Host name="localhost" debug="0" appBase="webapps"
> > > > > unpackWARs="true">
> > > > >         ...
> > > > >             <Context path="/MyApp" docBase="MyApp" debug="0"
> > > > > reloadable="true"/>
> > > > >         </Host>
> > > > >     </Engine>
> > > > >
> > > > >
> > > > > ****************** My web.xml
> > > > > <web-app>
> > > > >     <servlet>
> > > > >         <servlet-name>MyServlet</servlet-name>
> > > > >         <servlet-class>MyServlet</servlet-class>
> > > > >     </servlet>
> > > > >     <servlet-mapping>
> > > > >         <servlet-name>MyServlet</servlet-name>
> > > > >         <url-pattern>/servlet/MyServlet</url-pattern>
> > > > >     </servlet-mapping>
> > > > > </web-app>
> > > > >
> > > > >
> > > > >             Marcelo
> 
> 
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> 

--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message