Reputation: 51
I try to access a local file from a RESTFul service. Is there any way to get the real path of the running service ? (as we can do in a servlet)
Server : glassfish 3.0.1 IDE : Eclipse Helios
Thx
Upvotes: 0
Views: 3687
Reputation: 1
Code:
@Context ServletContext context;//you can specify this above method as annotation
String realPath = context.getRealPath("/");
Upvotes: 0
Reputation: 2077
Which framework you are using for REST web service?
You can get the real path in Jersey by following way:
@Context ServletContext context //you can specify in your method argument
String realPath = context.getRealPath("/");
Think will help you.
Upvotes: 6