Examples of HttpUriRequest


Examples of org.apache.http.client.methods.HttpUriRequest

   */
  public void addUser(String streamId, long userId) throws IOException, ControlStreamException {
    Endpoint endpoint = SitestreamEndpoint.addUserEndpoint(streamId);
    endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId));

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    consumeHttpEntityContent(makeControlStreamRequest(request));
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  public void removeUser(String streamId, long userId) throws IOException, ControlStreamException {
    Endpoint endpoint = SitestreamEndpoint.removeUserEndpoint(streamId);
    endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId));

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    consumeHttpEntityContent(makeControlStreamRequest(request));
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  public void addUsers(String streamId, Collection<Long> userIds) throws IOException, ControlStreamException {
    Preconditions.checkArgument(userIds.size() >= 1 && userIds.size() <= 100, "The userId parameter can be supplied with up to 100 user IDs.");
    Endpoint endpoint = SitestreamEndpoint.addUserEndpoint(streamId);
    endpoint.addPostParameter(Constants.USER_ID_PARAM, Joiner.on(',').join(userIds));

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    consumeHttpEntityContent(makeControlStreamRequest(request));
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  public void removeUsers(String streamId, Collection<Long> userIds) throws IOException, ControlStreamException {
    Preconditions.checkArgument(userIds.size() >= 1 && userIds.size() <= 100, "The userId parameter can be supplied with up to 100 user IDs.");
    Endpoint endpoint = SitestreamEndpoint.removeUserEndpoint(streamId);
    endpoint.addPostParameter(Constants.USER_ID_PARAM, Joiner.on(',').join(userIds));

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    consumeHttpEntityContent(makeControlStreamRequest(request));
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  public String getFriends(String streamId, long userId, int cursor) throws IOException, ControlStreamException {
    Endpoint endpoint = SitestreamEndpoint.friendsEndpoint(streamId);
    endpoint.addPostParameter(Constants.USER_ID_PARAM, Long.toString(userId));
    endpoint.addPostParameter(Constants.CURSOR_PARAM, Integer.toString(cursor));

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    HttpResponse response = makeControlStreamRequest(request);
    return consumeHttpEntityContent(response);
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  }

  public String getInfo(String streamId) throws IOException, ControlStreamException {
    Endpoint endpoint = SitestreamEndpoint.streamInfoEndpoint(streamId);

    HttpUriRequest request = HttpConstants.constructRequest(hosts.nextHost(), endpoint, auth);
    HttpResponse response = makeControlStreamRequest(request);
    return consumeHttpEntityContent(response);
  }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

            mockProcessor, mockReconnectionManager, mockRateTracker
    );
    when(mockConnection.connect(any(HttpUriRequest.class)))
            .thenThrow(new IOException());

    HttpUriRequest mockRequest = mock(HttpUriRequest.class);
    assertNull(clientBase.establishConnection(mockConnection, mockRequest));

    InOrder inOrder = inOrder(mockConnection, mockReconnectionManager);

    inOrder.verify(mockConnection).connect(any(HttpUriRequest.class));
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

        double rate = rateTracker.getCurrentRateSeconds();
        if (!Double.isNaN(rate)) {
          endpoint.setBackfillCount(reconnectionManager.estimateBackfill(rate));
        }

        HttpUriRequest request = HttpConstants.constructRequest(host, endpoint, auth);
        if (request != null) {
          String postContent = null;
          if (endpoint.getHttpMethod().equalsIgnoreCase(HttpConstants.HTTP_POST)) {
            postContent = endpoint.getPostParamString();
          }
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

  }

  private UrlResponse doMethod(String requestMethod, String path, String body, boolean secureConnection,
      String acceptType) throws Exception {

    HttpUriRequest httpRequest = getHttpRequest(requestMethod, path, body, secureConnection, acceptType);
    HttpResponse httpResponse = httpClient.execute(httpRequest);

    UrlResponse urlResponse = new UrlResponse();
    urlResponse.status = httpResponse.getStatusLine().getStatusCode();
    HttpEntity entity = httpResponse.getEntity();
View Full Code Here

Examples of org.apache.http.client.methods.HttpUriRequest

    }

    private String extractRedirectedUrl(String url, HttpContext localContext) {
        // This was triggered by HttpClient with the redirect count was exceeded.
        HttpHost host = (HttpHost)localContext.getAttribute(ExecutionContext.HTTP_TARGET_HOST);
        HttpUriRequest finalRequest = (HttpUriRequest)localContext.getAttribute(ExecutionContext.HTTP_REQUEST);

        try {
            URL hostUrl = new URI(host.toURI()).toURL();
            return new URL(hostUrl, finalRequest.getURI().toString()).toExternalForm();
        } catch (MalformedURLException e) {
            LOGGER.warn("Invalid host/uri specified in final fetch: " + host + finalRequest.getURI());
            return url;
        } catch (URISyntaxException e) {
            LOGGER.warn("Invalid host/uri specified in final fetch: " + host + finalRequest.getURI());
            return url;
        }
    }
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.