Examples of MediaRange


Examples of org.openjena.atlas.web.MediaRange

     * @return MediaType
     */
   
    static public MediaType match(AcceptList proposalList, AcceptList offerList)
    {
        MediaRange choice = null // From offerlist
        //MediaRange choice2 = null ; // From proposal (q value and text/*)
       
        for ( MediaRange offer : offerList.entries() )
        {
            MediaRange m = proposalList.match(offer) ;
            if ( m != null )
            {
                if ( choice != null && choice.get_q() >= m.get_q() )
                    continue ;
                choice = m ; 
            }
        }
        if ( choice == null )
View Full Code Here

Examples of org.openjena.atlas.web.MediaRange

        return new MediaType(choice);
    }
   
    public MediaRange first()
    {
        MediaRange choice = null ;
        for ( MediaRange acceptItem : ranges )
        {
            if ( choice != null && choice.get_q() >= acceptItem.get_q() )
                continue ;
            choice = acceptItem ;
        }
        return choice ;
    }
View Full Code Here

Examples of org.openjena.atlas.web.MediaRange

        String[] x = s.split(",") ;
        for ( int i = 0 ; i < x.length ; i++ )
        {
            if ( x[i].equals(""))
                continue ;
            MediaRange mType = new MediaRange(x[i]) ;
            ranges.add(mType) ;
        }
        return ranges ;
    }
View Full Code Here

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

Examples of org.wymiwyg.wrhapi.util.MediaRange

   * @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

Examples of org.wymiwyg.wrhapi.util.MediaRange

      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

Examples of org.wymiwyg.wrhapi.util.MediaRange

          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
Copyright © 2018 www.massapi.com. 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.