This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't load XSLT file during init

 
Darryl Failla
Ranch Hand
Posts: 129
  • 0
  • 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
Pie
Posts: 20196
26
MySQL Database
  • 0
  • 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
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic