Re: RE: web.xml servlet and resources

2003-02-22 Thread Vernon Wu
One way to deal with this issue is to break down the file type in the someservlet 
directory rathen than having a URL 
mapping for the whole directory. Say for all JSP files, you have 

servlet-mapping
servlet-nameTheServlet/servlet-name
url-pattern/*.jsp/url-pattern
/servlet-mapping

Hope this helps.

30/01/2003 10:40:33 AM, Richard Wallace [EMAIL PROTECTED] wrote:

On Thu, 2003-01-30 at 05:43, Daniel Brown wrote:
 Richard,
 
 You could use HttpServletRequest.getPathInfo() to read the extra path
 information after servlet name, read the corresponding object from disk, set
 an appropriate MIME type, and then send the object back in the response.
 
 But it's a lot of new code for something that doesn't seem like a good thing
 to do.
 

I had thought about that and decided it was a bit inelegant a solution
(especially when it should be easier and require no additional code).

 Why not just,
 - use a standard webapp structure,
 - map the servlet to '/someservlet' as you describe,
 - make an images subdirectory, and
 - link to the images using img src=images/foo.gif from within your
 servlet?
 

That's what I'm trying to do.  The question I have is where should the
images directory go in the webapp layout and how do I configure web.xml
so that the servlet doesn't catch requests to
/someservlet/images/foo.gif?

Right now what I have is a situation where the servlet is mapped to /. 
So the servlet address is http://localhost:8080/someservlet.  I have the
images directory at the root of the webapp (so there is a drectory
$CATALINA_HOME/webapps/someservlet/images).  But when I try and retrieve
an image using http://localhost:8080/someservlet/images/foo.gif the
servlet is sent the request.  My web.xml is as below.

webapp
display-nameSomeServletOfMine/display-name

servlet
servlet-nameTheServlet/servlet-name
servlet-classcom.some.Servlet/servlet-name
/servlet

servlet-mapping
servlet-nameTheServlet/servlet-name
url-pattern//url-pattern
/servlet-mapping
/webapp

So what above needs to change so that a URL of
http://localhost:8080/someservlet/images/foo.gif is not processed by
TheServlet?

Thanks.

 Then, Tomcat does all the work for you. Use the ROOT webapp if you don't
 want the name of the webapp in the URL.
 
 If you want all requests to run through the servlet for security reasons, or
 something, then you should possibly consider using a Servlet 2.3 Filter
 instead - this is exactly what they're designed for.
 
 Dan.
 
  -Original Message-
  From: Richard Wallace [mailto:[EMAIL PROTECTED]
  Sent: 30 January 2003 00:17
  To: [EMAIL PROTECTED]
  Subject: web.xml servlet and resources
 
 
  Hello all,
 
  This is a fairly simple problem but I haven't been able to find an
  answer anywhere (I've been looking for the past day or two).  I'm hoping
  this is a common situation and is possible, but from what I've seen I
  can't see how.
 
  What I want is for the resources (images, css files, etc.) to be in a
  path relative to the servlet.  So, if I have an images directory and the
  servlet URL is http://www.domain.com/some-servlet, the images should be
  accessible from this URL, http://www.domain.com/some-servlet/images.
  So, I want to set the URL pattern for some-servlet to be /.  If I do
  that then every URL beginning with that will be grabbed by the servlet,
  including http://www.domain.com/some-servlet/images/logo.gif (as an
  example).
 
  Suggestions?  Thanks.
  --
  Richard Wallace
  AIM, Inc. (www.a--i--m.com)
  Information Systems Consultants
 
  Providing New Technology,
   the Old-Fashioned Way
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Richard Wallace
AIM, Inc. (www.a--i--m.com)
Information Systems Consultants

Providing New Technology,
 the Old-Fashioned Way


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: RE: web.xml servlet and resources

2003-02-22 Thread Vernon Wu

After sent out the previous email, I just recoginzed the orginal one was more than two 
weeks ago. 

Sorry for unwanted reply.


22/02/2003 3:46:48 PM, Vernon Wu [EMAIL PROTECTED] wrote:

One way to deal with this issue is to break down the file type in the someservlet 
directory rathen than having a URL 
mapping for the whole directory. Say for all JSP files, you have 

servlet-mapping
servlet-nameTheServlet/servlet-name
url-pattern/*.jsp/url-pattern
/servlet-mapping

Hope this helps.

30/01/2003 10:40:33 AM, Richard Wallace [EMAIL PROTECTED] wrote:

On Thu, 2003-01-30 at 05:43, Daniel Brown wrote:
 Richard,
 
 You could use HttpServletRequest.getPathInfo() to read the extra path
 information after servlet name, read the corresponding object from disk, set
 an appropriate MIME type, and then send the object back in the response.
 
 But it's a lot of new code for something that doesn't seem like a good thing
 to do.
 

I had thought about that and decided it was a bit inelegant a solution
(especially when it should be easier and require no additional code).

 Why not just,
 - use a standard webapp structure,
 - map the servlet to '/someservlet' as you describe,
 - make an images subdirectory, and
 - link to the images using img src=images/foo.gif from within your
 servlet?
 

That's what I'm trying to do.  The question I have is where should the
images directory go in the webapp layout and how do I configure web.xml
so that the servlet doesn't catch requests to
/someservlet/images/foo.gif?

Right now what I have is a situation where the servlet is mapped to /. 
So the servlet address is http://localhost:8080/someservlet.  I have the
images directory at the root of the webapp (so there is a drectory
$CATALINA_HOME/webapps/someservlet/images).  But when I try and retrieve
an image using http://localhost:8080/someservlet/images/foo.gif the
servlet is sent the request.  My web.xml is as below.

webapp
display-nameSomeServletOfMine/display-name

servlet
servlet-nameTheServlet/servlet-name
servlet-classcom.some.Servlet/servlet-name
/servlet

servlet-mapping
servlet-nameTheServlet/servlet-name
url-pattern//url-pattern
/servlet-mapping
/webapp

So what above needs to change so that a URL of
http://localhost:8080/someservlet/images/foo.gif is not processed by
TheServlet?

Thanks.

 Then, Tomcat does all the work for you. Use the ROOT webapp if you don't
 want the name of the webapp in the URL.
 
 If you want all requests to run through the servlet for security reasons, or
 something, then you should possibly consider using a Servlet 2.3 Filter
 instead - this is exactly what they're designed for.
 
 Dan.
 
  -Original Message-
  From: Richard Wallace [mailto:[EMAIL PROTECTED]
  Sent: 30 January 2003 00:17
  To: [EMAIL PROTECTED]
  Subject: web.xml servlet and resources
 
 
  Hello all,
 
  This is a fairly simple problem but I haven't been able to find an
  answer anywhere (I've been looking for the past day or two).  I'm hoping
  this is a common situation and is possible, but from what I've seen I
  can't see how.
 
  What I want is for the resources (images, css files, etc.) to be in a
  path relative to the servlet.  So, if I have an images directory and the
  servlet URL is http://www.domain.com/some-servlet, the images should be
  accessible from this URL, http://www.domain.com/some-servlet/images.
  So, I want to set the URL pattern for some-servlet to be /.  If I do
  that then every URL beginning with that will be grabbed by the servlet,
  including http://www.domain.com/some-servlet/images/logo.gif (as an
  example).
 
  Suggestions?  Thanks.
  --
  Richard Wallace
  AIM, Inc. (www.a--i--m.com)
  Information Systems Consultants
 
  Providing New Technology,
   the Old-Fashioned Way
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Richard Wallace
AIM, Inc. (www.a--i--m.com)
Information Systems Consultants

Providing New Technology,
 the Old-Fashioned Way


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: web.xml servlet and resources

2003-01-30 Thread Antonio Vázquez
Richard,

Usually the servlet are in the WEB_INF directory, and this is forbidden for
the users. If you put an image inside web-inf/servlet/images.. you will not
be able to retry it. You cannot use the url .../web-inf/images/...

Usually you create a image folder at the same level that WEB_INF folder, and
you put your image like img src=images/mygif.gif...

Remember that the images are retry by new request to the server by the
navigator (http://mihost/images/mygif.gif) for each img html token.

Antonio,

- Original Message -
From: Richard Wallace [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 30, 2003 1:17 AM
Subject: web.xml servlet and resources


 Hello all,

 This is a fairly simple problem but I haven't been able to find an
 answer anywhere (I've been looking for the past day or two).  I'm hoping
 this is a common situation and is possible, but from what I've seen I
 can't see how.

 What I want is for the resources (images, css files, etc.) to be in a
 path relative to the servlet.  So, if I have an images directory and the
 servlet URL is http://www.domain.com/some-servlet, the images should be
 accessible from this URL, http://www.domain.com/some-servlet/images.
 So, I want to set the URL pattern for some-servlet to be /.  If I do
 that then every URL beginning with that will be grabbed by the servlet,
 including http://www.domain.com/some-servlet/images/logo.gif (as an
 example).

 Suggestions?  Thanks.
 --
 Richard Wallace
 AIM, Inc. (www.a--i--m.com)
 Information Systems Consultants

 Providing New Technology,
  the Old-Fashioned Way


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: web.xml servlet and resources

2003-01-30 Thread Lindomar
Hi Richard, if i didn't understand wrong
If you want put a image using relative path, the source of your image must
be src=/yourApp/images/logo.gif, for example.

Good luck!

- Original Message -
From: Richard Wallace [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, January 29, 2003 22:17
Subject: web.xml servlet and resources


 Hello all,

 This is a fairly simple problem but I haven't been able to find an
 answer anywhere (I've been looking for the past day or two).  I'm hoping
 this is a common situation and is possible, but from what I've seen I
 can't see how.

 What I want is for the resources (images, css files, etc.) to be in a
 path relative to the servlet.  So, if I have an images directory and the
 servlet URL is http://www.domain.com/some-servlet, the images should be
 accessible from this URL, http://www.domain.com/some-servlet/images.
 So, I want to set the URL pattern for some-servlet to be /.  If I do
 that then every URL beginning with that will be grabbed by the servlet,
 including http://www.domain.com/some-servlet/images/logo.gif (as an
 example).

 Suggestions?  Thanks.
 --
 Richard Wallace
 AIM, Inc. (www.a--i--m.com)
 Information Systems Consultants

 Providing New Technology,
  the Old-Fashioned Way


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: web.xml servlet and resources

2003-01-30 Thread Daniel Brown
Richard,

You could use HttpServletRequest.getPathInfo() to read the extra path
information after servlet name, read the corresponding object from disk, set
an appropriate MIME type, and then send the object back in the response.

But it's a lot of new code for something that doesn't seem like a good thing
to do.

Why not just,
- use a standard webapp structure,
- map the servlet to '/someservlet' as you describe,
- make an images subdirectory, and
- link to the images using img src=images/foo.gif from within your
servlet?

Then, Tomcat does all the work for you. Use the ROOT webapp if you don't
want the name of the webapp in the URL.

If you want all requests to run through the servlet for security reasons, or
something, then you should possibly consider using a Servlet 2.3 Filter
instead - this is exactly what they're designed for.

Dan.

 -Original Message-
 From: Richard Wallace [mailto:[EMAIL PROTECTED]]
 Sent: 30 January 2003 00:17
 To: [EMAIL PROTECTED]
 Subject: web.xml servlet and resources


 Hello all,

 This is a fairly simple problem but I haven't been able to find an
 answer anywhere (I've been looking for the past day or two).  I'm hoping
 this is a common situation and is possible, but from what I've seen I
 can't see how.

 What I want is for the resources (images, css files, etc.) to be in a
 path relative to the servlet.  So, if I have an images directory and the
 servlet URL is http://www.domain.com/some-servlet, the images should be
 accessible from this URL, http://www.domain.com/some-servlet/images.
 So, I want to set the URL pattern for some-servlet to be /.  If I do
 that then every URL beginning with that will be grabbed by the servlet,
 including http://www.domain.com/some-servlet/images/logo.gif (as an
 example).

 Suggestions?  Thanks.
 --
 Richard Wallace
 AIM, Inc. (www.a--i--m.com)
 Information Systems Consultants

 Providing New Technology,
  the Old-Fashioned Way


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: web.xml servlet and resources

2003-01-30 Thread Sean Dockery
Look in the J2EE docs for HttpServletRequest.getPathInfo.

Sean Dockery
[EMAIL PROTECTED]

-Original Message-
From: Richard Wallace [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 29, 2003 17:17
To: [EMAIL PROTECTED]
Subject: web.xml servlet and resources


Hello all,

This is a fairly simple problem but I haven't been able to find an
answer anywhere (I've been looking for the past day or two).  I'm hoping
this is a common situation and is possible, but from what I've seen I
can't see how.

What I want is for the resources (images, css files, etc.) to be in a
path relative to the servlet.  So, if I have an images directory and the
servlet URL is http://www.domain.com/some-servlet, the images should be
accessible from this URL, http://www.domain.com/some-servlet/images. 
So, I want to set the URL pattern for some-servlet to be /.  If I do
that then every URL beginning with that will be grabbed by the servlet,
including http://www.domain.com/some-servlet/images/logo.gif (as an
example).

Suggestions?  Thanks.
-- 
Richard Wallace
AIM, Inc. (www.a--i--m.com)
Information Systems Consultants

Providing New Technology,
 the Old-Fashioned Way




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: web.xml servlet and resources

2003-01-30 Thread Richard Wallace
On Thu, 2003-01-30 at 05:43, Daniel Brown wrote:
 Richard,
 
 You could use HttpServletRequest.getPathInfo() to read the extra path
 information after servlet name, read the corresponding object from disk, set
 an appropriate MIME type, and then send the object back in the response.
 
 But it's a lot of new code for something that doesn't seem like a good thing
 to do.
 

I had thought about that and decided it was a bit inelegant a solution
(especially when it should be easier and require no additional code).

 Why not just,
 - use a standard webapp structure,
 - map the servlet to '/someservlet' as you describe,
 - make an images subdirectory, and
 - link to the images using img src=images/foo.gif from within your
 servlet?
 

That's what I'm trying to do.  The question I have is where should the
images directory go in the webapp layout and how do I configure web.xml
so that the servlet doesn't catch requests to
/someservlet/images/foo.gif?

Right now what I have is a situation where the servlet is mapped to /. 
So the servlet address is http://localhost:8080/someservlet.  I have the
images directory at the root of the webapp (so there is a drectory
$CATALINA_HOME/webapps/someservlet/images).  But when I try and retrieve
an image using http://localhost:8080/someservlet/images/foo.gif the
servlet is sent the request.  My web.xml is as below.

webapp
display-nameSomeServletOfMine/display-name

servlet
servlet-nameTheServlet/servlet-name
servlet-classcom.some.Servlet/servlet-name
/servlet

servlet-mapping
servlet-nameTheServlet/servlet-name
url-pattern//url-pattern
/servlet-mapping
/webapp

So what above needs to change so that a URL of
http://localhost:8080/someservlet/images/foo.gif is not processed by
TheServlet?

Thanks.

 Then, Tomcat does all the work for you. Use the ROOT webapp if you don't
 want the name of the webapp in the URL.
 
 If you want all requests to run through the servlet for security reasons, or
 something, then you should possibly consider using a Servlet 2.3 Filter
 instead - this is exactly what they're designed for.
 
 Dan.
 
  -Original Message-
  From: Richard Wallace [mailto:[EMAIL PROTECTED]]
  Sent: 30 January 2003 00:17
  To: [EMAIL PROTECTED]
  Subject: web.xml servlet and resources
 
 
  Hello all,
 
  This is a fairly simple problem but I haven't been able to find an
  answer anywhere (I've been looking for the past day or two).  I'm hoping
  this is a common situation and is possible, but from what I've seen I
  can't see how.
 
  What I want is for the resources (images, css files, etc.) to be in a
  path relative to the servlet.  So, if I have an images directory and the
  servlet URL is http://www.domain.com/some-servlet, the images should be
  accessible from this URL, http://www.domain.com/some-servlet/images.
  So, I want to set the URL pattern for some-servlet to be /.  If I do
  that then every URL beginning with that will be grabbed by the servlet,
  including http://www.domain.com/some-servlet/images/logo.gif (as an
  example).
 
  Suggestions?  Thanks.
  --
  Richard Wallace
  AIM, Inc. (www.a--i--m.com)
  Information Systems Consultants
 
  Providing New Technology,
   the Old-Fashioned Way
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
-- 
Richard Wallace
AIM, Inc. (www.a--i--m.com)
Information Systems Consultants

Providing New Technology,
 the Old-Fashioned Way


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]