/** * {@inheritDoc} */ @Override protected ResponseContext buildGetFeedResponse(Feed feed) { // The same as in super class but without ETag. Document<Feed> document = feed.getDocument(); AbstractResponseContext rc = new BaseResponseContext<Document<Feed>>(document); // rc.setEntityTag(calculateEntityTag(document.getRoot())); return rc; }
public ResponseContext search(RequestContext request, Map<String, String> parameters) { List<T> searchResults = this.doSearch(request, parameters); Feed feed = this.createFeed(request, parameters, searchResults); Document<Feed> document = feed.getDocument(); ResponseContext response = new BaseResponseContext<Document<Feed>>(document); return response; }
public Feed addArchiveNode( Feed feed ) { Factory factory = feed.getFactory(); Element root = feed.getDocument().getRoot(); Element elementArchive = factory.newExtensionElement( new QName( ARCHIVE_NS, ARCHIVE, ARCHIVE_PREFIX ), root ); elementArchive.setParentElement( root ); return feed; } }
public ResponseContext getFeed(RequestContext request) { try { Feed feed = getFeed(); return feed != null ? ProviderHelper.returnBase(feed.getDocument(), 200, null) : ProviderHelper .notfound(request); } catch (Exception e) { return ProviderHelper.servererror(request, e.getMessage(), e); } }
/** * 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; }
private Document<Feed> init_feed_doc(Abdera abdera) { Factory factory = abdera.getFactory(); Feed feed = factory.newFeed(); try { feed.setId("tag:example.org,2006:feed"); feed.setTitle("Simple"); feed.setUpdated(new Date()); feed.addLink(""); feed.addLink("", "self"); feed.addAuthor("Simple"); } catch (Exception e) { e.printStackTrace(); } // FIXME: Document this exception return feed.getDocument(); }
feed.getDocument().writeTo(response.getOutputStream()); } catch (IOException ioe) { throw new ServletException(ioe);
/** * Implements GET on a COLLECTION */ public ResponseContext getFeed(RequestContext request) { /* Factory factory = */getAndInitFactory(request); Feed feed; try { int length = ProviderHelper.getPageSize(request, "count", 25); int offset = ProviderHelper.getOffset(request, "page", length); String _page = request.getParameter("page"); int page =(_page != null) ? Integer.parseInt(_page) : 0; feed = getFeedInternal(request, offset, length); } catch (BadRequestException e) { return makeExceptionResponse(HttpServletResponse.SC_BAD_REQUEST, e); } Document<Feed> doc = feed.getDocument(); AbstractResponseContext rc = new BaseResponseContext<Document<Feed>>(doc); rc.setEntityTag(calculateEntityTag(feed)); return rc; }
public ResponseContext getFeed(RequestContext request) { Feed feed = abdera.newFeed(); feed.setId(config.getServerConfiguration().getServerUri() + "/" + config.getFeedId()); feed.setTitle(config.getFeedTitle()); feed.addAuthor(config.getFeedAuthor()); feed.addLink(config.getFeedUri()); feed.addLink(config.getFeedUri(), "self"); feed.setUpdated(new Date()); getEntries(request, feed, root); return ProviderHelper.returnBase(feed.getDocument(), 200, null); }
@Override public ResponseContext getFeed(final RequestContext request) { final Feed feed = this.abdera.newFeed(); feed.setId(this.config.getServerConfiguration().getServerUri() + "/" + this.config.getFeedId()); feed.setTitle(this.config.getFeedTitle()); feed.addAuthor(this.config.getFeedAuthor()); feed.addLink(this.config.getFeedUri()); feed.addLink(this.config.getFeedUri(), "self"); feed.setUpdated(new Date()); this.getEntries(request, feed, this.root); return ProviderHelper.returnBase(feed.getDocument(), 200, null); }