Package com.sun.jersey.api.client

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


    headers.add(HmacUtils.X_HMAC_DATE, "Sat, 01 Jan 2000 12:34:57 GMT");
    headers.add(HmacUtils.X_HMAC_NONCE, "Thohn2Mohd2zugo");

    URI uri = new URI(baseUri + resourcePath + queryParameters);

    ClientRequest clientRequest = new ClientRequestImpl(uri, "get", null, headers);

    String representation = HmacUtils.createCanonicalRepresentation(clientRequest, providers);

    FixtureAsserts.assertStringMatchesStringFixture("GET canonical representation", representation, "/fixtures/hmac/expected-canonical-get.txt");
View Full Code Here


    URI uri = new URI(baseUri + resourcePath + queryParameters);

    String entity = "{\"_links\":{\"self\":{\"href\":\"http://example.org/user\"}}}";

    ClientRequest clientRequest = new ClientRequestImpl(uri, "post", entity, headers);

    String representation = HmacUtils.createCanonicalRepresentation(clientRequest, providers);

    FixtureAsserts.assertStringMatchesStringFixture("POST canonical representation", representation, "/fixtures/hmac/expected-canonical-post.txt");
View Full Code Here

  public HmacClientFilter(Providers providers) {
    this.providers = providers;
  }

  public ClientResponse handle(ClientRequest cr) {
    ClientRequest mcr = modifyRequest(cr);

    // Call the next client handler in the filter chain
    ClientResponse resp = getNext().handle(mcr);

    // Modify the response
View Full Code Here

     */
    private ResponseEntity retrieveResponseFromRequest( final String title, final String description,
            final String method, final String uri, final int responseCode, final MediaType accept,
            final List<String> headerFields )
    {
        ClientRequest request;
        try
        {
            request = REQUEST_BUILDER.accept( accept )
                    .build( new URI( uri ), method );
        }
View Full Code Here

     */
    private ResponseEntity retrieveResponseFromRequest( final String title, final String description,
            final String method, final String uri, final String payload, final MediaType payloadType,
            final int responseCode, final MediaType accept, final List<String> headerFields )
    {
        ClientRequest request;
        try
        {
            if ( payload != null )
            {
                request = REQUEST_BUILDER.type( payloadType )
View Full Code Here

        this.cookieManager = cookieManager;
    }


    public WebResponse getResponse(WebRequest webRequest) throws IOException {
        ClientRequest jerseyClientRequest = adaptHtmlunitRequest(webRequest);
        ClientResponse jerseyClientResponse = processJerseyClientRequest(jerseyClientRequest);
        WebResponseData htmlunitResponseData = adaptJerseyClientResponse(jerseyClientResponse);
        return new WebResponse(htmlunitResponseData, webRequest, 0);
    }
View Full Code Here

    }

    @Test
    public void getGraph() {
        for (GraphTestHolder tg : this.testGraphs) {
            ClientRequest request = ClientRequest.create().build(createUri("/" + tg.getGraphName()), "GET");
            ClientResponse response = this.client.handle(request);

            Assert.assertNotNull(response);
            Assert.assertEquals(ClientResponse.Status.OK, response.getClientResponseStatus());
View Full Code Here

    }

    protected ClientResponse doGet(String path, String query) {
        String uri = makeUriString(path, query);

        ClientRequest graphRequest = ClientRequest.create().build(createUri("/" + uri), "GET");
        return this.client.handle(graphRequest);
    }
View Full Code Here

    }

    protected ClientResponse doPost(String path, String query) {
        String uri = makeUriString(path, query);

        ClientRequest graphRequest = ClientRequest.create().build(createUri("/" + uri), "POST");
        return this.client.handle(graphRequest);
    }
View Full Code Here

    }

    protected ClientResponse doPut(String path, String query) {
        String uri = makeUriString(path, query);

        ClientRequest graphRequest = ClientRequest.create().build(createUri("/" + uri), "PUT");
        return this.client.handle(graphRequest);
    }
View Full Code Here

TOP

Related Classes of com.sun.jersey.api.client.ClientRequest

Copyright © 2018 www.massapicom. 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.