Package javax.ws.rs

Examples of javax.ws.rs.NotAcceptableException


        }
        List<MediaType> acceptContentTypes = null;
        try {
            acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes);
        } catch (IllegalArgumentException ex) {
            throw new NotAcceptableException();
        }
        message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);

        MultivaluedMap<String, String> values = new MetadataMap<String, String>();
        ClassResourceInfo resource = JAXRSUtils.selectResourceClass(resources,
View Full Code Here


        }
        List<MediaType> acceptContentTypes = null;
        try {
            acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes, JAXRSUtils.MEDIA_TYPE_Q_PARAM);
        } catch (IllegalArgumentException ex) {
            throw new NotAcceptableException();
        }
        message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);

        //1. Matching target resource class
        Service service = message.getExchange().get(Service.class);
View Full Code Here

            org.w3c.dom.Document domDoc = convertToDOM(doc);

            MessageBodyWriter<org.w3c.dom.Document> writer =
                providers.getMessageBodyWriter(DOM_DOC_CLS, DOM_DOC_CLS, anns, mt);
            if (writer == null) {
                throw new NotAcceptableException();
            }
            writer.writeTo(domDoc, DOM_DOC_CLS, DOM_DOC_CLS, anns, mt, headers, os);
        }
    }
View Full Code Here

                    break;
                case METHOD_NOT_ALLOWED:
                    webAppException = new NotAllowedException(response);
                    break;
                case NOT_ACCEPTABLE:
                    webAppException = new NotAcceptableException(response);
                    break;
                case UNSUPPORTED_MEDIA_TYPE:
                    webAppException = new NotSupportedException(response);
                    break;
                case INTERNAL_SERVER_ERROR:
View Full Code Here

                        if (isWildcard(effectiveResponseType)) {
                            if (effectiveResponseType.isWildcardType()
                                    || "application".equalsIgnoreCase(effectiveResponseType.getType())) {
                                effectiveResponseType = MediaType.APPLICATION_OCTET_STREAM_TYPE;
                            } else {
                                throw new NotAcceptableException();
                            }
                        }
                        responseContext.setMediaType(effectiveResponseType);
                    }

                    return responseContext;
                }
            });
            return selected.methodAcceptorPair.router;
        }

        throw new NotAcceptableException();
    }
View Full Code Here

            return new SubResource();
        }

        @Path("subresource-wae")
        public SubResource getSubResourceEx() {
            throw new NotAcceptableException(Response.notAcceptable(null).entity("Not Acceptable SRL").build());
        }
View Full Code Here

        }

        @Path("sub-get-wae")
        @GET
        public String getSubEx() {
            throw new NotAcceptableException(Response.notAcceptable(null).entity("Not Acceptable Resource sub-GET").build());
        }
View Full Code Here

        }

        @Path("wae")
        @GET
        public String subResourceGetEx() {
            throw new NotAcceptableException(Response.notAcceptable(null).entity("Not Acceptable SubResource GET").build());
        }
View Full Code Here

        }
        List<MediaType> acceptContentTypes = null;
        try {
            acceptContentTypes = JAXRSUtils.sortMediaTypes(acceptTypes, JAXRSUtils.MEDIA_TYPE_Q_PARAM);
        } catch (IllegalArgumentException ex) {
            throw new NotAcceptableException();
        }
        message.getExchange().put(Message.ACCEPT_CONTENT_TYPE, acceptContentTypes);

        //1. Matching target resource class
        Service service = message.getExchange().get(Service.class);
View Full Code Here

      {
         chosen = MediaType.APPLICATION_OCTET_STREAM_TYPE;
      }
      else if (chosen.isWildcardSubtype())
      {
         throw new NotAcceptableException("Illegal response media type: " + chosen.toString());
      }
      jaxrsResponse.getHeaders().putSingle(HttpHeaders.CONTENT_TYPE, chosen);
   }
View Full Code Here

TOP

Related Classes of javax.ws.rs.NotAcceptableException

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.