@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
&& !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType);
&& !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType);
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
&& !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType);
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),
@Override public ContainerResponse apply(final ContainerResponse response) { // Need to check whether the response is null or mapped from exception. In these cases we don't want to modify // response with resource method metadata. if (response == null || response.isMappedFromException()) { return response; } final Annotation[] entityAnn = response.getEntityAnnotations(); if (methodAnnotations.length > 0) { if (entityAnn.length == 0) { response.setEntityAnnotations(methodAnnotations); } else { final Annotation[] mergedAnn = Arrays.copyOf(methodAnnotations, methodAnnotations.length + entityAnn.length); System.arraycopy(entityAnn, 0, mergedAnn, methodAnnotations.length, entityAnn.length); response.setEntityAnnotations(mergedAnn); } } if (canUseInvocableResponseType && response.hasEntity() && !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType); } return response; } });
@Override public ContainerResponse apply(final ContainerResponse response) { // Need to check whether the response is null or mapped from exception. In these cases we don't want to modify // response with resource method metadata. if (response == null || response.isMappedFromException()) { return response; } final Annotation[] entityAnn = response.getEntityAnnotations(); if (methodAnnotations.length > 0) { if (entityAnn.length == 0) { response.setEntityAnnotations(methodAnnotations); } else { final Annotation[] mergedAnn = Arrays.copyOf(methodAnnotations, methodAnnotations.length + entityAnn.length); System.arraycopy(entityAnn, 0, mergedAnn, methodAnnotations.length, entityAnn.length); response.setEntityAnnotations(mergedAnn); } } if (canUseInvocableResponseType && response.hasEntity() && !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType); } return response; } });
@Override public ContainerResponse apply(final ContainerResponse response) { // Need to check whether the response is null or mapped from exception. In these cases we don't want to modify // response with resource method metadata. if (response == null || response.isMappedFromException()) { return response; } final Annotation[] entityAnn = response.getEntityAnnotations(); if (methodAnnotations.length > 0) { if (entityAnn.length == 0) { response.setEntityAnnotations(methodAnnotations); } else { final Annotation[] mergedAnn = Arrays.copyOf(methodAnnotations, methodAnnotations.length + entityAnn.length); System.arraycopy(entityAnn, 0, mergedAnn, methodAnnotations.length, entityAnn.length); response.setEntityAnnotations(mergedAnn); } } if (canUseInvocableResponseType && response.hasEntity() && !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType); } return response; } });
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
&& !(response.getEntityType() instanceof ParameterizedType)) { response.setEntityType(invocableResponseType);
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
@Override public ContainerResponse apply(final ContainerResponse responseContext) { // we only need to compute and set the effective media type if: // - it hasn't been set already, and // - either there is an entity, or we are responding to a HEAD request if (responseContext.getMediaType() == null && ((responseContext.hasEntity() || HttpMethod.HEAD.equals(request.getMethod())))) { MediaType effectiveResponseType = determineResponseMediaType( responseContext.getEntityClass(), responseContext.getEntityType(), methodSelector.selected, acceptableMediaTypes); if (MediaTypes.isWildcard(effectiveResponseType)) { if (effectiveResponseType.isWildcardType() || "application".equalsIgnoreCase(effectiveResponseType.getType())) { effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE; } else { throw new NotAcceptableException(); } } responseContext.setMediaType(effectiveResponseType); } return responseContext; } });
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),
entity, entity.getClass(), response.getEntityType(), response.getEntityAnnotations(), response.getMediaType(),