• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getresourceAsStream

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If our resource is placeds inside of jar file,can we use ServletContext's method:
getresourceAsStream() to read it ? or should we use the classloader's J2SE 's getresourceAsStream() method?
Where is servlet context's getresourceAsStream() and getresouce() methods used? and how are they different from usage of J2SE counterparts?
 
Dumitru Postoronca
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ServletContext's methods work only for resources deployed in a webapp, but not within a JAR.
If you want to load the resource from the JAR, you'll have to use the J2SE methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic