Bryce
Bryce

Reputation: 467

How do you access the Servlet Context (on the server) when using GWT Request Factory?

I need access to the ServletContext object that is usually available in servlets so that I can call methods like:

String fullPath = getServletContext().getRealPath("images/file.jpg");

I'm sure there is something built-in, I just need to figure out what it is.

Upvotes: 1

Views: 1242

Answers (1)

11101101b
11101101b

Reputation: 7779

All you need to do is:

String fullPath = RequestFactoryServlet.getThreadLocalServletContext().getRealPath("images/file.jpg");

Upvotes: 1

Related Questions