Package org.apache.abdera.protocol.server.context

Examples of org.apache.abdera.protocol.server.context.ResponseContextException


        Document<Entry> entry_doc;
        try {
            entry_doc = (Document<Entry>)request.getDocument(parser).clone();
        } catch (ParseException e) {
            throw new ResponseContextException(400, e);
        } catch (IOException e) {
            throw new ResponseContextException(500, e);
        }
        if (entry_doc == null) {
            return null;
        }
        return entry_doc.getRoot();
View Full Code Here


    }

    private Integer getIdFromResourceName(String resourceName) throws ResponseContextException {
        int idx = resourceName.indexOf("-");
        if (idx == -1) {
            throw new ResponseContextException(404);
        }
        return new Integer(resourceName.substring(0, idx));
    }
View Full Code Here

     * @param inputStream An input stream providing access to the request payload
     * @param request The request context
     */
    public void putMedia(T entryObj, MimeType contentType, String slug, InputStream inputStream, RequestContext request)
        throws ResponseContextException {
        throw new ResponseContextException(ProviderHelper.notallowed(request));
    }
View Full Code Here

    /**
     * Delete a media resource. By default this method is not supported. Implementations must override this method to
     * support deleting media resources
     */
    public void deleteMedia(String resourceName, RequestContext request) throws ResponseContextException {
        throw new ResponseContextException(ProviderHelper.notsupported(request));
    }
View Full Code Here

    private Integer getIdFromResourceName(String resourceName) throws ResponseContextException
    {
        int idx = resourceName.indexOf("-");
        if (idx == -1)
        {
            throw new ResponseContextException(404);
        }
        Integer id = new Integer(resourceName.substring(0, idx));
        return id;
    }
View Full Code Here

            response = processor.process(request, wm, adapter);
            response = response != null ? response : processExtensionRequest(
                    request, adapter);
        } catch (Throwable e) {
            if (e instanceof ResponseContextException) {
                ResponseContextException rce = (ResponseContextException) e;
                if (rce.getStatusCode() >= 400 && rce.getStatusCode() < 500) {
                    // don't report routine 4xx HTTP errors
                    log.info("info: ", e);
                } else {
                    log.error("inner error: ", e);
                }
View Full Code Here

        try {
            Session session = (Session)sessionPool.get(request);

            request.setAttribute(Scope.REQUEST, SESSION_KEY, session);
        } catch (Exception e) {
            throw new ResponseContextException(500, e);
        }
    }
View Full Code Here

    @Override
    public boolean isMediaEntry(Node entry) throws ResponseContextException {
        try {
            return entry.hasProperty(MEDIA);
        } catch (RepositoryException e) {
            throw new ResponseContextException(500, e);
        }
    }
View Full Code Here

    @Override
    public Node postMedia(MimeType mimeType, String slug, InputStream inputStream, RequestContext request)
        throws ResponseContextException {
        if (slug == null) {
            throw new ResponseContextException("A slug header must be supplied.", 500);
        }
        Node n = postEntry(slug, null, null, new Date(), null, null, request);

        try {
            n.setProperty(MEDIA, inputStream);
            n.setProperty(CONTENT_TYPE, mimeType.toString());

            String summary = postSummaryForEntry(n);
            if (summary != null) {
                n.setProperty(SUMMARY, summary);
            }

            getSession(request).save();

            return n;
        } catch (RepositoryException e) {
            try {
                getSession(request).refresh(false);
            } catch (Throwable t) {
                log.warn(t);
            }
            throw new ResponseContextException(500, e);
        }
    }
View Full Code Here

            try {
                session.refresh(false);
            } catch (Throwable t) {
                log.warn(t);
            }
            throw new ResponseContextException(500, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.abdera.protocol.server.context.ResponseContextException

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.