Examples of HttpErrorException


Examples of org.apache.marmotta.platform.core.exception.HttpErrorException

    }

    public Response putContent(URI resource, String mimetype, HttpServletRequest request) throws HttpErrorException {
        try {
            if (request.getContentLength() == 0) {
                throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "content may not be empty for writing");
            }
            contentService.setContentStream(resource, request.getInputStream(), mimetype); // store content
            if(configurationService.getBooleanConfiguration(ENHANCER_STANBOL_ENHANCER_ENABLED, false)) {
                afterContentCreated.fire(new ContentCreatedEvent(resource)); //enhancer
            }
            return Response.ok().build();
        } catch (IOException e) {
            throw new HttpErrorException(Status.BAD_REQUEST, resource.stringValue(), "could not read request body");
        } catch (WritingNotSupportedException e) {
            throw new HttpErrorException(Status.FORBIDDEN, resource.stringValue(), "writting this content is not supported");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.