• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specifying a resource path with SerlvetContext

 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just one question: while it's true that the ServletContext.getRequestDispatcher("/foo.jsp") must start with a "/", is the same true when we invoke the ServletContext.getResourceAsStream("foo.jar")? I mean, shall the resource name start with a "/"?
 
Roger Yates
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marco,

From the J2EE API:
getResourceAsStream:
The path must be specified according to the rules given in getResource.


getResource:
Returns a URL to the resource that is mapped to a specified path. The path must begin with a "/" and is interpreted as relative to the current context root.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic