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

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


         * We have to be careful to use the real Providers list instead of the one from the injected
         * local providers field in this class.  The injected object may be a "proxy" to the real
         * providers, and could cause an infinite loop when ModelUtils.readValue calls back through
         * the providers.
         */
        SyndEntry returnVal = entry.toSynd(new SyndEntry());
        SyndContent content = returnVal.getContent();
        if (content != null) {
            content.setProviders(RuntimeContextTLS.getRuntimeContext().getAttribute(Providers.class));
        }
       
        return returnVal;
View Full Code Here


    @GET
    @Produces(MediaType.APPLICATION_ATOM_XML)
    public SyndEntry getGreeting() {
        // create and return a syndication entry with a "Hello World!" title,
        // some ID and the current time.
        SyndEntry synd = new SyndEntry(new SyndText("Hello World!"), ID, new Date());
        return synd;
    }
View Full Code Here

        if (getImage() != null && getImage().getUrl() != null) {
            syndFeed.setLogo(getImage().getUrl());
        }
        syndFeed.getEntries().clear();
        for (RssItem rssItem : getItems()) {
            SyndEntry syndEntry = new SyndEntry();
            syndEntry = rssItem.toSynd(syndEntry);
            syndFeed.getEntries().add(syndEntry);
        }
        return syndFeed;
    }
View Full Code Here

                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException, WebApplicationException {

        SyndEntry se = new SyndEntry();
        Class<?> rawType = se.getClass();
        Type genType = rawType;
        String defaultErrorMessage = Messages.getMessage("errorOccurredProcessingRequest"); //$NON-NLS-1$

        // Check if SyndEntry supports response MediaType
        @SuppressWarnings("unchecked")
        MessageBodyWriter<Object> messageBodyWriter =
            (MessageBodyWriter<Object>)providers.getMessageBodyWriter(rawType,
                                                                      genType,
                                                                      null,
                                                                      mediaType);
        String localizedMessage = t.getLocalizedMessage();
        localizedMessage = localizedMessage == null ? defaultErrorMessage : localizedMessage;

        if (messageBodyWriter != null) {
            se.setId(ID_PREFIX + UUID.randomUUID());
            se.setUpdated(new Date(System.currentTimeMillis()));
            se.setPublished(new Date(System.currentTimeMillis()));
            se.setTitle(new SyndText(localizedMessage));
            SyndContent syndContent = new SyndContent();
            syndContent.setType(MediaType.TEXT_PLAIN);
            syndContent.setValue(ExceptionHelper.stackTraceToString(t));
            se.setContent(syndContent);
            se.setSummary(new SyndText(localizedMessage));
            messageBodyWriter.writeTo(se,
                                      rawType,
                                      genType,
                                      null,
                                      mediaType,
View Full Code Here

        @GET
        @Path("atomsyndentry")
        @Produces("application/json")
        public SyndEntry getSyndEntry() throws IOException {
            AtomEntry entry = AtomEntry.unmarshal(new StringReader(ENTRY_STR));
            return entry.toSynd(new SyndEntry());
        }
View Full Code Here

     * The method creates DocumentResource with dummy data.
     *
     * @return DocumentResource<Object>
     */
    public static SyndEntry createSyndEntry() {
        SyndEntry syndEntry = new SyndEntry();
        syndEntry.setTitle(new SyndText(TITLE));
        syndEntry.setId(ID);
        syndEntry.setUpdated(CURRENT_DATE);
        syndEntry.setPublished(CURRENT_DATE);
        SyndPerson person = new SyndPerson();
        person.setName(OWNER);
        syndEntry.addAuthor(person);
        syndEntry.setSummary(new SyndText(SUMMARY));
        SyndCategory syndCategory = new SyndCategory();
        syndCategory.setScheme(CATEGORY_SCHEME);
        syndCategory.setTerm(CATEGORY_TERM);
        syndEntry.addCategory(syndCategory);
        SyndLink syndLink = new SyndLink();
        syndLink.setType(LINK_TYPE);
        syndLink.setRel(LINK_REL);
        syndLink.setHref(LINK_HREF);
        syndEntry.addLink(syndLink);
        SyndContent content = new SyndContent();
        content.setValue(CONTENT_TEXT);
        syndEntry.setContent(content);

        return syndEntry;
    }
View Full Code Here

        @GET
        @Produces(MediaType.TEXT_HTML)
        public Object getSomeDefects(@Context HttpServletResponse httpServletResponse,
                                     @Context HttpServletRequest httpServletRequest) {

            return new HtmlDescriptor(new SyndEntry(), CUSTOMIZED_ENTRY_URL);
        }
View Full Code Here

            relativize(false). // Create absolute URI
            build(usersSyndFeed.getLinks()); // Build link

        // 3. Populate and set the collection members
        for (User user : users) {
            SyndEntry userSyndEntry = createUserSyndEntry(user);

            // generate collection member (single user) system links: "edit",
            // "alternate"
            // all link must be relative to users collection URI "users"
            linkBuilders.createSystemLinksBuilder().subResource(userSyndEntry.getId())
                .build(userSyndEntry.getLinks());

            usersSyndFeed.addEntry(userSyndEntry);
        }
        return usersSyndFeed;
    }
View Full Code Here

        if (user == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        // 2. Create SyndEntry that hold single user information
        SyndEntry userSyndEntry = createUserSyndEntry(user);

        // 3. Generate all user supported system links: "edit", "alternate" etc.
        linkBuilders.createSystemLinksBuilder(). // Create SystemLinksBuilder
            build(userSyndEntry.getLinks()); // Build all system links

        return userSyndEntry;
    }
View Full Code Here

     *
     * @param user object
     * @return SyndEntry syndication entry
     */
    private SyndEntry createUserSyndEntry(User user) {
        SyndEntry entry = new SyndEntry();
        entry.setId(Integer.toString(user.getId()));
        entry.setPublished(new Date(System.currentTimeMillis()));
        entry.setUpdated(new Date(System.currentTimeMillis()));
        entry.setTitle(new SyndText(user.getLastName() + " " + user.getFirstName()));
        return entry;
    }
View Full Code Here

TOP

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

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.