Tabnine Logo
HttpRequest.setHeader
Code IndexAdd Tabnine to your IDE (free)

How to use
setHeader
method
in
org.apache.shindig.gadgets.http.HttpRequest

Best Java code snippets using org.apache.shindig.gadgets.http.HttpRequest.setHeader (Showing top 20 results out of 315)

origin: org.gatein.shindig/shindig-gadgets

public static void setXForwardedForHeader(HttpServletRequest inboundRequest, HttpRequest req)
  throws GadgetException {
 String forwardedFor = getXForwardedForHeader(inboundRequest.getHeader("X-Forwarded-For"),
   inboundRequest.getRemoteAddr());
 if (forwardedFor != null) {
  req.setHeader("X-Forwarded-For", forwardedFor);
 }
}

origin: com.lmco.shindig/shindig-gadgets

public static void setXForwardedForHeader(HttpServletRequest inboundRequest, HttpRequest req)
  throws GadgetException {
 String forwardedFor = getXForwardedForHeader(inboundRequest.getHeader("X-Forwarded-For"),
   inboundRequest.getRemoteAddr());
 if (forwardedFor != null) {
  req.setHeader("X-Forwarded-For", forwardedFor);
 }
}

origin: org.apache.shindig/shindig-gadgets

public static void setXForwardedForHeader(HttpServletRequest inboundRequest, HttpRequest req) {
 String forwardedFor = getXForwardedForHeader(inboundRequest.getHeader("X-Forwarded-For"),
   inboundRequest.getRemoteAddr());
 if (forwardedFor != null) {
  req.setHeader("X-Forwarded-For", forwardedFor);
 }
}
origin: com.lmco.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: org.wso2.org.apache.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: org.apache.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: org.wso2.org.apache.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: com.lmco.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: org.apache.shindig/shindig-gadgets

 public HttpResponse fetch(HttpRequest request) throws GadgetException {
  request.setPostBody(ArrayUtils.EMPTY_BYTE_ARRAY);
  request.setHeader("Content-Type", "application/x-www-form-urlencoded");
  return serviceProvider.fetch(request);
 }
});
origin: com.lmco.shindig/shindig-gadgets

private HttpRequest createRequestTokenRequest(OAuthAccessor accessor)
  throws OAuthRequestException {
 if (accessor.consumer.serviceProvider.requestTokenURL == null) {
  throw new OAuthRequestException(OAuthError.BAD_OAUTH_TOKEN_URL, "request token");
 }
 HttpRequest request = new HttpRequest(
   Uri.parse(accessor.consumer.serviceProvider.requestTokenURL));
 request.setMethod(accessorInfo.getHttpMethod().toString());
 if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
  request.setHeader("Content-Type", OAuth.FORM_ENCODED);
 }
 return request;
}
origin: org.gatein.shindig/shindig-gadgets

private HttpRequest createRequestTokenRequest(OAuthAccessor accessor)
  throws OAuthRequestException {
 if (accessor.consumer.serviceProvider.requestTokenURL == null) {
  throw new OAuthRequestException(OAuthError.BAD_OAUTH_TOKEN_URL, "request token");
 }
 HttpRequest request = new HttpRequest(
   Uri.parse(accessor.consumer.serviceProvider.requestTokenURL));
 request.setMethod(accessorInfo.getHttpMethod().toString());
 if (accessorInfo.getHttpMethod() == HttpMethod.POST) {
  request.setHeader("Content-Type", OAuth.FORM_ENCODED);
 }
 return request;
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void renderProxied() throws Exception {
 HttpRequest request = new HttpRequest(EXPECTED_PROXIED_HTML_HREF);
 request.setHeader("User-Agent", USER_AGENT_SET);
 HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);
 pipeline.plainResponses.put(EXPECTED_PROXIED_HTML_HREF, response);
 String content = proxyRenderer.render(makeHrefGadget("none"));
 assertEquals(PROXIED_HTML_CONTENT, content);
 assertEquals(response, cache.getResponse(request));
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void renderProxied() throws Exception {
 HttpRequest request = new HttpRequest(EXPECTED_PROXIED_HTML_HREF);
 request.setHeader("User-Agent", USER_AGENT_SET);
 HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);
 pipeline.plainResponses.put(EXPECTED_PROXIED_HTML_HREF, response);
 String content = proxyRenderer.render(makeHrefGadget("none"));
 assertEquals(PROXIED_HTML_CONTENT, content);
 assertEquals(response, cache.getResponse(request));
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void testStripSecretsFromRequestHeader() {
 HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo"));
 req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" +
   "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" +
   "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" +
   "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" +
   "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" +
   "3D\"");
 String filtered = OAuthResponseParams.filterSecrets(req.toString());
 checkStringContains(filtered, "oauth_session_handle=REMOVED");
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void testStripSecretsFromRequestHeader() {
 HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo"));
 req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" +
   "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" +
   "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" +
   "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" +
   "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" +
   "3D\"");
 String filtered = OAuthResponseParams.filterSecrets(req.toString());
 checkStringContains(filtered, "oauth_session_handle=REMOVED");
}
origin: com.lmco.shindig/shindig-gadgets

@Test
public void testStripSecretsFromRequestHeader() {
 HttpRequest req = new HttpRequest(Uri.parse("http://www.example.com/foo"));
 req.setHeader("Authorization", "OAuth opensocial_owner_id=\"owner\", opensocial_viewer_id=" +
   "\"owner\", opensocial_app_id=\"app\", opensocial_app_url=\"http%3A%2F%2Fwww.examp" +
   "le.com%2Fheader.xml\", oauth_version=\"1.0\", oauth_timestamp=\"1231461306\", oau" +
   "th_consumer_key=\"consumer\", oauth_signature_method=\"HMAC-SHA1\", oauth_nonce" +
   "=\"1231461308333563000\", oauth_session_handle=\"w0zAI1yN5ZRvmBX5kcVdra5%2BbZE%" +
   "3D\"");
 String filtered = OAuthResponseParams.filterSecrets(req.toString());
 checkStringContains(filtered, "oauth_session_handle=REMOVED");
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void renderProxiedFromCache() throws Exception {
 HttpRequest request = new HttpRequest(EXPECTED_PROXIED_HTML_HREF);
 request.setHeader("User-Agent", USER_AGENT_SET);
 HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);
 cache.addResponse(request, response);
 String content = proxyRenderer.render(makeHrefGadget("none"));
 assertEquals(PROXIED_HTML_CONTENT, content);
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void renderProxiedFromCache() throws Exception {
 HttpRequest request = new HttpRequest(EXPECTED_PROXIED_HTML_HREF);
 request.setHeader("User-Agent", USER_AGENT_SET);
 HttpResponse response = new HttpResponse(PROXIED_HTML_CONTENT);
 cache.addResponse(request, response);
 String content = proxyRenderer.render(makeHrefGadget("none"));
 assertEquals(PROXIED_HTML_CONTENT, content);
}
origin: com.lmco.shindig/shindig-gadgets

public HttpResponse sendGetWithBody(String target, String type, byte[] body) {
 HttpRequest request = new HttpRequest(Uri.parse(target));
 request.setOAuthArguments(recallState());
 OAuthRequest dest = createRequest();
 if (type != null) {
  request.setHeader("Content-Type", type);
 }
 request.setPostBody(body);
 request.setSecurityToken(securityToken);
 HttpResponse response = dest.fetch(request);
 saveState(response);
 return response;
}
origin: org.apache.shindig/shindig-gadgets

public HttpResponse sendGetWithBody(String target, String type, byte[] body) {
 HttpRequest request = new HttpRequest(Uri.parse(target));
 request.setOAuthArguments(recallState());
 OAuthRequest dest = createRequest();
 if (type != null) {
  request.setHeader("Content-Type", type);
 }
 request.setPostBody(body);
 request.setSecurityToken(securityToken);
 HttpResponse response = dest.fetch(request);
 saveState(response);
 return response;
}
org.apache.shindig.gadgets.httpHttpRequestsetHeader

Javadoc

Sets a single header value, overwriting any previously set headers with the same name.

Popular methods of HttpRequest

  • <init>
    Clone an existing HttpRequest.
  • addHeader
    Add a single header to the request. If a value for the given name is already set, a second value is
  • getAuthType
  • getCacheTtl
  • getContainer
  • getFollowRedirects
  • getGadget
  • getHeader
  • getHeaders
  • getIgnoreCache
  • getMethod
  • getOAuthArguments
  • getMethod,
  • getOAuthArguments,
  • getParam,
  • getParamAsInteger,
  • getPostBody,
  • getPostBodyAsString,
  • getPostBodyLength,
  • getRewriteMimeType,
  • getSecurityToken,
  • getUri

Popular in Java

  • Updating database using SQL prepared statement
  • compareTo (BigDecimal)
  • getSystemService (Context)
  • runOnUiThread (Activity)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • JLabel (javax.swing)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now