开发者

absolute path to the resources of the web application(GWT) on the container that hosts it

开发者 https://www.devze.com 2023-01-10 15:27 出处:网络
I have a GWT app. Am deploying it in tomcat. Within the servlet i want to write some code to create a temporary file. Right now am using

I have a GWT app. Am deploying it in tomcat. Within the servlet i want to write some code to create a temporary file. Right now am using file = new File("./../webapps"+this.getThreadLocalRequest().getContextPath()+"/svg/temp/"+svgName);

But this might not hold true for al开发者_开发知识库l web servers due to the 'webapps' hardcoding thing. Please help me out as of how can i solve this problem.

ps: 1) The servlet extends RemoteServiceServlet. 2) "/svg/temp/"+svgName is my app specific.


Prior to the Servlets 2.2 API, there was no standard location for temporary paths. The 2.2 API adds the javax.servlet.context.tmpdir attribute to the servlet context that defines where to write something:

File directory = (File)getServletContext().getAttribute("javax.servlet.context.tmpdir");
0

精彩评论

暂无评论...
验证码 换一张
取 消