Examples of StringEntity


Examples of org.apache.http.entity.StringEntity

        public void handle(
                final HttpRequest request,
                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            response.setStatusCode(HttpStatus.SC_OK);
            StringEntity entity = new StringEntity("Whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

        public void handle(
                final HttpRequest request,
                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            response.setStatusCode(HttpStatus.SC_OK);
            StringEntity entity = new StringEntity("Whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

        DefaultHttpClient client = new DefaultHttpClient();
        HttpContext context = new BasicHttpContext();
       
        HttpPost httppost = new HttpPost("/oldlocation/");
        httppost.setEntity(new StringEntity("stuff"));

        HttpResponse response = client.execute(getServerHttp(), httppost, context);
        HttpEntity e = response.getEntity();
        if (e != null) {
            e.consumeContent();
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            ProtocolVersion httpversion = request.getRequestLine().getProtocolVersion();
            response.setStatusLine(httpversion, HttpStatus.SC_OK);
            response.addHeader(new BasicHeader("Set-Cookie", "name1=value1; path=/test"));
            StringEntity entity = new StringEntity("whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                final HttpContext context) throws HttpException, IOException {
            ProtocolVersion httpversion = request.getRequestLine().getProtocolVersion();
            response.setStatusLine(httpversion, HttpStatus.SC_OK);
            response.addHeader(new BasicHeader("Set-Cookie", "name1=value1; Path=\"/test\"; Version=1"));
            response.addHeader(new BasicHeader("Set-Cookie2", "name2=value2; Path=\"/test\"; Version=1"));
            StringEntity entity = new StringEntity("whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                final HttpResponse response,
                final HttpContext context) throws HttpException, IOException {
            ProtocolVersion httpversion = request.getRequestLine().getProtocolVersion();
            response.setStatusLine(httpversion, HttpStatus.SC_OK);
            response.addHeader(new BasicHeader("Set-Cookie2", "name2=value2; Path=\"/test\"; Version=2"));
            StringEntity entity = new StringEntity("whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                final HttpContext context) throws HttpException, IOException {
            ProtocolVersion httpversion = request.getRequestLine().getProtocolVersion();
            response.setStatusLine(httpversion, HttpStatus.SC_OK);
            response.addHeader(new BasicHeader("Set-Cookie", "name=wrong; Path=/test"));
            response.addHeader(new BasicHeader("Set-Cookie2", "name=right; Path=\"/test\"; Version=1"));
            StringEntity entity = new StringEntity("whatever");
            response.setEntity(entity);
        }
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                        } else {
                            value = arg.getEncodedValue();
                        }
                        postBody.append(value);
                    }
                    StringEntity requestEntity = new StringEntity(postBody.toString(), post.getFirstHeader(HEADER_CONTENT_TYPE).getValue(), contentEncoding);
                    post.setEntity(requestEntity);
                    postedBody.append(postBody.toString()); // TODO OK?
                } else {
                    // It is a normal post request, with parameter names and values
View Full Code Here

Examples of org.apache.http.entity.StringEntity

            }
            String contentTypeValue = null;
            if(hasContentTypeHeader) {
                contentTypeValue = put.getFirstHeader(HEADER_CONTENT_TYPE).getValue();
            }
            StringEntity requestEntity = new StringEntity(putBodyContent.toString(), contentTypeValue,
                    (String) putParams.getParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET));
            put.setEntity(requestEntity);
        }
        // Check if we have any content to send for body
        if(hasPutBody) {
View Full Code Here

Examples of org.apache.http.entity.StringEntity

                + request.getClass().getName());
        }
    }

    public Request withContent(String content) throws UnsupportedEncodingException {
        return withEntity(new StringEntity(content, "UTF-8"));
    }
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.