Package org.wymiwyg.wrhapi.util

Examples of org.wymiwyg.wrhapi.util.MediaRange


  private boolean isHtmlPreffered(EnhancedRequest request)
      throws HandlerException {
    Iterator<AcceptHeaderEntry> iterator = request.getAccept();
    while (iterator.hasNext()) {
      AcceptHeaderEntry element = iterator.next();
      MediaRange range = element.getRange();
      if (range.match(htmlType)) {
        return true;
      }
      if (range.match(xmlType)) {
        return false;
      }
    }
    return true;
  }
View Full Code Here


   * @return
   */
  private BodyConverter getBodyConvertor(MimeType type) {
    Iterator keyIter = BODY_CONVERTER_TABLE.keySet().iterator();
    while (keyIter.hasNext()) {
      MediaRange currentRange = (MediaRange) keyIter.next();
      if (currentRange.match(type)) {
        return (BodyConverter) BODY_CONVERTER_TABLE.get(currentRange);
      }

    }
    return null;
View Full Code Here

      Collection sourceContentTypeList = new ArrayList();
      if (sourceTypeStmtIter.hasNext()) {
        while (sourceTypeStmtIter.hasNext()) {
          Statement currentStmt = sourceTypeStmtIter.nextStatement();
          try {
            sourceContentTypeList.add(new MediaRange(currentStmt
                .getString()));
          } catch (InvalidPatternException e) {
            log.warn("Coudn't parse MediaRange "
                + currentStmt.getString(), e);
          }
View Full Code Here

          headerEntry = new AcceptHeaderEntry(current);
        } catch (InvalidPatternException e) {
          log.warn(e.toString());
          continue;
        }
        MediaRange range = headerEntry.getRange();
        if (range.getAsterixCount() > 0) {
          continue;
        }
        StringBuffer buffer = new StringBuffer(40);
        buffer.append("application/xml; stylesheet=");
        try {
          buffer.append(URLEncoder.encode(range.toString(), "utf-8"));
        } catch (UnsupportedEncodingException e) {
          throw new RuntimeException(e);
        }
        buffer.append("; q=");
        buffer.append(headerEntry.getQ() * 0.9f);
 
View Full Code Here

TOP

Related Classes of org.wymiwyg.wrhapi.util.MediaRange

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.