Package org.w3c.www.mime

Examples of org.w3c.www.mime.MimeType


    protected void parse()
  throws HttpParserException
    {
  String str = new String(raw, 0, 0, raw.length) ;
  try {
      type = new MimeType(str);
  } catch (Exception ex) {
      error("Invalid content type.");
  }
    }
View Full Code Here


    }

    public ReplyInterface perform(RequestInterface request)
  throws ProtocolException, ResourceException
    {
  MimeType mimes[] = getMimeTypeArray();
  System.out.println(mimes);
  for (int i = 0 ; i < mimes.length ; i++)
      System.out.println("=> "+mimes[i]);
  return super.perform(request);
    }
View Full Code Here

  if ( vparams.size() > 0 ) {
      String pparams[] = new String[vparams.size()];
      String pvalues[] = new String[pparams.length];
      vparams.copyInto(pparams);
      vvalues.copyInto(pvalues);
      this.type = new MimeType(type, subtype, pparams, pvalues);
  } else {
      this.type = new MimeType(type, subtype);
  }
  // Parse remaining accept parameters:
  if ( accept ) {
      vparams.setSize(0);
      vvalues.setSize(0);
View Full Code Here

      props.addProperty(DAVNode.GETCONTENTLANGUAGE_NODE, lang);
  }
    }

    protected void addContentType(DAVProperties props) {
  MimeType mime = getContentType();
  if (mime != null) {
      props.addProperty(DAVNode.GETCONTENTTYPE_NODE, mime.toString());
  }
    }
View Full Code Here

      // FIXME
  } else if (name.equals(DAVNode.RESOURCETYPE_NODE)) {
      // FIXME
  } else if (name.equals(DAVNode.GETCONTENTTYPE_NODE)) {
      try {
    MimeType mime = new MimeType(value);
    setValue(ATTR_CONTENT_TYPE, mime);
    okdp.addProperty(name);
      } catch (MimeTypeFormatException ex) {
    DAVPropStat dps = DAVFactory.createPropStat(
              getStatusLine(HTTP.CONFLICT),
View Full Code Here

      return rep;

  Request request = (Request) req;
  if(request.getMethod().equals("PUT")) {
      try {
    MimeType req_mt = request.getContentType();
    if (req_mt.match(MimeType.TEXT) == MimeType.NO_MATCH)
        return null;
      } catch (NullPointerException ex) {
    // no Content-Type sent! check anyway
      }
      InputStream in = null;
View Full Code Here

      ByteArrayInputStream in     = new ByteArrayInputStream(data);
      request.setOutputStream(in);
      if ( ! request.hasHeader(Request.H_CONTENT_LENGTH) )
    request.setContentLength(data.length);
      if ( ! request.hasHeader(Request.H_CONTENT_TYPE) ) {
    MimeType t = (request.getMethod().equals("POST")
            ? MimeType.APPLICATION_X_WWW_FORM_URLENCODED
            : MimeType.TEXT_PLAIN);
    request.setContentType(t);
      }
  }
View Full Code Here

  return reply.getContentLength();
    }

    public String getContentType() {
  checkReply();
  MimeType t = reply.getContentType();
  if (t == null) {
      return null;
  }
  return t.toString();
    }
View Full Code Here

    public ReplyInterface ingoingFilter(RequestInterface req) {
  Request request = (Request) req;

  if(request.getMethod().equals("PUT")) {
      try {
    MimeType req_mt = request.getContentType();
    if (xhtml_mt == null){
        xhtml_mt = new MimeType("application","xhtml+xml");
    }
    if (req_mt.match(xhtml_mt) != MimeType.NO_MATCH) {
        isXhtml = true ;
    } else {
        isXhtml = false ;
    }
    if (req_mt.match(MimeType.TEXT_HTML) == MimeType.NO_MATCH
        && isXhtml == false){
        return null;
    }
    if (req_mt.hasParameter("charset")){
        String charset = req_mt.getParameterValue("charset");
        if (charset.equalsIgnoreCase("iso-2022-jp")){
      tidyCharEncoding = Configuration.ISO2022 ;
        }
        if (charset.equalsIgnoreCase("us-ascii")){
      tidyCharEncoding = Configuration.ASCII ;
View Full Code Here

  String mimeType=Utils.guessContentTypeFromName(_url);

  try {
      if(mimeType==null || mimeType.equals("content/unknown")) {
    setContentType(new MimeType(DEFAULT_MIME_TYPE));
      }
      else {
    setContentType(new MimeType(mimeType));
      }
  }
  catch(org.w3c.www.mime.MimeTypeFormatException e) {
      e.printStackTrace();
      // SHOULD NEVER HAPPEN
View Full Code Here

TOP

Related Classes of org.w3c.www.mime.MimeType

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.