Hi Jwas,
could you please respond to the mailing list and not to me directly?
This way other people can help answer your question to.
PEARCE Robert wrote:
> I'm not sure you can access WEB-INF from the Servlet Context? I thought it
> wasn't served to the client, so wouldn't for example be hanging off the root
> of the servlet context (which '/WEB-INF/') basically means.
I'm not sure whether it's possible to access something in WEB-INF using
getResourceAsStream. You can, however, access stuff in WEB-INF from your
servlet code. It's impossible for a _client_ to access a URL in the
WEB-INF directory. A servlet isn't a client, so servlets can access stuff
in WEB-INF.
As for the original question: what is the result you are trying to obtain?
Can't you just use a FileReader to obtain the same result:
new FileReader("/WEB-INF/Test.txt");
Ronald.
>
>
> -----Original Message-----
> From: Ronald Wildenberg [mailto:[EMAIL PROTECTED]]
> Sent: 13 June 2002 12:24
> To: [EMAIL PROTECTED]
> Subject: [Fwd: Re: getResourceAsStream(java.lang.String path)]
>
> -------- Original Message --------
>
> Subject: Re: getResourceAsStream(java.lang.String path)
> Date: Thu, 13 Jun 2002 16:34:51 +0530
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
>
> But still iam getting the same result
>
> Is there any wrong in my code ?
>
> InputStream in =
> context.getResourceAsStream("/WEB-INF/Test.txt");
> InputStreamReader ir = new
> InputStreamReader(in,US-ASCII);
> while((ch = ir.read())!= -1)
> System.out.print(ch);
>
> ----- Forwarded by Jwas J/IBS on 06/13/02 04:27 PM -----
>
> Ronald Wildenberg <[EMAIL PROTECTED]>
> Sent by: "A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology." <[EMAIL PROTECTED]>
>
> 06/13/02 03:33 PM
> Please respond to "A mailing list for discussion about Sun Microsystem's
> Java Servlet API Technology."
>
> To: [EMAIL PROTECTED]
> cc:
> Subject: Re: getResourceAsStream(java.lang.String path)
>
> You can get a character stream (= Reader) by using
> java.io.InputStreamReader.
>
> Ronald.
>
> "[Jwas J]" wrote:
> Hello
>
> Can anyone tell me where is "getResourceAsStream(java.lang.String path)" is
> used .
>
> We only get byte stream right ? Is there any way to get character stream.
>
> Regards
> Jwas
>
> This e-mail is confidential and intended only for the addressee(s) shown.
> If you are not an intended recipient, please be advised that any use,
> dissemination, forwarding or copying of this e-mail is strictly prohibited.
> Internet e-mails are not necessarily secure and the AXA Group does not
> accept responsibility for changes made to this message after it was sent.
> Please note that incoming and outgoing electronic mail messages may be
> monitored. Should you receive this transmission in error, notify the sender
> immediately. Thank you
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html