Reputation: 3998
I want to open the xsd file in the web-inf/xsd/output.xsd
This is what I am trying to do
URL url = portletContext.getResource("WEB-INF/xsd/output.xsd");
getResource returns URL but in my case I am getting NullPointerException
and I need to supply this to the newFile to open the file.
File newFile = new File("");
I am confused how to get this working.
UPDATE
Please bear with my english. I got this working. I have a question, I have another file *.xsl
file which would be used to generate the PDF. I cannot delete this file after opening, what would be the effect on the JVM if a file is left open I mean >100 users trying to create the PDF i.e., *.xsl
file will be opened 100 times, in future application is used heavily by the users, does the GC automatically clear all the file descriptors opened?
Upvotes: 0
Views: 438
Reputation: 782
From the API doc of javax.portlet.PortletContext it describes that:
... The path must begin with a slash (/) and is interpreted as relative to the current context root (which usually is the WebContent or web directory of your web application) This method allows the portlet container to make a resource available to portlets from any source. Resources can be located on a local or remote file system, in a database, or in a .war file.
Upvotes: 1