I am implementing rest web service using Jersey. I need to have object of ServletContext to save the file in the application directory. Please help me to get the context.
<
use the annotation @context (Method level injection)
public Response getContext(@Context HttpServletRequest req, @Context HttpServletResponse res)throws Exception
{
System.out.println("Context Path is:"+req.getRequestURL().toString());
result=req.getRequestURL().toString();
return Response.status(200).entity(result).build();
}