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

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

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

origin: org.wso2.org.apache.shindig/shindig-gadgets

private void expectPutAndReturnBody(AuthType authType, String putData, String response)
    throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("PUT")
   .setPostBody(putData.getBytes("UTF-8"))
   .setAuthType(authType);
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("PUT");
 expect(request.getParameter(MakeRequestHandler.POST_DATA_PARAM))
   .andReturn(putData);
}
origin: org.apache.shindig/shindig-gadgets

private void expectPatchAndReturnBody(AuthType authType, String response) throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("PATCH").setAuthType(authType);
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("PATCH");
}
origin: org.apache.shindig/shindig-gadgets

private void expectDeleteAndReturnBody(AuthType authType, String response) throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("DELETE").setAuthType(authType);
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("DELETE");
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

private void expectDeleteAndReturnBody(AuthType authType, String response) throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("DELETE").setAuthType(authType);
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("DELETE");
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

private void expectHead(AuthType authType) throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("HEAD").setAuthType(authType);
 expect(pipeline.execute(req)).andReturn(new HttpResponse(""));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("HEAD");
}
origin: org.apache.shindig/shindig-gadgets

private void expectPostAndReturnBody(AuthType authType, String postData, String response)
  throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("POST")
   .setPostBody(postData.getBytes("UTF-8"))
   .setAuthType(authType)
   .addHeader("Content-Type", "application/x-www-form-urlencoded");
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("POST");
 expect(request.getParameter(MakeRequestHandler.POST_DATA_PARAM))
   .andReturn(postData);
}
origin: com.lmco.shindig/shindig-gadgets

private void expectPostAndReturnBody(AuthType authType, String postData, String response)
  throws Exception {
 HttpRequest req = new HttpRequest(REQUEST_URL).setMethod("POST")
   .setPostBody(REQUEST_BODY.getBytes("UTF-8"))
   .setAuthType(authType)
   .addHeader("Content-Type", "application/x-www-form-urlencoded");
 expect(pipeline.execute(req)).andReturn(new HttpResponse(response));
 expect(request.getParameter(MakeRequestHandler.METHOD_PARAM)).andReturn("POST");
 expect(request.getParameter(MakeRequestHandler.POST_DATA_PARAM))
   .andReturn(REQUEST_BODY);
}
origin: org.apache.shindig/shindig-gadgets

@Test public void testDelete() throws Exception {
 HttpRequest request = new HttpRequest(BASE_URL).setMethod("DELETE");
 HttpResponse response = fetcher.fetch(request);
 assertEquals("DELETE", response.getHeader("x-method"));
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void getResponseUsingMethodOverride() {
 HttpRequest request = new HttpRequest(DEFAULT_URI)
   .setMethod("POST")
   .addHeader("X-Method-Override", "GET");
 String key = cache.createKey(request);
 HttpResponse response = new HttpResponse("result");
 cache.map.put(key, response);
 assertEquals(response, cache.getResponse(request));
 extendedStrictNoCacheTtlCache.map.put(key, response);
 assertEquals(response, extendedStrictNoCacheTtlCache.getResponse(request));
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void addResponseUsingPost() {
 HttpRequest request = new HttpRequest(DEFAULT_URI)
   .setMethod("POST");
 HttpResponse response = new HttpResponse("does not matter");
 assertNull(cache.addResponse(request, response));
 assertEquals(0, cache.map.size());
 assertNull(extendedStrictNoCacheTtlCache.addResponse(request, response));
 assertEquals(0, extendedStrictNoCacheTtlCache.map.size());
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void getResponseUsingMethodOverride() {
 HttpRequest request = new HttpRequest(DEFAULT_URI)
   .setMethod("POST")
   .addHeader("X-Method-Override", "GET");
 String key = cache.createKey(request);
 HttpResponse response = new HttpResponse("result");
 cache.map.put(key, response);
 assertEquals(response, cache.getResponse(request));
 extendedStrictNoCacheTtlCache.map.put(key, response);
 assertEquals(response, extendedStrictNoCacheTtlCache.getResponse(request));
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test public void testDelete() throws Exception {
 HttpRequest request = new HttpRequest(BASE_URL).setMethod("DELETE");
 HttpResponse response = fetcher.fetch(request);
 assertEquals("DELETE", response.getHeader("x-method"));
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void addResponseUsingMethodOverride() {
 HttpRequest request = new HttpRequest(DEFAULT_URI)
   .setMethod("POST")
   .addHeader("X-Method-Override", "GET");
 HttpResponse response = new HttpResponse("normal");
 String key = cache.createKey(request);
 assertNotNull(cache.addResponse(request, response));
 assertEquals(response, cache.map.get(key));
 assertNotNull(extendedStrictNoCacheTtlCache.addResponse(request, response));
 assertEquals(response, extendedStrictNoCacheTtlCache.map.get(key));
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void testCopyRequestData() throws Exception {
 HttpRequest origRequest = new HttpRequest(Uri.parse("http://www.example.com"));
 origRequest.setMethod("Post");
 String data = "hello world";
 origRequest.setPostBody(data.getBytes());
 HttpRequest req = new HttpRequest(Uri.parse(
   "http://www.example.org/data.html"));
 UriUtils.copyRequestData(origRequest, req);
 assertEquals(data, req.getPostBodyAsString());
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test
public void testCopyRequestData() throws Exception {
 HttpRequest origRequest = new HttpRequest(Uri.parse("http://www.example.com"));
 origRequest.setMethod("Post");
 String data = "hello world";
 origRequest.setPostBody(data.getBytes());
 HttpRequest req = new HttpRequest(Uri.parse(
   "http://www.example.org/data.html"));
 UriUtils.copyRequestData(origRequest, req);
 assertEquals(data, req.getPostBodyAsString());
}
origin: com.lmco.shindig/shindig-gadgets

@Test
public void testCopyRequestData() throws Exception {
 HttpRequest origRequest = new HttpRequest(Uri.parse("http://www.example.com"));
 origRequest.setMethod("Post");
 
 String data = "hello world";
 origRequest.setPostBody(data.getBytes());
 
 HttpRequest req = new HttpRequest(Uri.parse(
   "http://www.example.org/data.html"));
 UriUtils.copyRequestData(origRequest, req);
 assertEquals(data, req.getPostBodyAsString());
}
origin: org.apache.shindig/shindig-gadgets

@Test
public void testAddOAuth2Params_4() throws Exception {
 final MacTokenHandler fixture = new MacTokenHandler();
 final OAuth2Accessor accessor = MockUtils.getOAuth2Accessor_BadMacToken();
 final HttpRequest request = new HttpRequest(Uri.fromJavaUri(new URI("a")));
 request.setMethod("");
 final OAuth2HandlerError result = fixture.addOAuth2Params(accessor, request);
 Assert.assertNotNull(result);
 Assert.assertEquals(null, result.getCause());
 Assert.assertEquals(OAuth2Error.MAC_TOKEN_PROBLEM, result.getError());
 Assert.assertEquals("unsupported algorithm hmac-sha-256", result.getContextMessage());
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test public void testPost_noBody() throws Exception {
 HttpRequest request = new HttpRequest(BASE_URL).setMethod("POST");
 HttpResponse response = fetcher.fetch(request);
 assertEquals("POST", response.getHeader("x-method"));
 assertEquals("", response.getResponseAsString());
}
origin: org.wso2.org.apache.shindig/shindig-gadgets

@Test public void testPut_noBody() throws Exception {
 HttpRequest request = new HttpRequest(BASE_URL).setMethod("PUT");
 HttpResponse response = fetcher.fetch(request);
 assertEquals("PUT", response.getHeader("x-method"));
 assertEquals("", response.getResponseAsString());
}
origin: org.apache.shindig/shindig-gadgets

@Test public void testPost_noBody() throws Exception {
 HttpRequest request = new HttpRequest(BASE_URL).setMethod("POST");
 HttpResponse response = fetcher.fetch(request);
 assertEquals("POST", response.getHeader("x-method"));
 assertEquals("", response.getResponseAsString());
}
org.apache.shindig.gadgets.httpHttpRequestsetMethod

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

  • Start an intent from android
  • onRequestPermissionsResult (Fragment)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top plugins for Android Studio
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