问题
I'm using Restlet with GAE, and the GAE Blobstore API requires a HttpServletRequest object for uploading blobs and a HttpServletResponse object for serving them. Is there any way to get the HttpServletResponse object from the restlet Response?
回答1:
You can use the utility class org.restlet.ext.servlet.ServletUtils to get to the HttpServletRequest :
org.restlet.Request restletRequest = getRequest();
HttpServletRequest servletRequest = ServletUtils.getRequest(restletRequest);
and similar for the response :
org.restlet.Request restletResponse = getResponse();
HttpServletResponse servletResponse = ServletUtils.getResponse(restletResponse);
来源:https://stackoverflow.com/questions/15615450/how-to-get-httpservletresponse-object-in-restlet-for-gae-blobstore-serve