* @param request the specified HTTP request
* @return GAE HTTP request
*/
private static com.google.appengine.api.urlfetch.HTTPRequest toGAEHTTPRequest(final HTTPRequest request) {
final URL url = request.getURL();
final HTTPRequestMethod requestMethod = request.getRequestMethod();
com.google.appengine.api.urlfetch.HTTPRequest ret = null;
switch (requestMethod) {
case GET:
ret = new com.google.appengine.api.urlfetch.HTTPRequest(url);
break;
case DELETE:
ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.DELETE);
break;
case HEAD:
ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.HEAD);
break;
case POST:
ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.POST);
break;
case PUT:
ret = new com.google.appengine.api.urlfetch.HTTPRequest(url, HTTPMethod.PUT);
break;
default:
throw new RuntimeException("Unsupported HTTP request method[" + requestMethod.name() + "]");
}
final List<HTTPHeader> headers = request.getHeaders();
for (final HTTPHeader header : headers) {
ret.addHeader(new com.google.appengine.api.urlfetch.HTTPHeader(header.getName(), header.getValue()));