Package javax.ws.rs

Examples of javax.ws.rs.NotFoundException


    @Path("items/{itemid}/")
    public Item getItem(@PathParam("itemid") String itemid) {
        Item i = getItems().get(itemid);
        if (i == null) {
            throw new NotFoundException(Response
                    .status(Response.Status.NOT_FOUND)
                    .entity("Item, " + itemid + ", is not found")
                    .build());
        }
View Full Code Here


    @Path("resource")
    public static class Resource {
        @GET
        @Path("error")
        public String getError() {
            throw new NotFoundException(Response.status(404).type("text/plain").entity("error").build());
        }
View Full Code Here

        @GET
        @Path("errorlist")
        @Produces(MediaType.APPLICATION_XML)
        public List<JaxbString> getErrorList() {
            throw new NotFoundException(Response.status(404).type("text/plain").entity("error").build());
        }
View Full Code Here

    @Path("items/{itemid}/")
    public Item getItem(@PathParam("itemid") String itemid) {
        Item i = getItems().get(itemid);
        if (i == null) {
            throw new NotFoundException(Response
                    .status(Response.Status.NOT_FOUND)
                    .entity("Item, " + itemid + ", is not found")
                    .build());
        }
View Full Code Here

    public IDPConfig getIDP(@PathParam("realm") String realm) {
        LOG.info("get IDP config for realm: " + realm);

        IDPConfig currentConfig = configService.getIDPConfig(realm);
        if (currentConfig == null) {
            throw new NotFoundException();
        }
        return currentConfig;
    }
View Full Code Here

    @Path("items/{itemid}/")
    public Item getItem(@PathParam("itemid") String itemid) {
        Item i = getItems().get(itemid);
        if (i == null) {
            throw new NotFoundException(Response
                    .status(Response.Status.NOT_FOUND)
                    .entity("Item, " + itemid + ", is not found")
                    .build());
        }
View Full Code Here

    }

    @Path("tracks/{num}/")
    public Track getTrack(@PathParam("num") int num) {
        if (num >= tracks.length) {
            throw new NotFoundException(Response
                    .status(Response.Status.NOT_FOUND)
                    .entity("Track, " + num + ", of CD, " + getTitle() + ", is not found")
                    .build());
        }
        return tracks[num];
View Full Code Here

                //  For path, query & matrix parameters this is 404,
                //  for others 400...
                //
                if (pType == ParameterType.PATH || pType == ParameterType.QUERY
                    || pType == ParameterType.MATRIX) {
                    throw new NotFoundException(nfe);
                }
                throw new BadRequestException(nfe);
            }
        }
       
View Full Code Here

    @Ignore
    public static class NotFoundResponseExceptionMapper implements ResponseExceptionMapper<Exception> {
       
        public Exception fromResponse(Response r) {
            if (r.getStatus() == HttpStatus.SC_NOT_FOUND) {
                return new NotFoundException();
            } else {
                return null;
            }
        }
View Full Code Here

                                                   message.get(Message.REQUEST_URI),
                                                   rawPath);
            LOG.warning(errorMsg.toString());
            Response resp = JAXRSUtils.createResponse(null, message, errorMsg.toString(),
                    Response.Status.NOT_FOUND.getStatusCode(), false);
            throw new NotFoundException(resp);
        }

        message.getExchange().put(JAXRSUtils.ROOT_RESOURCE_CLASS, resource);

        OperationResourceInfo ori = null;    
View Full Code Here

TOP

Related Classes of javax.ws.rs.NotFoundException

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.