getServletContext().getRealPath(File.separator) returns null in 2.6.1

94 views
Skip to first unread message

RT

unread,
Jan 6, 2016, 2:32:29 PM1/6/16
to GWT Users
I just updated my 2.5.1  GWT app to 2.6.1.  It all seems to work fine except that on the server side in my RPC handling code getServletContext().getRealPath(File.separator) returns null in 2.6.1 whereas in 2.5.1 it returned the local path: C:\Users\Paul\workspace\MyApp\war

Any idea how to correct this?


Note: When deployed out to my Tomcat linux sever it works correctly.  The problem is only when running from Eclipse in dev mode.

JonL

unread,
Jan 7, 2016, 9:19:09 AM1/7/16
to GWT Users
This is less about GWT and more about the Jetty embedded in the GWT and Tomcat handling things differently.  There apparently is some ambiguity in the handling of "/" in the standard or one of them has a bug.  I wrote a wrapper method to deal with it:  Basically, if the path returned is null, it checks whether there is a "/" at he beginning , if there is, it removes it, if there is not, it adds it.  This has made it work correctly across containers.
Reply all
Reply to author
Forward
0 new messages