Package javax.ws.rs

Examples of javax.ws.rs.InternalServerErrorException


            String path = ui.getPath(false);
            if ("wrongpath".equals(path)) {
                context.setRequestUri(URI.create("/bookstore/bookheaders/simple"));
            } else if ("throwException".equals(path)) {
                context.setProperty("filterexception", "prematch");
                throw new InternalServerErrorException(
                    Response.status(500).type("text/plain")
                        .entity("Prematch filter error").build());
            }
           
            MediaType mt = context.getMediaType();
View Full Code Here


        private UriInfo ui;
        @Override
        public void filter(ContainerRequestContext context) throws IOException {
            if (ui.getQueryParameters().getFirst("throwException") != null) {
                context.setProperty("filterexception", "postmatch");
                throw new InternalServerErrorException(
                    Response.status(500).type("text/plain")
                        .entity("Postmatch filter error").build());
            }
            String value = context.getHeaders().getFirst("Book");
            if (value != null) {
View Full Code Here

    }
   
    @GET
    @Path("/books/webex2")
    public Books getBookWebEx2() {
        throw new InternalServerErrorException(new RuntimeException("Book web exception"));
    }
View Full Code Here

                source.setSystemId(systemId);
            }
            return unmarshaller.unmarshal(source);
        } catch (TransformerConfigurationException ex) {
            LOG.warning("Transformation exception : " + ex.getMessage());
            throw new InternalServerErrorException(ex);
        }
    }
View Full Code Here

        if (templates == null) {
            if (supportJaxbOnly) {
                return null;
            } else {
                LOG.severe("No template is available");
                throw new InternalServerErrorException();
            }
        }
       
        TemplatesImpl templ =  new TemplatesImpl(templates, uriResolver);
        MessageContext mc = getContext();
View Full Code Here

            XMLInputFactory factory = (XMLInputFactory)mc.get(XMLInputFactory.class.getName());
            if (factory != null) {
                try {
                    reader = factory.createXMLStreamReader(is);
                } catch (XMLStreamException e) {
                    throw new InternalServerErrorException(
                        new RuntimeException("Can not create XMLStreamReader", e));
                }
            }
        }
       
View Full Code Here

        try {
            if (is == null) {
                Reader reader = getStreamHandlerFromCurrentMessage(Reader.class);
                if (reader == null) {
                    LOG.severe("No InputStream, Reader, or XMStreamReader is available");
                    throw new InternalServerErrorException();
                }
                xmlReader = StaxUtils.createXMLStreamReader(reader);
            } else {
                xmlReader = StaxUtils.createXMLStreamReader(is);
            }
View Full Code Here

            handleJAXBException(e, true);
        catch (WebApplicationException e) {
            throw e;
        } catch (Exception e) {
            e.printStackTrace();
            throw new InternalServerErrorException(e);       
        }
    }
View Full Code Here

                XMLOutputFactory factory = (XMLOutputFactory)mc.get(XMLOutputFactory.class.getName());
                if (factory != null) {
                    try {
                        writer = factory.createXMLStreamWriter(os);
                    } catch (XMLStreamException e) {
                        throw new InternalServerErrorException(
                            new RuntimeException("Cant' create XMLStreamWriter", e));
                    }
                }
            }
            if (writer == null && getEnableStreaming()) {
View Full Code Here

        throws Exception {
        if (os == null) {
            Writer writer = getStreamHandlerFromCurrentMessage(Writer.class);
            if (writer == null) {
                LOG.severe("No OutputStream, Writer, or XMStreamWriter is available");
                throw new InternalServerErrorException();
            }
            ms.marshal(obj, writer);
            writer.flush();
        } else {
            ms.marshal(obj, os);
View Full Code Here

TOP

Related Classes of javax.ws.rs.InternalServerErrorException

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.