Examples of BasicHeader


Examples of org.apache.http.message.BasicHeader

  }

  @Test
  public void capturingTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/capturing/1911");
View Full Code Here

Examples of org.apache.http.message.BasicHeader

  }

  @Test
  public void erroneousCapturingTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Close"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    HttpClient httpclient = new DefaultHttpClient(params);
    HttpGet httpget = new HttpGet("http://localhost:" + PORT + "/capturing/r1911");
View Full Code Here

Examples of org.apache.http.message.BasicHeader

  }

  @Test
  public void keepAliveRequestTest() throws ClientProtocolException, IOException {
    List<Header> headers = new LinkedList<Header>();
    headers.add(new BasicHeader("Connection", "Keep-Alive"));
    HttpParams params = new BasicHttpParams();
    params.setParameter("http.default-headers", headers);

    DefaultHttpClient httpclient = new DefaultHttpClient(params);
View Full Code Here

Examples of org.apache.http.message.BasicHeader

  private static Header[] getResponseHeaders(HTTPResponse httpResponse, String headerName) {
    List<HTTPHeader> allHeaders = httpResponse.getHeaders();
    List<Header> matchingHeaders = new ArrayList<Header>();
    for (HTTPHeader header : allHeaders) {
      if (header.getName().equalsIgnoreCase(headerName)) {
        matchingHeaders.add(new BasicHeader(header.getName(), header.getValue()));
      }
    }
    return matchingHeaders.toArray(new Header[matchingHeaders.size()]);
  }
View Full Code Here

Examples of org.apache.http.message.BasicHeader

            ByteArrayEntity entity = new ByteArrayEntity(baos.toByteArray())
            {
               @Override
               public Header getContentType()
               {
                  return new BasicHeader("Content-Type", request.getBodyContentType().toString());
               }
            };
            HttpPost post = (HttpPost) httpMethod;
            commitHeaders(request, httpMethod);
            post.setEntity(entity);
View Full Code Here

Examples of org.apache.http.message.BasicHeader

  public GzipCompressingEntity(final HttpEntity entity) {
    super(entity);
  }

  public Header getContentEncoding() {
    return new BasicHeader(HTTP.CONTENT_ENCODING, GZIP_CODEC);
  }
View Full Code Here

Examples of org.apache.http.message.BasicHeader

   
    /**
     * Tests whether domain attribute check is case-insensitive.
     */
    public void testDomainCaseInsensitivity() throws Exception {
        Header header = new BasicHeader("Set-Cookie",
            "name=value; path=/; domain=.whatever.com");

        CookieSpec cookiespec = new BrowserCompatSpec();
        CookieOrigin origin = new CookieOrigin("www.WhatEver.com", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
View Full Code Here

Examples of org.apache.http.message.BasicHeader

     */
    public void testParse1() throws Exception {
        String headerValue = "custno = 12345; comment=test; version=1," +
            " name=John; version=1; max-age=600; secure; domain=.apache.org";

        Header header = new BasicHeader("set-cookie", headerValue);

        CookieSpec cookiespec = new BrowserCompatSpec();
        CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        for (int i = 0; i < cookies.size(); i++) {
View Full Code Here

Examples of org.apache.http.message.BasicHeader

     */
    public void testParse2() throws Exception {
        String headerValue = "custno=12345;comment=test; version=1," +
            "name=John;version=1;max-age=600;secure;domain=.apache.org";

        Header header = new BasicHeader("set-cookie", headerValue);

        CookieSpec cookiespec = new BrowserCompatSpec();
        CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        for (int i = 0; i < cookies.size(); i++) {
View Full Code Here

Examples of org.apache.http.message.BasicHeader

     * Test parse with quoted text
     */
    public void testParse3() throws Exception {
        String headerValue =
            "name=\"Doe, John\";version=1;max-age=600;secure;domain=.apache.org";
        Header header = new BasicHeader("set-cookie", headerValue);

        CookieSpec cookiespec = new BrowserCompatSpec();
        CookieOrigin origin = new CookieOrigin("www.apache.org", 80, "/", false);
        List<Cookie> cookies = cookiespec.parse(header, origin);
        for (int i = 0; i < cookies.size(); i++) {
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.