Package org.apache.ecs

Examples of org.apache.ecs.StringElement


        DateFormat df = DateFormat.getDateTimeInstance();
       
        if ( portletName == null ) {
            String message = "Could not find given entry ";
            logger.error( message );
            return new StringElement( message );
        }

        Portlet portlet = null;
        try {
            portlet = PortletFactory.getPortlet( portletName, "0" );
        } catch (PortletException e) {
            logger.error("Exception",  e);
            return new StringElement( e.getMessage() );
        }

        Table t = new Table();
       
        t.addElement( this.getRow"Portlet name: " + portlet.getName() ) );
View Full Code Here


        StringBuffer text = new StringBuffer();

        if (getSource() == null || getSource().trim().length() == 0)
        {
            text.append(NO_SOURCE_MSG);
            return (new StringElement(text.toString()));
        }

        text.append("<IFRAME ");

        text.append("src = \"" + getSource() + "\" ");
        if (getWidth() != null)
        {
            text.append("width = \"" + getWidth() + "\" ");
        }

        if (getHeight() != null)
        {
            text.append("height = \"" + getHeight() + "\" ");
        }

        if (getFrameName() != null)
        {
            text.append("name = \"" + getFrameName() + "\" ");
        }

        if (getStyle() != null)
        {
            text.append("style = \"" + getStyle() + "\" ");
        }

        if (getMarginWidth() != null)
        {
            text.append("marginwidth = \"" + getMarginWidth() + "\" ");
        }

        if (getMarginHeight() != null)
        {
            text.append("marginheight = \"" + getMarginHeight() + "\" ");
        }

        if (getAlign() != null)
        {
            text.append("align = \"" + getAlign() + "\" ");
        }

        text.append("scrolling = \"" + getScrolling() + "\" ");
        text.append("frameborder = \"" + getFrameBorder() + "\" ");
        text.append(">");

        text.append("</IFRAME>");
        return (new StringElement(text.toString()));
    }
View Full Code Here

    return new EcsServletElement(rundata, servletURL);
  } catch (Exception e) {
    String message = "ServletInvokerPortlet: Error invoking "
             + servletURL + ": " + e.getMessage();
    logger.error(message, e);
    return new StringElement(message);
  }
  }    }
View Full Code Here

        // If parsing is OK, wraps content in ECS element
        if (myContent!=null) {
            content = new ElementContainer();

            content.addElement( new Comment( "BEGIN PORTLET" ) );
            content.addElement( new StringElement( myContent ) );
            content.addElement( new Comment( "END PORTLET" ) );
        }

        return content;
    }
View Full Code Here

            return content;

        } catch ( Throwable t ) {
            logger.error("Throwable",  t);
            return new StringElement( t.getMessage() );
        }

    }
View Full Code Here

        }

        if (result == null)
        {
            result = new StringElement("Error retrieving Portal Page: " + msg);
        }

        return result;
    }
View Full Code Here

                    if (null == entry)
                    {
                        // FIXME: need to write this function
                        // Portlets ps = doc.getPortletsById(id);
                        result =
                            new StringElement("not implemented - PortletElement");
                    }
                    else
                    {
                        Portlet p = PortletFactory.getPortlet(entry);
                        if (p != null)
                        {
                            result = p.getContent(rundata);
                        }
                        else
                            result =
                                new StringElement("Error retrieving PortletElement");

                    }
                }
            }
            catch (Exception e)
            {
                logger.error("Exception", e);
            }
        }

        if (result == null)
        {
            result = new StringElement("Error fetching pane");
        }

        return result;

    }
View Full Code Here

            String message = "JSPViewProcessor: Could not include the following JSP Page:  [" + template + "] :\n\t"
                             + e.getMessage();
            logger.error(message, e);

            return new StringElement(message);
        }

        return new JetspeedClearElement(result);
    }
View Full Code Here

    public ConcreteElement getContent(RunData rundata)
    {
        String servletURL = processURL(rundata);
    if(servletURL == null)
    {
      return new StringElement("ServletInvokerPortlet:  Must specify a URL using the URL parameter");
    }
        String content;

        //  This is probably not robust for large content returns, but should work okay within an application context with small amounts of content.
        try
        {

            URL url = new URL(servletURL);
            URLConnection connection = url.openConnection();
            InputStream stream = connection.getInputStream();
            BufferedInputStream in = new BufferedInputStream(stream);
            int length = 0;
            byte[] buf = new byte[BUFFER_SIZE];
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            while ((in != null) && ((length = in.read(buf)) != -1))
            {
                // the data has already been read into buf
                out.write(buf, 0, length);
            }
            content = out.toString();
            return new StringElement(content);
        }
        catch (Exception e)
        {
            String message = "ServletInvokerPortlet: Error invoking " + servletURL + ": " + e.getMessage();
            return new StringElement(message);
        }

    }
View Full Code Here

            //save the portlet markup after you have made the changes.
            this.getContentMarkup( this.getURL( provider ) ).save();

        } catch ( Throwable t ) {
            logger.error("Throwable", t);
            return new StringElement( "Can't use this provider: " + t.getMessage() );
        }
       
        ec.addElement( "Your article '" + title + "' has been posted within '" + topic + "'" );
       
        return ec;
View Full Code Here

TOP

Related Classes of org.apache.ecs.StringElement

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.