private static Set<MediaType> getCollectionConsumes(ClassMetadata metadata) { Set<MediaType> consumes = new HashSet<MediaType>(); for (MethodMetadata method : metadata.getResourceMethods()) { if (method.getHttpMethod().equals(HttpMethod.POST)) { consumes.addAll(method.getConsumes()); } } for (MethodMetadata method : metadata.getSubResourceMethods()) { if (method.getHttpMethod().equals(HttpMethod.POST)) { consumes.addAll(method.getConsumes()); } } return consumes; }
private void buildCunsumeMimeTypes(MethodMetadata methodMetadata, org.apache.wink.common.internal.model.admin.AcceptMediaTypes xmlAcceptMediaTypes) { Set<MediaType> consumedMime = methodMetadata.getConsumes(); for (MediaType mediaType : consumedMime) { xmlAcceptMediaTypes.getAcceptMediaType().add(mediaType.getType() + SLASH + mediaType.getSubtype()); } } }
selectBestMatchingMediaType(inputMediaType, record1.getMetadata().getConsumes()); selectBestMatchingMediaType(inputMediaType, record2.getMetadata().getConsumes());
/** * Checks if the method record matches the media type of the input entity * * @param record the method record to check * @param context the context of the current request * @return true if the method should be filtered, false otherwise */ private boolean filterByConsumes(MethodRecord record, RuntimeContext context) { Set<MediaType> consumedMimes = record.getMetadata().getConsumes(); // if not specified, then treat as if consumes */* if (consumedMimes.size() == 0) { return false; } MediaType inputMediaType = context.getHttpHeaders().getMediaType(); if (inputMediaType == null) { inputMediaType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } for (MediaType mediaType : consumedMimes) { if (mediaType.isCompatible(inputMediaType)) { return false; } } return true; }
if (consumes.size() > 0 && methodMetadata.getConsumes().equals(consumes)) { List<Injectable> params = methodMetadata.getFormalParameters(); boolean isEntityParamFound = false;
if (!methodMetadata.getConsumes().isEmpty() || !methodMetadata .getProduces().isEmpty()) { if (logger.isWarnEnabled()) {
Set<MediaType> consumesMT = methodMetadata.getConsumes(); Set<Representation> reps = null; if (consumesMT != null && !consumesMT.isEmpty()) {
String httpMethod = methodMetadata.getHttpMethod(); String consumes = constructMediaTypeString(methodMetadata.getConsumes()); String produces = constructMediaTypeString(methodMetadata.getProduces()); String consumes = constructMediaTypeString(method.getConsumes()); String produces = constructMediaTypeString(method.getProduces());