Example usage for org.apache.http.client.methods HttpGet METHOD_NAME

List of usage examples for org.apache.http.client.methods HttpGet METHOD_NAME

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpGet METHOD_NAME.

Prototype

String METHOD_NAME

To view the source code for org.apache.http.client.methods HttpGet METHOD_NAME.

Click Source Link

Usage

From source file:com.github.matthesrieke.jprox.JProxViaParameterServlet.java

private HttpUriRequest prepareRequest(HttpServletRequest req, String target) throws IOException {
    String method = req.getMethod();
    if (method.equals(HttpGet.METHOD_NAME)) {
        return new HttpGet(target);
    } else if (method.equals(HttpPost.METHOD_NAME)) {
        HttpPost post = new HttpPost(target);
        post.setEntity(new ByteArrayEntity(readInputStream(req.getInputStream(), req.getContentLength()),
                ContentType.parse(req.getContentType())));
        return post;
    }/*from www. j  a va  2  s  . com*/
    throw new UnsupportedOperationException("Only GET and POST are supported by this proxy.");
}

From source file:com.clickntap.vimeo.Vimeo.java

public VimeoResponse getMe() throws IOException {
    return apiRequest("/me", HttpGet.METHOD_NAME, null, null);
}

From source file:com.uploader.Vimeo.java

public VimeoResponse getVideoPrivacyDomains(String videoEndpoint) throws IOException {
    return apiRequest(new StringBuffer(videoEndpoint).append("/privacy/domains").toString(),
            HttpGet.METHOD_NAME, null, null);
}

From source file:eu.over9000.cathode.Dispatcher.java

public <ResponseType> Result<ResponseType> performGet(final Class<ResponseType> resultClass, final String path,
        final Parameter... parameters) {
    return performInternal(HttpGet.METHOD_NAME, resultClass, path, null, parameters);
}

From source file:org.camunda.connect.httpclient.impl.AbstractHttpConnector.java

@SuppressWarnings("unchecked")
protected <T extends HttpRequestBase> T createHttpRequestBase(Q request) {
    String url = request.getUrl();
    if (url != null && !url.trim().isEmpty()) {
        String method = request.getMethod();
        if (HttpGet.METHOD_NAME.equals(method)) {
            return (T) new HttpGet(url);
        } else if (HttpPost.METHOD_NAME.equals(method)) {
            return (T) new HttpPost(url);
        } else if (HttpPut.METHOD_NAME.equals(method)) {
            return (T) new HttpPut(url);
        } else if (HttpDelete.METHOD_NAME.equals(method)) {
            return (T) new HttpDelete(url);
        } else if (HttpPatch.METHOD_NAME.equals(method)) {
            return (T) new HttpPatch(url);
        } else if (HttpHead.METHOD_NAME.equals(method)) {
            return (T) new HttpHead(url);
        } else if (HttpOptions.METHOD_NAME.equals(method)) {
            return (T) new HttpOptions(url);
        } else if (HttpTrace.METHOD_NAME.equals(method)) {
            return (T) new HttpTrace(url);
        } else {/*from  w w w . j av a2s.  c o m*/
            throw LOG.unknownHttpMethod(method);
        }
    } else {
        throw LOG.requestUrlRequired();
    }
}

From source file:com.clickntap.vimeo.Vimeo.java

public VimeoResponse getOauthVerify() throws IOException {
    return apiRequest("/oauth/verify", HttpGet.METHOD_NAME, null, null);
}

From source file:org.camunda.connect.httpclient.impl.AbstractHttpRequest.java

public Q get() {
    return method(HttpGet.METHOD_NAME);
}

From source file:com.uploader.Vimeo.java

public VimeoResponse getVideos() throws IOException {
    return apiRequest("/me/videos", HttpGet.METHOD_NAME, null, null);
}

From source file:com.cloud.utils.rest.HttpUriRequestBuilderTest.java

@Test
public void testBuildRequestWithJsonPayload() throws Exception {
    final HttpUriRequest request = HttpUriRequestBuilder.create().method(HttpMethods.GET).path("/path")
            .jsonPayload(Optional.of("{'key1':'value1'}")).build();

    assertThat(request, notNullValue());
    assertThat(request.getURI().getPath(), equalTo("/path"));
    assertThat(request.getURI().getScheme(), nullValue());
    assertThat(request.getURI().getQuery(), nullValue());
    assertThat(request.getURI().getHost(), nullValue());
    assertThat(request.getMethod(), equalTo(HttpGet.METHOD_NAME));
    assertThat(request.containsHeader(HttpConstants.CONTENT_TYPE), equalTo(true));
    assertThat(request.getFirstHeader(HttpConstants.CONTENT_TYPE).getValue(),
            equalTo(HttpConstants.JSON_CONTENT_TYPE));
    assertThat(request, HttpUriRequestPayloadMatcher.hasPayload("{'key1':'value1'}"));
}

From source file:com.uploader.Vimeo.java

public VimeoResponse searchVideos(String query) throws IOException {
    return apiRequest("/me/videos?query=" + query, HttpGet.METHOD_NAME, null, null);
}