Package org.apache.wink.common.model.synd

Examples of org.apache.wink.common.model.synd.SyndFeed


                                                                  .getFirst(WebDAVHeaders.DEPTH),
                                                              provider);
    }

    protected SyndFeed getSyndFeed(String path) {
        SyndFeed feed = new SyndFeed();
        feed.setTitle(new SyndText("")); //$NON-NLS-1$
        feed.addLink(new SyndLink(AtomConstants.ATOM_REL_EDIT, null, path));
        return feed;
    }
View Full Code Here


            List<SyndFeed> collectionsList = new ArrayList<SyndFeed>();
            for (ServiceDocumentCollectionData subCollection : WebDAVRootResource.this
                .getCollections(uriInfo)) {
                // only collection without template URI
                if (!isTemplateUri(subCollection.getUri())) {
                    SyndFeed subFeed = new SyndFeed();
                    subFeed.setTitle(new SyndText(subCollection.getTitle()));
                    subFeed.addLink(new SyndLink(AtomConstants.ATOM_REL_EDIT, null, subCollection
                        .getUri()));
                    collectionsList.add(subFeed);
                }
            }
            return collectionsList;
View Full Code Here

            // entries
            for (SyndEntry entry : feed.getEntries()) {
                entry.setBase(feed.getBase()); // use the feed URI base
                if (provider.isSubCollection(entry)) {
                    // sub-collection
                    SyndFeed subCollection = provider.getSubCollection(entry);
                    if (subCollection != null) {
                        addResponseToMultistatus(multistatus, propfind, subCollection, provider);
                    }
                } else {
                    // entry
View Full Code Here

    static public class CollectionResource {

        @GET
        @Produces(MediaType.APPLICATION_ATOM_XML)
        public SyndFeed getCollection(@Context LinkBuilders linkBuilders, @Context UriInfo uriInfo) {
            SyndFeed feed = new SyndFeed(new SyndText("Test"), "test:1", new Date());
            feed.setBase(uriInfo.getBaseUri().toString());

            SyndEntry entry = new SyndEntry(new SyndText("Test"), "test:1", new Date());
            URI requestUri = uriInfo.getAbsolutePath();
            entry.setContent(new SyndContent(requestUri + "/csv", "text/csv", true));
            feed.addEntry(entry);

            linkBuilders.createSystemLinksBuilder().relativize(false).build(feed.getLinks());
            linkBuilders.createSystemLinksBuilder().relativize(false)
                .resource(DocumentResource.class).build(entry.getLinks());

            return feed;
        }
View Full Code Here

        entry2.addAuthor(new SyndPerson("Yosi Yosi"));
        entry2.addCategory(new SyndCategory("severity", "low", null));
        entry2.addCategory(new SyndCategory("author", "Yosi Yosi", null));
        entry2.addCategory(new SyndCategory("control", "No Control", null));

        SyndFeed syndFeed = new SyndFeed();
        syndFeed.getEntries().add(entry1);
        syndFeed.getEntries().add(entry2);

        // make providers to return CsvSerializerProvider
        CsvSyndFeedSerializerProvider syndFeedSerializerProvider =
            new CsvSyndFeedSerializerProvider();
        Field field = CsvSyndFeedSerializerProvider.class.getDeclaredField("providers");
        field.setAccessible(true);
        field.set(syndFeedSerializerProvider, new Providers() {

            public <T> ContextResolver<T> getContextResolver(Class<T> contextType,
                                                             MediaType mediaType) {
                return null;
            }

            public <T extends Throwable> ExceptionMapper<T> getExceptionMapper(Class<T> type) {
                return null;
            }

            public <T> MessageBodyReader<T> getMessageBodyReader(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return null;
            }

            @SuppressWarnings("unchecked")
            public <T> MessageBodyWriter<T> getMessageBodyWriter(Class<T> type,
                                                                 Type genericType,
                                                                 Annotation[] annotations,
                                                                 MediaType mediaType) {
                return (MessageBodyWriter<T>)new CsvSerializerProvider();
            }
        });

        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMapImpl<String, Object> httpHeaders = new MultivaluedMapImpl<String, Object>();
        syndFeedSerializerProvider.writeTo(syndFeed,
                                           syndFeed.getClass(),
                                           null,
                                           null,
                                           MediaTypeUtils.CSV_TYPE,
                                           httpHeaders,
                                           os);
View Full Code Here

        @GET
        @Path("atomsyndfeed")
        @Produces("application/atom+xml")
        public SyndFeed getSyndFeed() throws IOException {
            AtomFeed feed = AtomFeed.unmarshal(new StringReader(FEED));
            return feed.toSynd(new SyndFeed());
        }
View Full Code Here

        @GET
        @Path("atomsyndfeed")
        @Produces("application/atom+xml")
        public SyndFeed getSyndFeed() throws IOException {
            AtomFeed feed = AtomFeed.unmarshal(new StringReader(FEED));
            return feed.toSynd(new SyndFeed());
        }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.synd.SyndFeed

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.