Package org.apache.jetspeed.util

Examples of org.apache.jetspeed.util.JetspeedClearElement


                    .addPathInfo("media-type", "html")
                    .toString()
                    );
                JetspeedLinkFactory.putInstance(jsLink);
                jsLink = null;
                return new JetspeedClearElement("");
            } catch (Exception e)
            {
                logger.error("Exception",  e);
                rundata.setScreenTemplate("Home");
                return new JetspeedClearElement("");
            }
            //return new JetspeedClearElement("You must specify portlet to preview using [previewedPortletName] parameter");
        }
        Portlet portlet = null;

        try
        {
            portlet = PortletFactory.getPortlet(portletName, "PreviewPortlet");
            PortletControl control = controlName == null ? PortalToolkit.getControl((String)null) :
                                     PortalToolkit.getControl(controlName);
            control = null;
            if ( control != null )
            {
                JetspeedRunData jdata = (JetspeedRunData)rundata;
                // Use the profile's skin
                //portlet.getPortletConfig().setSkin(PortalToolkit.getSkin(jdata.getProfile().getDocument().getPortlets().getSkin()));
                control.setPortlet(portlet);
                control.init();
                result = control.getContent(rundata);
            }
            else if ( portlet != null )
            {
                result = portlet.getContent(rundata);
            }

            if ( result != null && !result.toString().equals("") )
            {
                /*String html =  result.toString();
                String currentURL = rundata.getRequest().getRequestURI();
                Log.debug("PreviewPortlet: currentURL = " + currentURL + " reader value = " + html);
                PreviewRewriter rewriter = new PreviewRewriter(currentURL, currentURL , currentURL, portletName);
                result = new JetspeedClearElement(rewriter.rewrite(new StringReader(html)));*/
            }
            else
            {
                // The portlet already streamed its content - return a stub
                result = new JetspeedClearElement("");
            }

        }
        catch ( Exception e )
        {
            logger.error("Exception",  e);
            result = new JetspeedClearElement("This resource is temporarily unavailable");
        }

        rundata.setLayout("preview");
        return result;
    }
View Full Code Here


        {
            if (PortletStats.isEnabled())
            {
                PortletStats.logAccess(rundata, this, PortletStats.ACCESS_DENIED);
            }
            return new JetspeedClearElement(Localization.getString(rundata, "SECURITY_NO_ACCESS_TO_PORTLET"));
        }
    }
View Full Code Here

                    result = p.getContent(rundata);
                }
            }
            else
            {
                result = new JetspeedClearElement(Localization.getString(data, "SECURITY_NO_ACCESS_TO_PORTLET"));
            }
        }
        catch (Exception e)
        {
            logger.error("Exception",  e);
View Full Code Here

            WMLFilter myFilter = new WMLFilter(new PrintWriter(bos));
            myFilter.filter(url);
            content = new JetspeedClearElement( bos.toString() );
            */
            content = new JetspeedClearElement(
                JetspeedDiskCache.getInstance().getEntry( config.getURL() ).getData() );
        } catch (Exception e) {
            throw new PortletException( e.getMessage() );
        } finally {
            try {
View Full Code Here

            path = this.getPortletConfig().getInitParameter("path");
        }

        if (null == path)
        {
            return new JetspeedClearElement("Path parameter not set");
        }
        ProfileLocator locator = Profiler.createLocator();
        locator.createFromPath(path);
        String id = locator.getId();

        try
        {
            Profile profile = Profiler.getProfile(locator);
            PSMLDocument doc = profile.getDocument();

            if (doc == null)
            {
                return null;
            }
            Portlets portlets = doc.getPortlets();
            PortletSet ps = PortalToolkit.getSet(portlets);
            return ps.getContent(rundata);
        }
        catch (Exception e)
        {
            logger.error("Exception",  e);
            return new JetspeedClearElement("Error in aggregation portlet: " + e.toString());
        }
    }
View Full Code Here

                    .addPathInfo("media-type", "html")
                    .toString()
                    );
                JetspeedLinkFactory.putInstance(jsLink);
                jsLink = null;
                return new JetspeedClearElement("");
            } catch (Exception e)
            {
                logger.error("Exception",  e);
                rundata.setScreenTemplate("Home");
                return new JetspeedClearElement("");
            }
            //return new JetspeedClearElement("You must specify portlet to preview using [previewedPortletName] parameter");
        }
        Portlet portlet = null;

        try
        {
            portlet = PortletFactory.getPortlet(portletName, "PreviewPortlet");
            PortletControl control = controlName == null ? PortalToolkit.getControl((String)null) :
                                     PortalToolkit.getControl(controlName);
            control = null;
            if ( control != null )
            {
                JetspeedRunData jdata = (JetspeedRunData)rundata;
                // Use the profile's skin
                //portlet.getPortletConfig().setSkin(PortalToolkit.getSkin(jdata.getProfile().getDocument().getPortlets().getSkin()));
                control.setPortlet(portlet);
                control.init();
                result = control.getContent(rundata);
            }
            else if ( portlet != null )
            {
                result = portlet.getContent(rundata);
            }

            if ( result != null && !result.toString().equals("") )
            {
                /*String html =  result.toString();
                String currentURL = rundata.getRequest().getRequestURI();
                Log.debug("PreviewPortlet: currentURL = " + currentURL + " reader value = " + html);
                PreviewRewriter rewriter = new PreviewRewriter(currentURL, currentURL , currentURL, portletName);
                result = new JetspeedClearElement(rewriter.rewrite(new StringReader(html)));*/
            }
            else
            {
                // The portlet already streamed its content - return a stub
                result = new JetspeedClearElement("");
            }

        }
        catch ( Exception e )
        {
            logger.error("Exception",  e);
            result = new JetspeedClearElement("This resource is temporarily unavailable");
        }

        rundata.setLayout("preview");
        return result;
    }
View Full Code Here

    }

    /**
    */
    protected void setContent( String content ) {
        this.setContent( new JetspeedClearElement( content ),
                         CapabilityMapFactory.getDefaultCapabilityMap() );
    }
View Full Code Here

        CapabilityMap mymap = map;
        if ( mymap == null ) {
            mymap = CapabilityMapFactory.getDefaultCapabilityMap();
        }

        ConcreteElement buffer = new JetspeedClearElement( content.toString( ) );
        this.content.put( mymap.toString(), buffer );
    }
View Full Code Here

                    if( element != null ) {
                        // now we put it under our cmap
                        this.setContent( element, mymap );
                    }
                } catch (Exception e) {
                    element = new JetspeedClearElement("Error when retrieving Portlet contents");
                    if( logger.isDebugEnabled() ) {
                        logger.debug( "Error when retrieving Portlet contents", e );
                    }
                }
            } else {
                if( element == null ) {
                    //FIXME: Let's asume that the contents under "default" map are good
                    mymap = CapabilityMapFactory.getDefaultCapabilityMap();
                    element = (ConcreteElement)content.get( mymap.toString() );
                    if( element == null ) {
                        element = new JetspeedClearElement("Unknown Problem getting Contents");
                    }
                }
            }
        }
View Full Code Here

        }

       
        try {
           
            return new JetspeedClearElement( SimpleTransform.transform( url, stylesheet ) );
           
        } catch (SAXException e) {
            logger.error( "Couldn't transform content.", e );
            throw new PortletException( "Couldn't transform content.  Please see error log" );
        }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.util.JetspeedClearElement

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.