Package org.apache.wink.client

Examples of org.apache.wink.client.Resource.contentType()


         * sets a last modified date
         */
        dateResource = client.resource(getBaseURI() + "/context/request/date");
        DateFormat dateFormat =
            new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); // DateFormat.getDateTimeInstance();
        response = dateResource.contentType("text/string").put(dateFormat.format(d));
        assertEquals(204, response.getStatusCode());

        formatter.setTimeZone(TimeZone.getTimeZone("GMT"));
        response = dateResource.header(HttpHeaders.IF_MODIFIED_SINCE, formatter.format(d)).get();
        /*
 
View Full Code Here


        for (Map.Entry<String, Object> p : cookieParams.entrySet()) {
            Cookie cookie = new Cookie(p.getKey(), String.valueOf(p.getValue()));
            resource.cookie(cookie);
        }

        resource.contentType(getContentType());
        resource.accept(getAccepts());       
       
        //handles declarative headers configured on the composite
        for(HTTPHeader header : binding.getHttpHeaders()) {
            //treat special headers that need to be calculated
View Full Code Here

        if (params != null) {
            resource = resource.queryParams(params);
        }

        // Default content and accept types to XML if not configured
        resource = (type != null) ? resource.contentType(type) : resource.contentType(MediaType.APPLICATION_XML_TYPE);
        resource = (accept != null) ? resource.accept(type) : resource.accept(MediaType.APPLICATION_XML_TYPE);

        if (authCookie != null) {
            resource = resource.cookie(authCookie);
        }
View Full Code Here

        if (params != null) {
            resource = resource.queryParams(params);
        }

        // Default content and accept types to XML if not configured
        resource = (type != null) ? resource.contentType(type) : resource.contentType(MediaType.APPLICATION_XML_TYPE);
        resource = (accept != null) ? resource.accept(type) : resource.accept(MediaType.APPLICATION_XML_TYPE);

        if (authCookie != null) {
            resource = resource.cookie(authCookie);
        }
View Full Code Here

    public void testResourcePut() throws IOException {
        server.setMockResponseCode(200);
        RestClient client = getRestClient();
        Resource resource = client.resource(serviceURL + "/testResourcePut");
        String response =
            resource.contentType("text/plain").accept("text/plain").put(String.class, SENT_MESSAGE);
        assertEquals(RECEIVED_MESSAGE, response);
        assertEquals(SENT_MESSAGE, server.getRequestContentAsString());

        // do put with response
        ClientResponse clientResponse = resource.put(SENT_MESSAGE);
View Full Code Here

    public void testResourcePost() throws IOException {
        server.setMockResponseCode(200);
        RestClient client = getRestClient();
        Resource resource = client.resource(serviceURL + "/testResourcePost");
        String response =
            resource.contentType("text/plain").accept("text/plain")
                .post(String.class, SENT_MESSAGE);
        assertEquals(RECEIVED_MESSAGE, response);
        assertEquals(SENT_MESSAGE, server.getRequestContentAsString());

        // do post with response
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.