Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't load XSLT file during init

 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to load my XSLT file during my servlet init. This line:
InputStream is = getServletContext().getResourceAsStream(xsltFile);

is giving me a null for the InputStream. Everything looks fine and I can see that xsltFile is the correct pathe to the file. I also tried to generate a URL using .getResource(xsltFile) and got a null for that. Is there some sort of registration or notification that I am missing?
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, what you are missing is that the getResourceAsStream() and getResource() methods don't expect to be passed the complete path to the file. They expect to be passed the path to the file, starting with a slash, relative to the web application's context root. (I got this information from the API documentation for the getResource() method of ServletContext.)
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That did it. Thanks. I wish I would have come here two hours ago.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic