Package javax.activation

Examples of javax.activation.MimeType.match()


      if (a == null || b == null) return true;
      if (a.match(b)) return true;
      if (a.equals(WILDCARD)) return true;
      if (a.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
        return c.match(b);
      }
      if (b.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
        return c.match(a);
      }
View Full Code Here


        MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
        return c.match(b);
      }
      if (b.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
        return c.match(a);
      }
    } catch (Exception e) {}
    return false;
  }
 
View Full Code Here

      if (a == null || b == null) return true;
      if (a.match(b)) return true;
      if (a.equals(WILDCARD)) return true;
      if (a.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
        return c.match(b);
      }
      if (b.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
        return c.match(a);
      }
View Full Code Here

        MimeType c = new MimeType(b.getPrimaryType(), a.getSubType());
        return c.match(b);
      }
      if (b.getPrimaryType().equals("*")) {
        MimeType c = new MimeType(a.getPrimaryType(), b.getSubType());
        return c.match(a);
      }
    } catch (Exception e) {}
    return false;
  }
 
View Full Code Here

  public String getText (Part part)
  {
    try {
      try {
        MimeType mt = new MimeType (part.getContentType ());
        if (mt.match (MimeEnumType.eTextPlain.toString ())) {
          return (String)(part.getContent ());
        }
        else if (mt.match (MimeEnumType.eTextHtml.toString ())) {
          return (String)(part.getContent ());
        }
View Full Code Here

      try {
        MimeType mt = new MimeType (part.getContentType ());
        if (mt.match (MimeEnumType.eTextPlain.toString ())) {
          return (String)(part.getContent ());
        }
        else if (mt.match (MimeEnumType.eTextHtml.toString ())) {
          return (String)(part.getContent ());
        }
        else if (mt.match (MimeEnumType.eMultipart.toString ())) {
          Multipart mp = (Multipart)(part.getContent ());
          for (int i = 0; i < mp.getCount (); i++) {
View Full Code Here

          return (String)(part.getContent ());
        }
        else if (mt.match (MimeEnumType.eTextHtml.toString ())) {
          return (String)(part.getContent ());
        }
        else if (mt.match (MimeEnumType.eMultipart.toString ())) {
          Multipart mp = (Multipart)(part.getContent ());
          for (int i = 0; i < mp.getCount (); i++) {
            String text = getText (mp.getBodyPart (i));
            if (text != null && text.length () > 0) {
              return text;
View Full Code Here

  public static boolean isMatch(String a, String b) {
    boolean answer = false;
    try {
      MimeType mta = new MimeType(a);
      answer = mta.match(b);
    } catch (Exception e) {}
    return answer;
  }
 
  public static boolean isXml(String a) {
View Full Code Here

      if (status == 304) throw new NotModifiedException();
      MimeType atomtype = new MimeType("application/atom+xml");
      String ctype = _getResponseHeader(method, "Content-Type", null);
      String location = _getResponseHeader(method, "Location", null);
      URI locationuri = (location != null) ? uri.resolve(location) : null;
      if (ctype != null && atomtype.match(ctype)) {
        try {
          return _parse(method, locationuri );
        } catch (Exception e) {
          if (location != null)
            return get(locationuri);
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.