Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
JBoss, a division of Red Hat * Copyright 2012, Red Hat Middleware, LLC, and individual * contributors as indicated by the

tag. See the * copyright.txt in the distribution for a full listing of * individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: * /
 import java.util.List;
 import  javax.portlet.GenericPortlet;
 import  javax.portlet.PortletException;
 import  javax.portlet.PortletPreferences;
 import  javax.portlet.RenderRequest;
 import  javax.portlet.RenderResponse;
 import  javax.portlet.PortletRequestDispatcher;
 import  javax.portlet.ResourceRequest;
 import  javax.portlet.ResourceResponse;

Viliam Rockai
 public class CommunityPortlet extends GenericPortlet {
     private String DEFAULT_URL = "/#";
     private String URL_RSS_BLOG = "";
     private String URL_RSS_TWITTER = "url.rss.twitter";
     private String URL_CONTENT_BLOG = "";
     private String URL_CONTENT_TWITTER = "url.twitter";
     private String PFX_BLOG_AUTHOR = "";
     private static final Logger log = LoggerFactory.getLogger(CommunityPortlet.class);
     protected void doView(RenderRequest request, RenderResponse responsethrows PortletException, IOException {
         PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/community.jsp");
     private RssReaderBean makeReaderBean(String urlRssString urlContentint headString pfxBlogAuthor) {
         RssReaderBean rssReaderBean = new RssReaderBean();
         try {
             URL rssSourceUrl = new URL(urlRss);
             rssReaderBean.setContentSource(new URL(urlContent));
         } catch (IOException e) {
             .debug("Unable to open RSS feed url: " + e);
         }   catch (FeedException e) {
             .debug("Problem with RSS feed: " + e);
         return rssReaderBean;
     public void serveResource(ResourceRequest request, ResourceResponse responsethrows PortletException, IOException {
         PortletPreferences portletPreferences = request.getPreferences();
         String contentType = request.getParameter("type");
         if ("blog".equals(contentType)){
             String urlRssBlog = portletPreferences.getValue();
             String urlContentBlog = portletPreferences.getValue();
             String pfxBlogAuthor = portletPreferences.getValue("");
             RssReaderBean gateInBlogRssReader = makeReaderBean(urlRssBlogurlContentBlog, 2, pfxBlogAuthor);
             PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/feedBlog.jsp");
         } else if ("twitter".equals(contentType)) {
            String urlRssTwitter = portletPreferences.getValue();
            String urlContentTwitter = portletPreferences.getValue();
            RssReaderBean gateInTwitterRssReader = makeReaderBean(urlRssTwitterurlContentTwitter, 2, null);
            PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/feedTwitter.jsp");
New to GrepCode? Check out our FAQ X