servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread Scott Eade

How do I default a user to my servlet without blocking access
to other directories?  Using a default mapping of "/" results in
failure to gain access to resources under my servlet directory.

I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.

Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
structure like this:

myapp
styles
global.css
WEB_INF
web.xml
lib
[jar files]

web.xml defines a servlet whose output includes a reference to 
http://mysite.com/myapp/styles/global.css

If I set my servlet mapping up like this:

myapp
/

then the stylesheet cannot be loaded when the user surfs to
http://mysite.com/myapp/

Alternatively if I set up my mapping like this:

myapp
/foo/*

then the stylesheet can be located, but the user must surf to
http://mysite.com/myapp/foo/

How can I configure tomcat or structure my directories so that 
a user can surf to http://mysite.com/myapp/ and also successfully
access the stylesheet?

Note that the above is a contrived example.  The real servlet
includes many other resources in the myapp directory to which
the servlet refers.

Any advice would be most welcome.

Thanks,

Scott



--
To unsubscribe:   
For additional commands: 
Troubles with the list: 




Re: servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread ian silvester

Its a little clunky, but you could use your second 'foo' mapping, and then
have an index.htm that does a meta-refresh to redirect them to your servlet:




Not nice and invisible I know, but it'll work..

ian



- Original Message -
From: "Scott Eade" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 21, 2001 12:53 PM
Subject: servlet-mapping problem - tomcat 4.0.1


> How do I default a user to my servlet without blocking access
> to other directories?  Using a default mapping of "/" results in
> failure to gain access to resources under my servlet directory.
>
> I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.
>
> Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
> structure like this:
>
> myapp
> styles
> global.css
> WEB_INF
> web.xml
> lib
> [jar files]
>
> web.xml defines a servlet whose output includes a reference to
> http://mysite.com/myapp/styles/global.css
>
> If I set my servlet mapping up like this:
> 
> myapp
> /
> 
> then the stylesheet cannot be loaded when the user surfs to
> http://mysite.com/myapp/
>
> Alternatively if I set up my mapping like this:
> 
> myapp
> /foo/*
> 
> then the stylesheet can be located, but the user must surf to
> http://mysite.com/myapp/foo/
>
> How can I configure tomcat or structure my directories so that
> a user can surf to http://mysite.com/myapp/ and also successfully
> access the stylesheet?
>
> Note that the above is a contrived example.  The real servlet
> includes many other resources in the myapp directory to which
> the servlet refers.
>
> Any advice would be most welcome.
>
> Thanks,
>
> Scott
>
>
>
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread SHeyns

set the welcome file list element to the URL address you want to default to
Something like -


pages/main.jsp


This will default a user going to your context to the file pages/main.jsp -
Tomcat (4.1) has a few default context attributes which are located in the
CATALINA_HOME/conf/web.xml which a context will default to if the welcome
file list element is not specified - they are as follows

  
index.html
index.htm
index.jsp
  

HTH

S.

-Original Message-
From: Scott Eade [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 21, 2001 6:54 AM
To: [EMAIL PROTECTED]
Subject: servlet-mapping problem - tomcat 4.0.1


How do I default a user to my servlet without blocking access
to other directories?  Using a default mapping of "/" results in
failure to gain access to resources under my servlet directory.

I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.

Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
structure like this:

myapp
styles
global.css
WEB_INF
web.xml
lib
[jar files]

web.xml defines a servlet whose output includes a reference to 
http://mysite.com/myapp/styles/global.css

If I set my servlet mapping up like this:

myapp
/

then the stylesheet cannot be loaded when the user surfs to
http://mysite.com/myapp/

Alternatively if I set up my mapping like this:

myapp
/foo/*

then the stylesheet can be located, but the user must surf to
http://mysite.com/myapp/foo/

How can I configure tomcat or structure my directories so that 
a user can surf to http://mysite.com/myapp/ and also successfully
access the stylesheet?

Note that the above is a contrived example.  The real servlet
includes many other resources in the myapp directory to which
the servlet refers.

Any advice would be most welcome.

Thanks,

Scott



--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




RE: servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread Cox, Charlie


MyServlet
index.html


I think you have to have an empty "index.html" file to convince the
 that its valid.

This will take all index.html files, so if you have other index.html files
in other directories, add a dummy.html to the  list and map it
to your servlet.

I recall doing this in 3.2, so I'm not sure if it still works in 4.0 -
although I don't see why it wouldn't.

Charlie

> -Original Message-

> From: Scott Eade [mailto:[EMAIL PROTECTED]]
> Sent: Friday, December 21, 2001 7:54 AM
> To: [EMAIL PROTECTED]
> Subject: servlet-mapping problem - tomcat 4.0.1
> 
> 
> How do I default a user to my servlet without blocking access
> to other directories?  Using a default mapping of "/" results in
> failure to gain access to resources under my servlet directory.
> 
> I think I have a fairly standard set-up of tomcat 4.0.1 on win2k.
> 
> Within C:\jakarta-tomcat-4.0.1\webapps I have a directory
> structure like this:
> 
> myapp
> styles
> global.css
> WEB_INF
> web.xml
> lib
> [jar files]
> 
> web.xml defines a servlet whose output includes a reference to 
> http://mysite.com/myapp/styles/global.css
> 
> If I set my servlet mapping up like this:
> 
> myapp
> /
> 
> then the stylesheet cannot be loaded when the user surfs to
> http://mysite.com/myapp/
> 
> Alternatively if I set up my mapping like this:
> 
> myapp
> /foo/*
> 
> then the stylesheet can be located, but the user must surf to
> http://mysite.com/myapp/foo/
> 
> How can I configure tomcat or structure my directories so that 
> a user can surf to http://mysite.com/myapp/ and also successfully
> access the stylesheet?
> 
> Note that the above is a contrived example.  The real servlet
> includes many other resources in the myapp directory to which
> the servlet refers.
> 
> Any advice would be most welcome.
> 
> Thanks,
> 
> Scott
> 
> 
> 
> --
> To unsubscribe:   <mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
> 

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Re: servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread Craig R. McClanahan



On Fri, 21 Dec 2001, Scott Eade wrote:

> Date: Fri, 21 Dec 2001 23:53:42 +1100
> From: Scott Eade <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: servlet-mapping problem - tomcat 4.0.1
>
> How do I default a user to my servlet without blocking access
> to other directories?  Using a default mapping of "/" results in
> failure to gain access to resources under my servlet directory.
>

Understanding this requires a little explanation about what is really
going on.

* The servlet mapping pattern of "/" establishes the
  default servlet -- in other words, the servlet that
  Tomcat will hand the request to if it can find no other
  servlet mapping that matches.

* Tomcat, out of the box, defines a default servlet that
  serves the static resources (including your stylesheet).

* You can take over the default mapping yourself, but then
  you give up Tomcat's standard file-serving service and
  do it yourself if you still need that feature.

To give you suggestions, it would be helpful to understand what you mean
by "default a user to my servlet".  What application functionality are you
trying to accomplish?

Craig


--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>




Re: servlet-mapping problem - tomcat 4.0.1

2001-12-21 Thread Scott Eade

From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> On Fri, 21 Dec 2001, Scott Eade wrote:
> > Subject: servlet-mapping problem - tomcat 4.0.1
> >
> > How do I default a user to my servlet without blocking access
> > to other directories?  Using a default mapping of "/" results in
> > failure to gain access to resources under my servlet directory.
>
> Understanding this requires a little explanation about what is really
> going on.
>
> * The servlet mapping pattern of "/" establishes the
>   default servlet -- in other words, the servlet that
>   Tomcat will hand the request to if it can find no other
>   servlet mapping that matches.
>
> * Tomcat, out of the box, defines a default servlet that
>   serves the static resources (including your stylesheet).
>
> * You can take over the default mapping yourself, but then
>   you give up Tomcat's standard file-serving service and
>   do it yourself if you still need that feature.
>
> To give you suggestions, it would be helpful to understand what you mean
> by "default a user to my servlet".  What application functionality are you
> trying to accomplish?

Thanks Craig.

What I would like to do is be able to serve up some static content
from the root of my web server, say http://mysite.com/ and from there
provide a link to an Apache Turbine application located at
webapps/myapp.  I am simply hoping to provide a relatively
clean url for the application - http://mysite.com/myapp rather than
http://mysite.com/myapp/foo.

I actually have this working at one host provider that uses Zeus
and Resin.  The root directory they provide contains the necessary
resources (styles, templates, etc.) along with the WEB-INF
directory that contains a web.xml with a url-mapping of "/myapp/*"
and everything works fine.

I am switching to a new hosting organization that uses Apache and
Tomcat and I am only now running into this problem.  I thought
the problem was that the new host provider is running tomcat 3.1
(upgrading to 4.01 next week) but then I realised that all of my
development was being done under tomcat with servlet mappings
that included at least some additional component such as
"/myapp/foo/*".

Ultimately I guess I am worried about the aesthetics of the url,
however it would be great if I could somehow mimic the behaviour
of the old site.  What about users that have bookmarked the old
address without the "foo" - I'll have to provide a redirect for them
on top of a redirect that turbine does as a matter of course.  This
will cause some messy behaviour at the beginning of my application.

Incidentally the new hosting organization provides me with my own
virtual tomcat server.  By default they configured a root context
(path="") pointing to a directory called "public_html" and I had
them provide another (path="/myapp"
docBase="/home/myaccount/tomcat/webapps/myapp") where I
am installing my turbine application.  I do have the ability to change
server.xml and restart tomcat if this will help.  I host provider does
need to alter something (mod_jserv or apache I guess) if I add any
new contexts.  It is unclear how this will change when they upgrade
to tomcat 4.01.

I hope this gives you a clearer idea of what I am trying to achieve.

Thanks in advance for any advice.

Scott





--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>