Package org.apache.shindig.gadgets.http

Examples of org.apache.shindig.gadgets.http.HttpRequest.addHeader()


      paramLocation = OAuthParamLocation.AUTH_HEADER;
    }

    switch (paramLocation) {
      case AUTH_HEADER:
        result.addHeader("Authorization", getAuthorizationHeader(oauthParams));
        break;

      case POST_BODY:
        String contentType = result.getHeader("Content-Type");
        if (!OAuth.isFormEncoded(contentType)) {
View Full Code Here


      // Copy over allowed headers
      for (Map.Entry<String, List<String>> header : httpApiRequest.headers.entrySet()) {
        if (!BAD_HEADERS.contains(header.getKey().trim().toUpperCase())) {
          for (String value : header.getValue()) {
            req.addHeader(header.getKey(), value);
          }
        }
      }

      // Extract the gadget URI from the request or the security token
View Full Code Here

          throw new GadgetException(GadgetException.Code.INVALID_PARAMETER,
                  "Malformed header param specified:" + header, HttpResponse.SC_BAD_REQUEST);
        }
        String headerName = Utf8UrlCoder.decode(parts[0]);
        if (!HttpRequestHandler.BAD_HEADERS.contains(headerName.toUpperCase())) {
          req.addHeader(headerName, Utf8UrlCoder.decode(parts[1]));
        }
      }
    }

    // Set the default content type for post requests when a content type is not specified
View Full Code Here

      }
    }

    // Set the default content type for post requests when a content type is not specified
    if ("POST".equals(req.getMethod()) && req.getHeader("Content-Type") == null) {
      req.addHeader("Content-Type", "application/x-www-form-urlencoded");
    } else if ("1".equals(getParameter(request, MULTI_PART_FORM_POST, null))) {
      // We need the entire header from the original request because it comes with a boundary value
      // we need to reuse.
      req.addHeader("Content-Type", request.getHeader("Content-Type"));
    }
View Full Code Here

    if ("POST".equals(req.getMethod()) && req.getHeader("Content-Type") == null) {
      req.addHeader("Content-Type", "application/x-www-form-urlencoded");
    } else if ("1".equals(getParameter(request, MULTI_PART_FORM_POST, null))) {
      // We need the entire header from the original request because it comes with a boundary value
      // we need to reuse.
      req.addHeader("Content-Type", request.getHeader("Content-Type"));
    }

    req.setIgnoreCache("1".equals(getParameter(request, Param.NO_CACHE.getKey(), null)));

View Full Code Here

          throw new GadgetException(GadgetException.Code.INTERNAL_SERVER_ERROR,
              "Malformed header specified,");
        }
        String headerName = Utf8UrlCoder.decode(parts[0]);
        if (!HttpRequestHandler.BAD_HEADERS.contains(headerName.toUpperCase())) {
          req.addHeader(headerName, Utf8UrlCoder.decode(parts[1]));
        }
      }
    }

    // Set the default content type  for post requests when a content type is not specified
View Full Code Here

      }
    }

    // Set the default content type  for post requests when a content type is not specified
    if ("POST".equals(req.getMethod()) && req.getHeader("Content-Type")==null) {
      req.addHeader("Content-Type", "application/x-www-form-urlencoded");
    }

    req.setIgnoreCache("1".equals(request.getParameter(NOCACHE_PARAM)));

    if (request.getParameter(GADGET_PARAM) != null) {
View Full Code Here

    List<Map.Entry<String, String>> entryList = OAuthRequest.selectOAuthParams(message);

    switch (paramLocationEnum) {
      case AUTH_HEADER:
        request.addHeader("Authorization", OAuthRequest.getAuthorizationHeader(entryList));
        break;

      case POST_BODY:
        if (!OAuth.isFormEncoded(contentType)) {
          throw new RuntimeException(
View Full Code Here

      paramLocation = OAuthParamLocation.AUTH_HEADER;
    }

    switch (paramLocation) {
      case AUTH_HEADER:
        result.addHeader("Authorization", getAuthorizationHeader(oauthParams));
        break;

      case POST_BODY:
        String contentType = result.getHeader("Content-Type");
        if (!OAuth.isFormEncoded(contentType)) {
View Full Code Here

      // Copy over allowed headers
      for (Map.Entry<String, List<String>> header : httpApiRequest.headers.entrySet()) {
        if (!BAD_HEADERS.contains(header.getKey().trim().toUpperCase())) {
          for (String value : header.getValue()) {
            req.addHeader(header.getKey(), value);
          }
        }
      }

      // Extract the gadget URI from the request or the security token
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.