尝试访问request.getServletContext()时找不到方法错误,HttpServletRequest也始终是代理对象
// also tried @RequestScoped
@Path("/res")
public class ProdController {
@Context
private HttpServletRequest request;
@GET
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProductList() {
System.out.println(request.getClass());
// this always prints class com.sun.proxy.$Proxy34
// when I try to access request.getServletContext(); it always shows method not found error
// more code goes here
}
public class ApplicationBinderModule extends ServletModule {
@Override
protected void configureServlets() {
bind(ProdController.class);
serve("/*").with(GuiceContainer.class);
}
}