Search code examples
google-app-engineservletsrestlet

How to get HttpServletResponse object in restlet for GAE BlobStore serve


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?


Solution

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