Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.HeaderElement


   
    public String getCharset() {
        String charset = DEFAULT_CONTENT_CHARSET;
        Header contenttype = this.headers.getFirstHeader("Content-Type");
        if (contenttype != null) {
            HeaderElement values[] = contenttype.getElements();
            if (values.length == 1) {
                NameValuePair param = values[0].getParameterByName("charset");
                if (param != null) {
                    charset = param.getValue();
                }
View Full Code Here


            s = "responseContentLength "+info.getContentLength();
            AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
           
            h = info.getResponseHeader("Content-Type");
            if (h != null) {
              HeaderElement elements[] = h.getElements();
              // Expect only one header element to be there, no more, no less
              if (elements.length == 1) {
                String sContentType = elements[0].getName();
                String sCharset = null;
                NameValuePair nvp = elements[0].getParameterByName("charset");
                if (nvp != null) {
                  sCharset = nvp.getValue();
                }
                oThis.setContentType(sContentType);
                oThis.setCharset(sCharset);
                s = "contentType="+sContentType+" charset="+sCharset;
                AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
              }
            }
           
            h = info.getResponseHeader("Content-Disposition");
            if (h != null) {
              HeaderElement elements[] = h.getElements();
              for (HeaderElement element: elements) {
                NameValuePair[] params = element.getParameters();
                for (NameValuePair param: params) {
                  s = "Content-Disposition param "+param.getName()+"="+param.getValue();
                  AgpDPart.LOGGER.finest("onBeforeReadResponse "+s);
View Full Code Here

   
    public String getCharset() {
        String charset = DEFAULT_CONTENT_CHARSET;
        Header contenttype = this.headers.getFirstHeader("Content-Type");
        if (contenttype != null) {
            HeaderElement values[] = contenttype.getElements();
            if (values.length == 1) {
                NameValuePair param = values[0].getParameterByName("charset");
                if (param != null) {
                    charset = param.getValue();
                }
View Full Code Here

        // Process old style headers first
        Header[] cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE);
        for (int i = 0; i < cookieHeaders.length; i++) {
            HeaderElement[] elements = cookieHeaders[i].getElements();
            for (int e = 0; e < elements.length; e++) {
                HeaderElement element = elements[e];
                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
                    sessionCookie = element.getValue();
                }
            }
        }
        // Overwrite old style cookies with new style ones if present
        cookieHeaders = method.getResponseHeaders(HTTPConstants.HEADER_SET_COOKIE2);
        for (int i = 0; i < cookieHeaders.length; i++) {
            HeaderElement[] elements = cookieHeaders[i].getElements();
            for (int e = 0; e < elements.length; e++) {
                HeaderElement element = elements[e];
                if (Constants.SESSION_COOKIE.equalsIgnoreCase(element.getName()) ||
                        Constants.SESSION_COOKIE_JSESSIONID.equalsIgnoreCase(element.getName())) {
                    sessionCookie = element.getValue();
                }
            }
        }

        if (sessionCookie != null) {
View Full Code Here

   
    public String getCharset() {
        String charset = null;
        Header contenttype = this.headers.getFirstHeader("Content-Type");
        if (contenttype != null) {
            HeaderElement values[] = contenttype.getElements();
            if (values.length == 1) {
                NameValuePair param = values[0].getParameterByName("charset");
                if (param != null) {
                    charset = param.getValue();
                }
View Full Code Here

   
    public String getCharset() {
        String charset = DEFAULT_CONTENT_CHARSET;
        Header contenttype = this.headers.getFirstHeader("Content-Type");
        if (contenttype != null) {
            HeaderElement values[] = contenttype.getElements();
            if (values.length == 1) {
                NameValuePair param = values[0].getParameterByName("charset");
                if (param != null) {
                    charset = param.getValue();
                }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.HeaderElement

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.