Package javax.ws.rs

Examples of javax.ws.rs.Consumes


        public ConsumesMediaTypeMap(Class<?> rawType) {
            super(rawType);
        }

        public void putProvider(PriorityObjectFactory<T> objectFactory) {
            Consumes consumes = objectFactory.getInstanceClass().getAnnotation(Consumes.class);
            if (consumes == null) {
                put(MediaType.WILDCARD_TYPE, objectFactory);
            } else {
                String[] values = AnnotationUtils.parseConsumesProducesValues(consumes.value());
                for (String val : values) {
                    put(MediaType.valueOf(val), objectFactory);
                }
            }
        }
View Full Code Here


        return msg;
    }

    private String getContentType() {
        String contentType = MediaType.APPLICATION_OCTET_STREAM;
        Consumes consumes = ((JavaOperation)operation).getJavaMethod().getAnnotation(Consumes.class);
        if (consumes != null && consumes.value().length > 0) {
            contentType = consumes.value()[0];
        }
        WireFormat wf = binding.getRequestWireFormat();
        if (wf != null) {
            if (XMLWireFormat.REST_WIREFORMAT_XML_QNAME.equals(wf.getSchemaName())) {
                contentType = MediaType.APPLICATION_XML;
View Full Code Here

     * @see javax.ws.rs.ext.MessageBodyWriter
     * @see javax.ws.rs.ext.ContextResolver
     */
    AbstractProviderWrapper(Class<?> jaxRsProviderClass)
            throws IllegalArgumentException, WebApplicationException {
        final Consumes pm = jaxRsProviderClass.getAnnotation(Consumes.class);
        if (pm != null) {
            this.consumedMimes = WrapperUtil.convertToMediaTypes(pm.value());
        } else {
            this.consumedMimes = Collections.singletonList(MediaType.ALL);
        }

        final Produces cm = jaxRsProviderClass.getAnnotation(Produces.class);
View Full Code Here

      }

      @Override
      public String[] getMediaTypeAnnotationValues(
          MessageBodyReader<?> producer) {
        Consumes consumes = producer.getClass().getAnnotation(
            Consumes.class);
        if (consumes == null) {
          return null;
        } else {
          return consumes.value();
        }
      }
    });
  }
View Full Code Here

      for (int i = 0; i < parameterTypes.length; i++) {
        if (!InjectionUtilities.isAnnotated(parameterAnnotations[i])) {
          if (mediaType == null) {
            continue METHODS;
          }
          Consumes consumes = method.getAnnotation(Consumes.class);
          SortedSet<MediaType> sortedConsumedType = new TreeSet<MediaType>(
              new MediaTypeComparator());
          if (consumes == null) {
            sortedConsumedType.add(MediaType.WILDCARD_TYPE);
          } else {
            for (String consumesString : consumes.value()) {
              sortedConsumedType.add(MediaType
                  .valueOf(consumesString));
            }
          }
          for (MediaType consumedType : sortedConsumedType) {
View Full Code Here

   
    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader provider) {
        String[] values = getUserMediaTypes(provider, "getConsumeMediaTypes");
       
        if (values == null) {
            Consumes c = provider.getClass().getAnnotation(Consumes.class);
            values = c == null ? new String[]{"*/*"} : c.value();
        }
        return JAXRSUtils.getMediaTypes(values);
    }
View Full Code Here

   
    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader provider) {
        String[] values = getUserMediaTypes(provider, "getConsumeMediaTypes");
       
        if (values == null) {
            Consumes c = provider.getClass().getAnnotation(Consumes.class);
            values = c == null ? new String[]{"*/*"} : c.value();
        }
        return JAXRSUtils.getMediaTypes(values);
    }
View Full Code Here

   
    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader provider) {
        String[] values = getUserMediaTypes(provider, "getConsumeMediaTypes");
       
        if (values == null) {
            Consumes c = provider.getClass().getAnnotation(Consumes.class);
            values = c == null ? new String[]{"*/*"} : c.value();
        }
        return JAXRSUtils.getMediaTypes(values);
    }
View Full Code Here

    private void checkMediaTypes(String consumeMediaTypes,
                                 String produceMediaTypes) {
        if (consumeMediaTypes != null) {
            consumeMimes = JAXRSUtils.sortMediaTypes(consumeMediaTypes);
        } else {
            Consumes cm =
                (Consumes)AnnotationUtils.getMethodAnnotation(annotatedMethod, Consumes.class);
            if (cm != null) {
                consumeMimes = JAXRSUtils.sortMediaTypes(JAXRSUtils.getMediaTypes(cm.value()));
            } else if (classResourceInfo != null) {
                consumeMimes = JAXRSUtils.sortMediaTypes(classResourceInfo.getConsumeMime());
            }
        }
        if (produceMediaTypes != null) {
View Full Code Here

   
    public static List<MediaType> getProviderConsumeTypes(MessageBodyReader provider) {
        String[] values = getUserMediaTypes(provider, "getConsumeMediaTypes");
       
        if (values == null) {
            Consumes c = provider.getClass().getAnnotation(Consumes.class);
            values = c == null ? new String[]{"*/*"} : c.value();
        }
        return JAXRSUtils.getMediaTypes(values);
    }
View Full Code Here

TOP

Related Classes of javax.ws.rs.Consumes

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.