Examples of ClientResponse


Examples of com.sun.jersey.api.client.ClientResponse

  protected ClientResponse sendPutRequest(String url) {
    LOGGER.debug("calling: {}", url);
    try {
      WebResource webResource = httpClient.resource(url);
      ClientResponse response = webResource.put(ClientResponse.class);

      LOGGER.debug("Got response: {}", response);
      return response;
    } catch (Exception e) {
      if(e instanceof SocketTimeoutException) {
View Full Code Here

Examples of com.sun.jersey.api.client.ClientResponse

          .header("Content-Type", "application/xml")
          .post(Document.class, xml);
      logXmlDocumentToDebug("Got response", response);
      return response;
    } catch (UniformInterfaceException e) {
      ClientResponse resp = e.getResponse();
      Document errorXml = resp.getEntity(Document.class);
      String errormessage = e.getMessage();
      try {
        errormessage = (String) xPath.evaluate(
            "/api-response/errors/error", errorXml,
            XPathConstants.STRING);
View Full Code Here

Examples of com.sun.jersey.api.client.ClientResponse

    public ClientResponse handle(ClientRequest request) throws ClientHandlerException {
        long id = ++this._id;

        logRequest(id, request);

        ClientResponse response = getNext().handle(request);

        logResponse(id, response);

        return response;
    }
View Full Code Here

Examples of com.sun.jersey.api.client.ClientResponse

      headers.add("Content-Type", request.entity().getContentType());
    } else {
      headers.add("Content-Type", "application/json");
    }
    try {
      ClientResponse response = null;
      if (request.entity() != null && request.entity().getEntity() != null) {
        response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), request.entity().getEntity(), headers));
      } else {
        response = target.getHeadHandler().handle(new ClientRequestImpl(target.getURI(), request.method().name(), null, headers));
      }
View Full Code Here

Examples of io.undertow.client.ClientResponse

                        pushBackStreamSourceConduit.pushBack(pooled);
                    }

                } while (!state.isComplete());

                final ClientResponse response = builder.build();

                String connectionString = response.getResponseHeaders().getFirst(CONNECTION);

                //check if an upgrade worked
                if (anyAreSet(HttpClientConnection.this.state, UPGRADE_REQUESTED)) {
                    if ((connectionString == null || !UPGRADE.equalToString(connectionString)) && !response.getResponseHeaders().contains(UPGRADE)) {
                        //just unset the upgrade requested flag
                        HttpClientConnection.this.state &= ~UPGRADE_REQUESTED;
                    }
                }
View Full Code Here

Examples of org.apache.abdera.protocol.client.ClientResponse

    // Verify the signature with Verisign's "Signed Ping" interop endpoint
    Client client = new CommonsClient();
    RequestOptions reqoptions = client.getDefaultRequestOptions();
    reqoptions.setContentType("application/xml");
    BaseRequestEntity bre = new BaseRequestEntity(entry,false);
    ClientResponse response = client.post(
      "http://verisignlabs.com/tg/verify",
      bre, reqoptions);
    assertEquals(response.getStatus(),200);
    Document<Element> result = response.getDocument();
   
    XPath xpath = abdera.getXPath();
    assertTrue(
      xpath.booleanValueOf(
        "/Result/SignatureVerifies[text()='true']",
View Full Code Here

Examples of org.apache.abdera.protocol.client.ClientResponse

        URLEncoder.encode(Version.APP_NAME, "utf-8"));
      StringRequestEntity stringreq = new StringRequestEntity(f.toString());
      String uri = "https://www.google.com/accounts/ClientLogin";
      RequestOptions options = client.getDefaultRequestOptions();
      options.setContentType("application/x-www-form-urlencoded");
      ClientResponse response = client.post(uri, stringreq, options);
      InputStream in = response.getInputStream();
      ByteArrayOutputStream out = new ByteArrayOutputStream();
      int n = -1;
      while ((n = in.read()) != -1) { out.write(n); }
      out.flush();
      response.release();
      String auth = new String(out.toByteArray());
      return auth.split("\n")[2].replaceAll("Auth=", "auth=");
    } catch (Exception e) {}
    return null;
  }
View Full Code Here

Examples of org.apache.marmotta.ldclient.model.ClientResponse

            if(log.isInfoEnabled()) {
                log.info("retrieved {} triples for resource {}; expiry date: {}", new Object[]{handler.triples.size(), resourceUri, expiresDate});
            }

            ClientResponse result = new ClientResponse(200, handler.triples);
            result.setExpires(expiresDate);
            return result;
        } catch (RepositoryException e) {
            log.error("error while initialising Sesame repository; classpath problem?",e);
            throw new DataRetrievalException("error while initialising Sesame repository; classpath problem?",e);
        } catch (ClientProtocolException e) {
View Full Code Here

Examples of org.apache.wink.client.ClientResponse

        throws IOException {
        /*
         * with Wink client, content type is set to applcation/octet-stream if
         * no content type specified
         */
        ClientResponse response =
            client.resource(getBaseURI() + "/targeting/nullresource/withoutconsumes")
                .post("calledWithString");
        assertEquals(200, response.getStatusCode());
        assertEquals("userReadercalledWithString", response.getEntity(String.class));
        String contentType =
            (response.getHeaders().getFirst("Content-Type") == null) ? null : response.getHeaders()
                .getFirst("Content-Type");
        assertNotNull(contentType, contentType);
    }
View Full Code Here

Examples of org.glassfish.jersey.client.ClientResponse

    }


    private ClientResponse createClientResponse(final ClientRequest clientRequest,
                                                final InMemoryResponseWriter responseWriter) {
        final ClientResponse clientResponse = new ClientResponse(responseWriter.getStatusInfo(), clientRequest);
        clientResponse.getHeaders().putAll(responseWriter.getHeaders());
        clientResponse.setEntityStream(new ByteArrayInputStream(responseWriter.getEntity()));
        return clientResponse;
    }
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.