Examples of AbstractResponseContext


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

  public static AbstractResponseContext createErrorResponse(
    Abdera abdera,
    final int code,
    final String message,
    final Throwable t) {
      AbstractResponseContext rc =
        new StreamWriterResponseContext(abdera) {
          protected void writeTo(StreamWriter sw)
            throws IOException {
            Error.create(sw, code, message, t);
          }
        };
      rc.setStatus(code);
      rc.setStatusText(message);
      return rc;
  }
View Full Code Here

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

  public static ResponseContext notallowed(
    RequestContext request,
    String reason,
    String... methods) {
      log.debug(Localizer.get("NOT.ALLOWED"));
      AbstractResponseContext resp =
        createErrorResponse(request.getAbdera(),405,reason);
      resp.setAllow(methods);
      return resp;
  }
View Full Code Here

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

   */
  protected ResponseContext buildGetEntryResponse(RequestContext request, Entry entry) throws ResponseContextException {
    Feed feed = createFeedBase(request);
    entry.setSource(feed.getAsSource());
    Document<Entry> entry_doc = entry.getDocument();
    AbstractResponseContext rc = new BaseResponseContext<Document<Entry>>(entry_doc);
    rc.setEntityTag(calculateEntityTag(entry));
    return rc;
  }
View Full Code Here

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

   * Creates the ResponseContext for a GET feed request.  By default, a BaseResponseContext
   * is returned.  The Etag header will be set.
   */
  protected ResponseContext buildGetFeedResponse(Feed feed) {
    Document<Feed> document = feed.getDocument();
    AbstractResponseContext rc = new BaseResponseContext<Document<Feed>>(document);
    rc.setEntityTag(calculateEntityTag(document.getRoot()));
    return rc;
  }
View Full Code Here

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

    protected ResponseContext buildGetEntryResponse(RequestContext request, Entry entry)
            throws ResponseContextException {
        Feed feed = createFeedBase(request);
        entry.setSource(feed.getAsSource());
        Document<Entry> entry_doc = entry.getDocument();
        AbstractResponseContext rc = new BaseResponseContext<Document<Entry>>(entry_doc);
        rc.setEntityTag(calculateEntityTag(entry));
        Date updated = entry.getUpdated();
        if (updated != null) {
            rc.setLastModified(updated);
        }
        return rc;
    }
View Full Code Here

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

     *
     * @return the response context.
     */
    protected ResponseContext buildGetFeedResponse(Feed feed) {
        Document<Feed> document = feed.getDocument();
        AbstractResponseContext rc = new BaseResponseContext<Document<Feed>>(document);
        rc.setEntityTag(calculateEntityTag(document.getRoot()));
        Date updated = feed.getUpdated();
        if (updated != null) {
            rc.setLastModified(updated);
        }
        return rc;
    }
View Full Code Here

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

    protected ResponseContext buildGetEntryResponse(RequestContext request, Entry entry)
        throws ResponseContextException {
        Feed feed = createFeedBase(request);
        entry.setSource(feed.getAsSource());
        Document<Entry> entry_doc = entry.getDocument();
        AbstractResponseContext rc = new BaseResponseContext<Document<Entry>>(entry_doc);
        rc.setEntityTag(calculateEntityTag(entry));
        return rc;
    }
View Full Code Here

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

     * Creates the ResponseContext for a GET feed request. By default, a BaseResponseContext is returned. The Etag
     * header will be set.
     */
    protected ResponseContext buildGetFeedResponse(Feed feed) {
        Document<Feed> document = feed.getDocument();
        AbstractResponseContext rc = new BaseResponseContext<Document<Feed>>(document);
        rc.setEntityTag(calculateEntityTag(document.getRoot()));
        return rc;
    }
View Full Code Here

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

     */
    public static AbstractResponseContext createErrorResponse(Abdera abdera,
                                                              final int code,
                                                              final String message,
                                                              final Throwable t) {
        AbstractResponseContext rc = new StreamWriterResponseContext(abdera) {
            protected void writeTo(StreamWriter sw) throws IOException {
                Error.create(sw, code, message, t);
            }
        };
        rc.setStatus(code);
        rc.setStatusText(message);
        return rc;
    }
View Full Code Here

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

    /**
     * Return a 405 method not allowed error
     */
    public static ResponseContext notallowed(RequestContext request, String reason, String... methods) {
        log.debug(Localizer.get("NOT.ALLOWED"));
        AbstractResponseContext resp = createErrorResponse(request.getAbdera(), 405, reason);
        resp.setAllow(methods);
        return resp;
    }
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.