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

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


  @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

                              Content content, Session session)
    throws ResponseContextException, RepositoryException {
    if (title == null) {
      EmptyResponseContext ctx = new EmptyResponseContext(500);
      ctx.setStatusText("Entry title cannot be empty.");
      throw new ResponseContextException(ctx);
    }

    entry.setProperty(TITLE, title);

    if (summary != null) {
View Full Code Here

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

  private Node getNode(Session session, String resourceName) throws ResponseContextException,
    RepositoryException {
    try {
      return session.getNodeByUUID(collectionNodeId).getNode(resourceName);
    } catch (PathNotFoundException e) {
      throw new ResponseContextException(404);
    }
  }
View Full Code Here

          authors.add(author);
        }
      }
      return authors;
    } catch (RepositoryException e) {
      throw new ResponseContextException(500, e);
    }
  }
View Full Code Here

      Node n = session.getNodeByUUID(collectionNodeId);
      for (NodeIterator nodes = n.getNodes(); nodes.hasNext();) {
        entries.add(nodes.nextNode());
      }
    } catch (RepositoryException e) {
      throw new ResponseContextException(500, e);
    }

    return entries;
  }
View Full Code Here

  @Override
  public Node getEntry(String resourceName, RequestContext request) throws ResponseContextException {
    try {
      return getNode(getSession(request), resourceName);
    } catch (RepositoryException e) {
      throw new ResponseContextException(500, e);
    }
  }
View Full Code Here

  @Override
  public String getId(Node entry) throws ResponseContextException {
    try {
      return "urn:" + entry.getUUID();
    } catch (RepositoryException e) {
      throw new ResponseContextException(500, e);
    }
  }
View Full Code Here

  public InputStream getMediaStream(Node entry) throws ResponseContextException {
    try {
      Value value = getValueOrNull(entry, MEDIA);
      return (value != null) ? value.getStream() : null;
    } catch (RepositoryException e) {
      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.