Package com.google.appengine.api.urlfetch

Examples of com.google.appengine.api.urlfetch.HTTPMethod


    fetchService = URLFetchServiceFactory.getURLFetchService();
  }

  public FetchResponse fetch(FetchRequest request) throws FetchException {

    HTTPMethod method;
    switch (request.getMethod()) {
      case POST:
        method = HTTPMethod.POST;
        break;
      case HEAD:
View Full Code Here


  public Response httpRequest(HttpMethod method, Boolean WithTokenHeader)
      throws WeiboException {
    InetAddress ipaddr;
    int responseCode = -1;
    try {
      HTTPMethod m=null;
      if (method instanceof PostMethod){
        m = HTTPMethod.POST;
      }else{
        m = HTTPMethod.GET;
      }
View Full Code Here

    fetchService = URLFetchServiceFactory.getURLFetchService();
  }

  public FetchResponse fetch(FetchRequest request) throws FetchException {

    HTTPMethod method;
    switch (request.getMethod()) {
      case POST:
        method = HTTPMethod.POST;
        break;
      case HEAD:
View Full Code Here

            request_url = new URL(protocol, addr, port, path);
        } catch (java.net.MalformedURLException e) {
            throw new RuntimeException(e);
        }

        HTTPMethod method = HTTPMethod.valueOf(apache_request.getRequestLine().getMethod());
        _appengine_hrequest = new HTTPRequest(request_url, method, allowTruncate()
                                              .doNotFollowRedirects());

        Header[] apache_headers = apache_request.getAllHeaders();
        for (int i = 0; i < apache_headers.length; i++) {
View Full Code Here

  }

  @Override
  protected UrlFetchRequest buildRequest(String method, String url) throws IOException {
    Preconditions.checkArgument(supportsMethod(method), "HTTP method %s not supported", method);
    HTTPMethod httpMethod;
    if (method.equals(HttpMethods.DELETE)) {
      httpMethod = HTTPMethod.DELETE;
    } else if (method.equals(HttpMethods.GET)) {
      httpMethod = HTTPMethod.GET;
    } else if (method.equals(HttpMethods.HEAD)) {
View Full Code Here

    String sourceUri = req.getRequestURI();
    String query = req.getQueryString() != null ? req.getQueryString() : "";
    String targetUri = targetUriPrefix + sourceUri.substring(sourceUriPrefix.length()) + query;
    log.info("Forwarding request: " + sourceUri + query + " to " + targetUri);

    HTTPMethod fetchMethod = HTTPMethod.valueOf(req.getMethod());
    HTTPRequest fetchRequest = new HTTPRequest(new URL(targetUri), fetchMethod);
    fetchRequest.setPayload(copy(req.getInputStream(), new ByteArrayOutputStream()).toByteArray());
    HTTPResponse fetchResponse = fetch.fetch(fetchRequest);
    copyResponse(fetchResponse, resp);
  }
View Full Code Here

TOP

Related Classes of com.google.appengine.api.urlfetch.HTTPMethod

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.