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

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


  public static ResponseContext returnBase(
    Base base,
    int status,
    Date lastModified) {
      log.debug(Localizer.get("RETURNING.DOCUMENT"));
      BaseResponseContext response = new BaseResponseContext(base);
      response.setStatus(status);
      if (lastModified != null) response.setLastModified(lastModified);
      response.setContentType(MimeTypeHelper.getMimeType(base));
      Document doc = base instanceof Document ? (Document)base : ((Element)base).getDocument();
      if (doc.getEntityTag() != null) {
        response.setEntityTag(doc.getEntityTag());
      } else if (doc.getLastModified() != null) {
        response.setLastModified(doc.getLastModified());
      }
      return response;
  }
View Full Code Here


    public ResponseContext process(RequestContext requestContext, WorkspaceManager workspaceManager, CollectionAdapter collectionAdapter) {
        String method = requestContext.getMethod();
        if (method.equalsIgnoreCase("GET")) {
            OpenSearchDescription description = this.openSearchInfo.asOpenSearchDescriptionElement(requestContext);
            ResponseContext response = new BaseResponseContext(description);
            response.setContentType(OpenSearchConstants.OPENSEARCH_DESCRIPTION_CONTENT_TYPE);
            return response;
        } else {
            return null;
        }
    }
View Full Code Here

                    return ProviderHelper.badrequest(request);
                setEntryDetails(request, entry, abdera.getFactory().newUuidUri());
                Feed feed = getFeedDocument(request).getRoot();
                feed.insertEntry(entry);
                feed.setUpdated(new Date());
                BaseResponseContext rc =
                    (BaseResponseContext)ProviderHelper.returnBase(entry_doc, 201, entry.getEdited());
                return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
                    .toString()).setContentLocation(rc.getLocation().toString()).setEntityTag(ProviderHelper
                    .calculateEntityTag(entry));
            } else {
                return ProviderHelper.badrequest(request);
            }
        } catch (ParseException pe) {
View Full Code Here

                    return ProviderHelper.badrequest(request);
                setEntryDetails(request, entry, abdera.getFactory().newUuidUri());
                Feed feed = getFeedDocument(request).getRoot();
                feed.insertEntry(entry);
                feed.setUpdated(new Date());
                BaseResponseContext rc =
                    (BaseResponseContext)ProviderHelper.returnBase(entry_doc, 201, entry.getEdited());
                return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
                    .toString()).setContentLocation(rc.getLocation().toString()).setEntityTag(ProviderHelper
                    .calculateEntityTag(entry));
            } else {
                return ProviderHelper.badrequest(request);
            }
        } catch (ParseException pe) {
View Full Code Here

                    return ProviderHelper.badrequest(request);
                setEntryDetails(request, entry, abdera.getFactory().newUuidUri());
                Feed feed = getFeedDocument(request).getRoot();
                feed.insertEntry(entry);
                feed.setUpdated(new Date());
                BaseResponseContext rc =
                    (BaseResponseContext)ProviderHelper.returnBase(entry_doc, 201, entry.getEdited());
                return rc.setLocation(ProviderHelper.resolveBase(request).resolve(entry.getEditLinkResolvedHref())
                    .toString()).setContentLocation(rc.getLocation().toString()).setEntityTag(ProviderHelper
                    .calculateEntityTag(entry));
            } else {
                return ProviderHelper.badrequest(request);
            }
        } catch (ParseException pe) {
View Full Code Here

     * Return a document
     */
    @SuppressWarnings("unchecked")
    public static ResponseContext returnBase(Base base, int status, Date lastModified) {
        log.debug(Localizer.get("RETURNING.DOCUMENT"));
        BaseResponseContext response = new BaseResponseContext(base);
        response.setStatus(status);
        if (lastModified != null)
            response.setLastModified(lastModified);
        // response.setContentType(MimeTypeHelper.getMimeType(base));
        Document doc = base instanceof Document ? (Document)base : ((Element)base).getDocument();
        if (doc.getEntityTag() != null) {
            response.setEntityTag(doc.getEntityTag());
        } else if (doc.getLastModified() != null) {
            response.setLastModified(doc.getLastModified());
        }
        return response;
    }
View Full Code Here

                                   WorkspaceManager workspaceManager,
                                   CollectionAdapter collectionAdapter) {
        String method = requestContext.getMethod();
        if (method.equalsIgnoreCase("GET")) {
            OpenSearchDescription description = this.openSearchInfo.asOpenSearchDescriptionElement(requestContext);
            ResponseContext response = new BaseResponseContext(description);
            response.setContentType(OpenSearchConstants.OPENSEARCH_DESCRIPTION_CONTENT_TYPE);
            return response;
        } else {
            return null;
        }
    }
View Full Code Here

            entry,
            abdera.getFactory().newUuidUri());
          Feed feed = getFeedDocument(request).getRoot();
          feed.insertEntry(entry);
          feed.setUpdated(new Date());
          BaseResponseContext rc =
            (BaseResponseContext) ProviderHelper.returnBase(
              entry_doc, 201, entry.getEdited());
          return
            rc.setLocation(
                ProviderHelper.resolveBase(request).resolve(
                  entry.getEditLinkResolvedHref()).toString())
              .setContentLocation(rc.getLocation().toString())
              .setEntityTag(ProviderHelper.calculateEntityTag(entry));
        } else {
          return ProviderHelper.badrequest(request);
        }
      } catch (ParseException pe) {
View Full Code Here

            entry,
            abdera.getFactory().newUuidUri());
          Feed feed = getFeedDocument(request).getRoot();
          feed.insertEntry(entry);
          feed.setUpdated(new Date());
          BaseResponseContext rc =
            (BaseResponseContext) ProviderHelper.returnBase(
              entry_doc, 201, entry.getEdited());
          return
            rc.setLocation(
                ProviderHelper.resolveBase(request).resolve(
                  entry.getEditLinkResolvedHref()).toString())
              .setContentLocation(rc.getLocation().toString())
              .setEntityTag(ProviderHelper.calculateEntityTag(entry));
        } else {
          return ProviderHelper.badrequest(request);
        }
      } catch (ParseException pe) {
View Full Code Here

  public static ResponseContext returnBase(
    Base base,
    int status,
    Date lastModified) {
      log.debug(Localizer.get("RETURNING.DOCUMENT"));
      BaseResponseContext response = new BaseResponseContext(base);
      response.setStatus(status);
      if (lastModified != null) response.setLastModified(lastModified);
      response.setContentType(MimeTypeHelper.getMimeType(base));
      Document doc = base instanceof Document ? (Document)base : ((Element)base).getDocument();
      if (doc.getEntityTag() != null) {
        response.setEntityTag(doc.getEntityTag());
      } else if (doc.getLastModified() != null) {
        response.setLastModified(doc.getLastModified());
      }
      return response;
  }
View Full Code Here

TOP

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

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.