Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 359388 - [RWT-OSGi Integration]: ServletContext#getRealPath() returns wrong path if deployed in servlet container
Summary: [RWT-OSGi Integration]: ServletContext#getRealPath() returns wrong path if de...
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.5   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Frank Appel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 356910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-29 05:50 EDT by Frank Appel CLA
Modified: 2011-10-04 06:29 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Appel CLA 2011-09-29 05:50:41 EDT
Use the following snippet in your code:

ServletContext sc = RWT.getRequest().getSession().getServletContext();
System.out.println("<<<>>> RealPath /WEB-INF: " + sc.getRealPath("/WEB-INF")); System.out.println("<<<>>> RealPath /: " + sc.getRealPath("/"));

Deploying a RAP application into a servlet container first using RAP 1.4 then using RAP 1.5:

--> RAP 1.4
<<<>>> RealPath /WEB-INF: ...\tomcat\webapps\test14\WEB-INF
<<<>>> RealPath /:        ...\tomcat\webapps\test14\

--> RAP 1.5 M1
<<<>>> RealPath /WEB-INF: .../tomcat/work/Catalina/localhost/test15/eclipse/workspace/.metadata/.plugins/org.eclipse.rap.ui/context/WEB-INF
<<<>>> RealPath /:        .../tomcat/work/Catalina/localhost/test15/eclipse/workspace/.metadata/.plugins/org.eclipse.rap.ui/context/

RAP 1.5 should provide the same output as RAP 1.4...

(By the way: should we add a new component in Bugzilla for RWT-OSGi integration bugs?)
Comment 1 Frank Appel CLA 2011-09-29 06:22:44 EDT
Resolved in CVS-HEAD.

ServletContextWrapper now uses the underlying getRealPath implementation if this does not return null. This is the case if RAP runs within a servlet container using the servlet bridge. Otherwise the wrapper returns the realpath calculation based on the local storage area of the RWTContext service.

The latter is needed to keep the RWTConfigurationImpl working, which still is a remaining of the old W4Toolkit stuff - also it has been renamed and refactored several times. Maybe we will be able to remove this in the future as providing access to the web application's WEB-INF directories like classes and library IMHO should not be used by RWT. In particular as they do not exist in an OSGi standalone runtime.
Comment 2 Rüdiger Herrmann CLA 2011-10-04 06:29:10 EDT
*** Bug 356910 has been marked as a duplicate of this bug. ***