RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread Justin Rowles

 Hello List...

Hallo Newbie ;-)

 NEWBIE:  I want to generate the welcome page for my domain so 
 I mapped a test servlet to / in the web.xml for my context.
 
 PROBLEM:  A test.gif image is not rendered by the servlet - 
 as it appears the path is not found.

Are you trying to return html including an image link (such as img src=test.gif) 
or trying to stream an image via the servlet?  

If the latter, then jsp is the wrong tool - it is text only.  If not, read on:

*** Can you send us the location and output of your jsp page and the location of your 
gif please? ***

It sounds like a simple problem.

 OBSERVED:  If I map the servlet instead to /intro then the 
 test.gif is rendered ok.
 
 TRIED:  Using various path combinations/test.gif, 
 test.gif etc - no result.
 
 NOTE:  I've read some postings advising locating files should 
 be done as in InputStream [getResourceAsStream()].  Is it 
 applicable in this case when all I want is a simple 
   out.println( img src=\/test.gif ... etc )?

Oh, then you are trying to do it right!  Good.

J.
-- 
You're only jealous cos the little penguins are talking to me. 



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




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




RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread john-paul delaney



On Mon, 18 Feb 2002, Justin Rowles wrote:


  PROBLEM:  A test.gif image is not rendered by the servlet - 
  as it appears the path is not found.
 
 Are you trying to return html including an image link (such as img src=test.gif) 
or trying to stream an image via the servlet?  
 
 If the latter, then jsp is the wrong tool - it is text only.  If not, read on:

Yes, the latter.  Only I was thinking of generating the page with a servlet, and not 
creating a .jsp file.  Is this terribly mistaken?

 
  OBSERVED:  If I map the servlet instead to /intro then the 
  test.gif is rendered ok.


I'm confused as to why once I change the servlet-mapping from / to /intro that the 
.gif is read.

The path to the servlet is standard:
$CATALINA_HOME/webapps/ap.org/WEB-INF/classes/intro.class.

The image is in the context root $CATALINA_HOME/webapps/ap.org/


  NOTE:  I've read some postings advising locating files should 
  be done as in InputStream [getResourceAsStream()].  Is it 
  applicable in this case when all I want is a simple 
  out.println( img src=\/test.gif ... etc )?
 
 Oh, then you are trying to do it right!  Good.

But the simple PrintWriter statement to write the html img element works fine when 
the servlet-mapping is not /?  Can't I just use the same in some other guise - or am 
I way off-track?

thanks for your comments/j-p.


---
 JUSTATEST Art Online
  www.justatest.com




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




RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread Justin Rowles

 I'm confused as to why once I change the servlet-mapping from 
 / to /intro that the .gif is read.

So am I ;-)

Can you print out the output from either case and send it.

J.



***
For more information on Ordnance Survey products and services,
visit our web site at http://www.ordnancesurvey.co.uk
***




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




RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread john-paul delaney


Thanks Justin...

excerpt from web.xml

 servlet
   servlet-name
  intro
   /servlet-name
   servlet-class
  intro
   /servlet-class
 /servlet

 servlet-mapping
   servlet-nameintro/servlet-name
   url-pattern/intro/url-pattern
 /servlet-mapping
  

intro.class is in $CATALINA_HOME/webapps/ap.org/WEB-INF/classes
test.gif in in $CATALINA_HOME/webapps/ap.org/


intro.java

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class intro extends HttpServlet {

   public void doGet( HttpServletRequest req, HttpServletResponse res )
   throws ServletException, IOException {

   res.setContentType(text/html);
   PrintWriter out = res.getWriter();

   out.println( htmlheadtitlejustatest/title/head );

   out.println(img src=\/test.gif\ width=\146\ height=\125\ 
alt=\TEST\);

   out.println( bodyh1Justatest...!/h1/body/html );
   }
}
 

Here I realise I may have misled you: 
This page renders ok if I explicitly point to url www.domain.org/intro 
 ^
It fails if I change the url-pattern within the servlet-mapping to / (and access it 
with the url www.domain.org/) - the test.gif is no longer found by the server.


Any suggestions? Rgds/j-p.



On Mon, 18 Feb 2002, Justin Rowles wrote:

  I'm confused as to why once I change the servlet-mapping from 
  / to /intro that the .gif is read.
 
 So am I ;-)
 
 Can you print out the output from either case and send it.
 
 J.
 

---
 JUSTATEST Art Online
  www.justatest.com




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




RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread Larry Isaacs



 -Original Message-
 From: john-paul delaney [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 1:34 PM
 To: Tomcat Users List
 Subject: RE: NewB/Default Servlet:Can't find .gif
 
 
 
 
 On Mon, 18 Feb 2002, Justin Rowles wrote:
 
 
   PROBLEM:  A test.gif image is not rendered by the servlet - 
   as it appears the path is not found.
  
  Are you trying to return html including an image link (such 
 as img src=test.gif) or trying to stream an image via the 
 servlet?  
  
  If the latter, then jsp is the wrong tool - it is text 
 only.  If not, read on:
 
 Yes, the latter.  Only I was thinking of generating the page 
 with a servlet, and not creating a .jsp file.  Is this 
 terribly mistaken?
 
  
   OBSERVED:  If I map the servlet instead to /intro then the 
   test.gif is rendered ok.
 
 
 I'm confused as to why once I change the servlet-mapping from 
 / to /intro that the .gif is read.

The default servlet handles requests that don't map to some other
serlvet.  This usually includes all static content and requests
that match directories.  It is the resposibility of the default
servlet to serve these requests in a appropriate manner. The
default servlet supplied by Tomcat implements serving static
resources and directory listings.  If your default servlet doesn't
support this, you will lose this feature if you replace Tomcat's
default servlet.

Larry

 
 The path to the servlet is standard:
 $CATALINA_HOME/webapps/ap.org/WEB-INF/classes/intro.class.
 
 The image is in the context root $CATALINA_HOME/webapps/ap.org/
 
 
   NOTE:  I've read some postings advising locating files should 
   be done as in InputStream [getResourceAsStream()].  Is it 
   applicable in this case when all I want is a simple 
 out.println( img src=\/test.gif ... etc )?
  
  Oh, then you are trying to do it right!  Good.
 
 But the simple PrintWriter statement to write the html img 
 element works fine when the servlet-mapping is not /?  
 Can't I just use the same in some other guise - or am I way off-track?
 
 thanks for your comments/j-p.
 
 
 ---
  JUSTATEST Art Online
   www.justatest.com
 
 
 
 
 --
 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: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread john-paul delaney


Is there a way then, to automatically invoke a servlet by pointing to the url
www.mydomain.com (Or am I obliged to use .jsps)?

thanks/j-p.


On Mon, 18 Feb 2002, Larry Isaacs wrote:
 
 The default servlet handles requests that don't map to some other
 serlvet.  This usually includes all static content and requests
 that match directories.  It is the resposibility of the default
 servlet to serve these requests in a appropriate manner. The
 default servlet supplied by Tomcat implements serving static
 resources and directory listings.  If your default servlet doesn't
 support this, you will lose this feature if you replace Tomcat's
 default servlet.
 
 Larry
 


---
 JUSTATEST Art Online
  www.justatest.com





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




RE: NewB/Default Servlet:Can't find .gif

2002-02-18 Thread Larry Isaacs

I don't know of a way to map www.mydomain.com to a servlet
without that servlet being the default servlet.  The way
servlet mapping works, I think this is unavoidable.  If your
servlet isn't able to be the default servlet, it will have
to be invoked indirectly.  You could try an index.jsp
that forwards to your servlet.

Cheers,
Larry

 -Original Message-
 From: john-paul delaney [mailto:[EMAIL PROTECTED]]
 Sent: Monday, February 18, 2002 3:30 PM
 To: Tomcat Users List
 Subject: RE: NewB/Default Servlet:Can't find .gif
 
 
 
 Is there a way then, to automatically invoke a servlet by 
 pointing to the url
 www.mydomain.com (Or am I obliged to use .jsps)?
 
 thanks/j-p.
 
 
 On Mon, 18 Feb 2002, Larry Isaacs wrote:
  
  The default servlet handles requests that don't map to some other
  serlvet.  This usually includes all static content and requests
  that match directories.  It is the resposibility of the default
  servlet to serve these requests in a appropriate manner. The
  default servlet supplied by Tomcat implements serving static
  resources and directory listings.  If your default servlet doesn't
  support this, you will lose this feature if you replace Tomcat's
  default servlet.
  
  Larry
  
 
 
 ---
  JUSTATEST Art Online
   www.justatest.com
 
 
 
 
 
 --
 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]