Package com.google.opengse.httputil

Examples of com.google.opengse.httputil.ContentType


    }

    // We need to modify the Content-Type header as a result.
    String contentTypeString = getContentType();
    if (contentTypeString != null) {
      ContentType ctype = ContentType.parse(contentTypeString);
      if (specified_charset == null) {
        ctype.removeParameter("charset");
      } else {
        ctype.setParameter("charset", specified_charset);
      }
      setHeader("Content-Type", ctype.toString());
    }
  }
View Full Code Here


   * {@link #getWriter()}.
   * NOTE: this method overrides a previous call to
   * {@link #setCharacterEncoding(String)}.
   */
  public void setContentType(String type) {
    ContentType ctype = ContentType.parse(type);
    String charset = ctype.getParameter("charset", null);
    if (charset != null) {
      // Reset the charset to whatever is filtered by the Accept-Charset hdr
      setCharacterEncoding(charset);
      ctype.setParameter("charset", getCharacterEncoding());
    }
    setHeader("Content-Type", ctype.toString());
  }
View Full Code Here

    if (userAgent == null || type == null) {
      return false;
    }

    // extract the actual type from the content type header
    ContentType ctype = ContentType.parse(type);
    type = ctype.getType("text/html");

    // check if client accepts the encoding
    if (!req._acceptsEncoding(coding)) {
      return false;
    }
View Full Code Here

      String contentTypeString = getHeader("Content-Type");
      if (contentTypeString != null) {
        //NOTE: only set charset parameter for "text/..." content types
        //Otherwise some applications which expect an "application/..."
        //content type will become confused.
        ContentType ctype = ContentType.parse(contentTypeString);
        if (ctype.getParameter("charset", null) == null
            && specified_charset != null) {
          setHeader("Content-Type",
              contentTypeString + "; charset=" + specified_charset);
        }
      }
View Full Code Here

TOP

Related Classes of com.google.opengse.httputil.ContentType

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.