Examples of MimeType


Examples of javax.activation.MimeType

   */
  public static boolean isXml(String a) {
    boolean answer = isMatch(Constants.XML_MEDIA_TYPE, a) || isMatch("text/xml", a);
    if (!answer) {
      try {
        MimeType mta = new MimeType(a);
        answer =
          (("application".equalsIgnoreCase(mta.getPrimaryType()) ||
            "text".equalsIgnoreCase(mta.getPrimaryType())) &&
            mta.getSubType().equals("xml") ||
            mta.getSubType().endsWith("+xml"));
      } catch (Exception e) {}
    }
    return answer;
  }
View Full Code Here

Examples of javax.activation.MimeType

   * Returns true if this is a valid media type
   */
  public static boolean isMimeType(String a) {
    boolean answer = false;
    try {
      new MimeType(a);
      answer = true;
    } catch (MimeTypeParseException e) {
      answer = false;
    }
    return answer;
View Full Code Here

Examples of juzu.MimeType

    protected Response response() {
      try {
        Object ret = context.getHandler().getMethod().invoke(controller, args);

        //
        MimeType mimeType = null;
        for (Annotation annotation : context.getHandler().getMethod().getDeclaredAnnotations()) {
          if (annotation instanceof MimeType) {
            mimeType = (MimeType)annotation;
          } else {
            mimeType = annotation.annotationType().getAnnotation(MimeType.class);
          }
          if (mimeType != null && mimeType.value().length > 0) {
            // For now we stop but we should look at the accept types of the client
            // for doing some basic content negociation
            break;
          }
        }

        //
        if (ret instanceof Response) {
          // We should check that it matches....
          // btw we should try to enforce matching during compilation phase
          // @Action -> Response.Action
          // @View -> Response.Mime
          // as we can do it
          Response resp = (Response)ret;
          if (mimeType != null) {
            resp = resp.with(PropertyType.MIME_TYPE, mimeType.value()[0]);
          }
          return resp;
        } else if (ret != null && mimeType != null) {
          for (EntityMarshaller writer : Tools.loadService(EntityMarshaller.class, request.controllerPlugin.getApplication().getClassLoader())) {
            for (String s : mimeType.value()) {
              Streamable streamable = writer.marshall(s, context.getHandler().getMethod(), ret);
              if (streamable != null) {
                return Response.ok().with(PropertyType.MIME_TYPE, s).body(streamable);
              }
            }
View Full Code Here

Examples of net.sf.toxicity.MimeType

    private Document process(ProceedingJoinPoint pjp) throws Throwable {
       
        Pipeline p = (Pipeline)pjp.getTarget();
        Document d = (Document)pjp.getArgs()[0];
       
        MimeType mt = p.getClass().getAnnotation(MimeType.class);
        if(mt != null) {
            String mimeType = mt.value();
            log.debug("Specified document mime type: " + mimeType);
            mLastMimeType.set(mt.value());
        } else {
            log.debug("No mime type specified");
        }
       
        return (Document)pjp.proceed();
View Full Code Here

Examples of org.apache.any23.mime.MIMEType

        highest.addAll(highestSpecificType.values());
        Collections.sort(highest);
        StringBuffer result = new StringBuffer();
        Iterator<MIMEType> it = mimeTypes.iterator();
        while (it.hasNext()) {
            MIMEType a = it.next();
            if (!highest.contains(a)) continue;
            if (result.length() > 0) {
                result.append(", ");
            }
            result.append(a);
View Full Code Here

Examples of org.apache.fulcrum.mimetype.util.MimeType

    public void testGetDefaultExtension() throws Exception
    {
        String result =
            mimeTypeService.getDefaultExtension(MimeTypeMapperTest.MIME_TYPE);
        assertEquals("crazy", result);
        MimeType mt = new MimeType(MimeTypeMapperTest.MIME_TYPE);
        result = mimeTypeService.getDefaultExtension(mt);
        assertEquals("crazy", result);
    }
View Full Code Here

Examples of org.apache.harmony.x.print.MimeType

    public DocFlavor(String mimeType, String className) {
        if ((mimeType == null) || (className == null)) {
            throw new NullPointerException();
        }
        aType = new MimeType(mimeType);
        aClass = className;
    }
View Full Code Here

Examples of org.apache.jetspeed.capabilities.MimeType

        Vector temp = new Vector();
        // Add Mimetypes to map and create query
        while (mimetypes.hasNext())
        {
            MimeType mt = (MimeType) mimetypes.next();

            // Add mimetype to query
            // Note: mimetypes is a member of MediaTypeImpl
            // criteria.addEqualTo("mimetypes.name", mt.getName());
            //stuff.add(new Integer(mt.getMimetypeId()));
            temp.add(mt.getName());
        }
       
        Collection co = null;
        if (temp.size() > 0)
        {
View Full Code Here

Examples of org.apache.jetspeed.util.MimeType

        Iterator i = mimetypesVector.iterator();

        while(i.hasNext())
        {
            String mime = (String)i.next();
            types.add(new MimeType(mime));
        }

        this.mimes = types;
    }
View Full Code Here

Examples of org.apache.nutch.util.mime.MimeType

                  mimetype = value.toLowerCase().
                  replaceAll(WHITESPACE,"-");
                  if (mimetype == null) {
                    mimetype = "no-type";
                  }
                  new MimeType(value.toLowerCase());
                } catch (MimeTypeException e) {
                  mimetype = "no-type";
                }
                if (skip(mimetype)) { //XXX
                }
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.