如何获取用于GAE BlobStore服务的restlet中的HttpServletResponse对象

如何获取用于GAE BlobStore服务的restlet中的HttpServletResponse对象

问题描述:

我在GAE中使用Restlet,GAE Blobstore API需要一个HttpServletRequest对象来上传blob和一个HttpServletResponse对象来提供服务。有没有办法从Restlet Response获取HttpServletResponse对象?

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?

您可以使用实用工具类org.restlet.ext .servlet.ServletUtils到达HttpServletRequest:

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);

以及类似的响应:

org.restlet.Request restletResponse = getResponse();
HttpServletResponse servletResponse = ServletUtils.getResponse(restletResponse);