/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
private static ContainerRequest ensureValidRequest(final ContainerRequest request) throws IllegalStateException { if (request.getMethod().equals("GET")) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_METHOD_ERROR()); } if (!MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_CONTENT_TYPE_ERROR()); } return request; }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
private static ContainerRequest ensureValidRequest(final ContainerRequest request) throws IllegalStateException { if (request.getMethod().equals("GET")) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_METHOD_ERROR()); } if (!MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_CONTENT_TYPE_ERROR()); } return request; }
if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, containerRequest.getMediaType()) && !containerRequest.hasEntity()) { final Form form = new Form();
if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, containerRequest.getMediaType()) && !containerRequest.hasEntity()) { final Form form = new Form();
final MediaType requestContentType = request.getMediaType(); final MediaType effectiveContentType = requestContentType == null ? MediaType.WILDCARD_TYPE : requestContentType;
final MediaType requestContentType = request.getMediaType(); final MediaType effectiveContentType = requestContentType == null ? MediaType.WILDCARD_TYPE : requestContentType;
private Form getFormParameters(ContainerRequest request) { if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { request.bufferEntity(); Form form; if (decode) { form = request.readEntity(Form.class); } else { Annotation[] annotations = new Annotation[1]; annotations[0] = encodedAnnotation; form = request.readEntity(Form.class, annotations); } return (form == null ? new Form() : form); } else { return new Form(); } } }
private Form getFormParameters(ContainerRequest request) { if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { request.bufferEntity(); Form form; if (decode) { form = request.readEntity(Form.class); } else { Annotation[] annotations = new Annotation[1]; annotations[0] = encodedAnnotation; form = request.readEntity(Form.class, annotations); } return (form == null ? new Form() : form); } else { return new Form(); } } }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
private static ContainerRequest ensureValidRequest(final ContainerRequest request) throws IllegalStateException { if (request.getMethod().equals("GET")) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_METHOD_ERROR()); } if (!MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_CONTENT_TYPE_ERROR()); } return request; }
final MediaType requestContentType = request.getMediaType(); final MediaType effectiveContentType = requestContentType == null ? MediaType.WILDCARD_TYPE : requestContentType;
private Form getFormParameters(ContainerRequest request) { if (MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { request.bufferEntity(); Form form; if (decode) { form = request.readEntity(Form.class); } else { Annotation[] annotations = new Annotation[1]; annotations[0] = encodedAnnotation; form = request.readEntity(Form.class, annotations); } return (form == null ? new Form() : form); } else { return new Form(); } } }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
/** * Determines whether this {@code ConsumesProducesAcceptor} router can process the {@code request}. * * @param requestContext The request to be tested. * @return True if the {@code request} can be processed by this router, false otherwise. */ boolean isConsumable(ContainerRequest requestContext) { MediaType contentType = requestContext.getMediaType(); return contentType == null || consumes.getMediaType().isCompatible(contentType); }
private static ContainerRequest ensureValidRequest(final ContainerRequest request) throws IllegalStateException { if (request.getMethod().equals("GET")) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_METHOD_ERROR()); } if (!MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_CONTENT_TYPE_ERROR()); } return request; }
private static ContainerRequest ensureValidRequest(final ContainerRequest request) throws IllegalStateException { if (request.getMethod().equals("GET")) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_METHOD_ERROR()); } if (!MediaTypes.typeEqual(MediaType.APPLICATION_FORM_URLENCODED_TYPE, request.getMediaType())) { throw new IllegalStateException( LocalizationMessages.FORM_PARAM_CONTENT_TYPE_ERROR()); } return request; }
@Inject ContainerRequest request; if (request.getMethod().toUpperCase().equals("POST") && request.getMediaType().equals(MediaType.APPLICATION_FORM_URLENCODED_TYPE)) { request.bufferEntity(); Form form = request.readEntity(Form.class); MultivaluedMap<String, String> params = form.asMap(); }