Examples of contentType()


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

        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

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

        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

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

        Resource resource = client.resource(baseURI);
        setRequestHeaders(resource);
        JAXBContext context = JAXBContext.newInstance(NewsStory.class);
        StringWriter sw = new StringWriter();
        context.createMarshaller().marshal(story, sw);
        ClientResponse response = resource.contentType("text/xml").post(sw.toString().getBytes());
        int status = response.getStatusCode();
        Response resp = Response.status(status).build();
        for (String key : response.getHeaders().keySet()) {
            List<String> values = response.getHeaders().get(key);
            List<Object> objValues = new ArrayList<Object>();
View Full Code Here

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

        JAXBContext context = JAXBContext.newInstance(NewsStory.class);
        StringWriter sw = new StringWriter();
        context.createMarshaller().marshal(story, sw);

        ClientResponse response = resource.contentType("text/xml").put(sw.toString().getBytes());
        int status = response.getStatusCode();

        Response resp = Response.status(status).build();
        for (String key : response.getHeaders().keySet()) {
            List<String> values = response.getHeaders().get(key);
View Full Code Here

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

    public Response getNewsStory(String title) throws Exception {
        RestClient client = new RestClient();
        Resource resource = client.resource(this.baseURI + "/" + title);
        setRequestHeaders(resource);

        ClientResponse response = resource.contentType("text/xml").get();
        int status = response.getStatusCode();

        InputStream is = response.getEntity(InputStream.class);

        NewsStory newsStory = null;
View Full Code Here

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

        ClientConfig config = new ClientConfig();
        config.handlers(new DummyHandler());
        RestClient client = new RestClient(config);
        Resource resource = client.resource(serviceURL + "/testResourcePost");
        ClientResponse response =
            resource.contentType("text/plain").accept("text/plain")
                .post(SENT_MESSAGE.toLowerCase());

        // Check that request filter converted request entity to upper
        assertEquals(SENT_MESSAGE.toUpperCase(), server.getRequestContentAsString());
View Full Code Here

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

    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

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

    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

Examples of org.atmosphere.annotation.Suspend.contentType()

            Class<? extends AtmosphereResourceEventListener>[] listeners =
                    suspendAnnotation.listeners();
            String topic = null;
            boolean writeEntity = true;
            //TODO used eventually in executeSuspend()
            String contentType = suspendAnnotation.contentType();
           
            doSuspend(entity, req, resp, resource, config, topic, suspendTimeout, scope,
                    writeEntity, listeners, false, suspendAnnotation.resumeOnBroadcast(),
                    useResumeAnnotation);
        }
View Full Code Here

Examples of org.elasticsearch.common.xcontent.XContentBuilder.contentType()

            this.content = BytesArray.EMPTY;
            this.contentType = BytesRestResponse.TEXT_CONTENT_TYPE;
        } else {
            XContentBuilder builder = convert(channel, t);
            this.content = builder.bytes();
            this.contentType = builder.contentType().restContentType();
        }
    }

    private static XContentBuilder convert(RestChannel channel, Throwable t) throws IOException {
        XContentBuilder builder = channel.newBuilder().startObject()
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.