Package org.apache.http

Examples of org.apache.http.HeaderIterator


                ClientContext.COOKIE_ORIGIN);
        if (cookieOrigin == null) {
            this.log.info("CookieOrigin not available in HTTP context");
            return;
        }
        HeaderIterator it = response.headerIterator(SM.SET_COOKIE);
        processCookies(it, cookieSpec, cookieOrigin, cookieStore);
       
        // see if the cookie spec supports cookie versioning.
        if (cookieSpec.getVersion() > 0) {
            // process set-cookie2 headers.
View Full Code Here


    public Set<String> getAllowedMethods(final HttpResponse response) {
        if (response == null) {
            throw new IllegalArgumentException("HTTP response may not be null");
        }
       
        HeaderIterator it = response.headerIterator("Allow");
        Set<String> methods = new HashSet<String>();
        while (it.hasNext()) {
            Header header = it.nextHeader();
            HeaderElement[] elements = header.getElements();
            for (HeaderElement element : elements) {
                methods.add(element.getName());
            }
        }
View Full Code Here

          HttpContext localContext = new BasicHttpContext();
          HttpResponse response = client.execute(meth, localContext);
          callback.onSuccess(response.toString());

          // headers response
          HeaderIterator it = response.headerIterator();
          while (it.hasNext()) {
            Header header = it.nextHeader();
            responseHeaders
                .put(header.getName(), header.getValue());
          }

        } catch (Exception ex) {
View Full Code Here

            //Executing
            HttpResponse httpResponse = client.execute(httpMethod);

            //parsing responseHeaders
          
            HeaderIterator it = httpResponse.headerIterator();
            while (it.hasNext()){
              Header header = it.nextHeader();
              responseHeaders.put(header.getName(), header.getValue());
            }
           
            //Parsing response
            this.response = FileUtils.readInputStream(httpResponse.getEntity().getContent());
View Full Code Here

    public void testSingleHeader() {
        Header[] headers = new Header[]{
            new BasicHeader("Name", "token0,token1, token2 , token3")
        };
        HeaderIterator hit = new BasicHeaderIterator(headers, null);
        TokenIterator  ti  = new BasicTokenIterator(hit);

        assertTrue(ti.hasNext());
        assertEquals("token0", "token0", ti.nextToken());
        assertTrue(ti.hasNext());
View Full Code Here

            new BasicHeader("Name", " "),
            new BasicHeader("Name", "token3 "),
            new BasicHeader("Name", ","),
            new BasicHeader("Name", "token4"),
        };
        HeaderIterator hit = new BasicHeaderIterator(headers, null);
        TokenIterator  ti  = new BasicTokenIterator(hit);

        assertTrue(ti.hasNext());
        assertEquals("token0", "token0", ti.nextToken());
        assertTrue(ti.hasNext());
View Full Code Here

            new BasicHeader("Name", " "),
            new BasicHeader("Name", ""),
            new BasicHeader("Name", ","),
            new BasicHeader("Name", " ,, "),
        };
        HeaderIterator hit = new BasicHeaderIterator(headers, null);
        TokenIterator  ti  = new BasicTokenIterator(hit);

        assertFalse(ti.hasNext());

View Full Code Here

            new BasicHeader("Name", ",token2"),
            new BasicHeader("Name", " ,token3"),
            new BasicHeader("Name", ", token4"),
            new BasicHeader("Name", " , token5"),
        };
        HeaderIterator hit = new BasicHeaderIterator(headers, null);
        TokenIterator  ti  = new BasicTokenIterator(hit);

        assertTrue(ti.hasNext());
        assertEquals("token0", "token0", ti.nextToken());
        assertTrue(ti.hasNext());
View Full Code Here

            new BasicHeader("Name", "token2,"),
            new BasicHeader("Name", "token3 ,"),
            new BasicHeader("Name", "token4, "),
            new BasicHeader("Name", "token5 , "),
        };
        HeaderIterator hit = new BasicHeaderIterator(headers, null);
        TokenIterator  ti  = new BasicTokenIterator(hit);

        assertTrue(ti.hasNext());
        assertEquals("token0", "token0", ti.nextToken());
        assertTrue(ti.hasNext());
View Full Code Here

    public void testTokenChar() {
        Header[] headers = new Header[]{
            new BasicHeader("Name", "token0")
        };
        HeaderIterator     hit = new BasicHeaderIterator(headers, null);
        BasicTokenIterator bti = new BasicTokenIterator(hit);

        assertTrue ("letter"   , bti.isTokenChar('j'));
        assertFalse("control"  , bti.isTokenChar('\b'));
        assertFalse("separator", bti.isTokenChar('?'));
View Full Code Here

TOP

Related Classes of org.apache.http.HeaderIterator

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.