Package com.gistlabs.mechanize.util.apache

Examples of com.gistlabs.mechanize.util.apache.ContentType


    Util.copy(getInputStream(), new NullOutputStream());
  }

  protected String getContentEncoding(final HttpResponse response) {
    try {
      ContentType contentType = ContentType.get(response.getEntity());
      return contentType.getCharset().displayName();
    } catch (NullPointerException np) {
      // TODO why don't test cases set this?
      return null;
    }
  }
View Full Code Here


  protected Resource toPage(final HttpRequestBase request, final HttpResponse response)
      throws IOException, UnsupportedEncodingException {



    ContentType contentType = getContentType(response);

    ResourceFactory factory = lookupFactory(contentType.getMimeType());
    if (factory == null)
      factory = lookupFactory(ContentType.WILDCARD.getMimeType());

    if (factory == null)
      throw MechanizeExceptionFactory.newMechanizeException("No viable page type found, and no wildcard mime type factory registered.");
View Full Code Here

TOP

Related Classes of com.gistlabs.mechanize.util.apache.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.