Package org.apache.ecs

Examples of org.apache.ecs.StringElement


            {
                message.addElement(msg);
            }
            else
            {
                message = new StringElement(msg);
            }
        }
    }
View Full Code Here


            screenData = TurbineVelocity.handleRequest(
                context, prefix + templateName);
        }

        // package the response in an ECS element
        StringElement output = new StringElement();
        output.setFilterState(false);

        if (screenData != null)
        {
            output.addElement(screenData);
        }
        return output;
    }
View Full Code Here

     *
     * @param msg a string.
     */
    public void setMessage (String msg )
    {
        this.message = new StringElement(msg);
    }
View Full Code Here

     *
     * @param msg a string.
     */
    public void addMessage(String msg)
    {
        addMessage(new StringElement(msg));
    }
View Full Code Here

     *
     * @param msg an element.
     */
    public void setMessage (Element msg )
    {
        this.message = new StringElement(msg);
    }
View Full Code Here

            {
                message.addElement(msg);
            }
            else
            {
                message = new StringElement(msg);
            }
        }
    }
View Full Code Here

     * @return A ConcreteElement.
     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data ) throws Exception
    {
        StringElement output = null;
        String screenData = null;
        Context context = TurbineVelocity.getContext(data);

        // This will already be properly set and will not be null
        // because of TemplateSessionValidator.
        String templateName = TurbineTemplate.getScreenTemplateName(
            data.getTemplateInfo().getScreenTemplate() );

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
            (templateName.charAt(0) != '/'))
        {
            templateName = '/' + templateName;
        }

        try
        {
            // if a layout has been defined return the results, otherwise
            // send the results directly to the output stream.
            if (getLayout(data) == null)
            {
                TurbineVelocity.handleRequest(context,
                    "screens" + templateName,
                    data.getResponse().getOutputStream());
            }
            else
            {
                screenData = TurbineVelocity
                    .handleRequest(context,"screens" + templateName);
            }
        }
        catch (Exception e)
        {
            // If there is an error, build a $processingException and
            // attempt to call the error.vm template in the screens
            // directory.
            context.put ( "processingException", e.toString() );
            context.put ( "stackTrace", StringUtils.stackTrace(e) );
            templateName = TurbineResources.getString(
                "template.error", "/error.vm");
            if ((templateName.length() > 0) &&
                (templateName.charAt(0) != '/'))
            {
                templateName = '/' + templateName;
            }
            screenData = TurbineVelocity.handleRequest(
                context, "screens" + templateName);
        }

        // package the response in an ECS element
        if (screenData != null)
        {
            output = new StringElement();
            output.setFilterState(false);
            output.addElement(screenData);
        }
        return output;
    }
View Full Code Here

            (templateName.charAt(0) != '/'))
        {
            templateName = '/' + templateName;
        }

        StringElement output = new StringElement();
        output.setFilterState(false);

        String screenData = null;
        try
        {
            screenData = buildWMTemplate(context, "screens" + templateName);
        }
        catch (Exception e)
        {
            // If there is an error, build a $processingException and
            // attempt to call the error.wm template in the screens
            // directory.
            context.put( "processingException", e.toString() );
            context.put( "stackTrace", StringUtils.stackTrace(e) );
            templateName = TurbineResources.getString(
                "template.error", "/error.wm");
            if ((templateName.length() > 0) &&
                (templateName.charAt(0) != '/'))
            {
                templateName = '/' + templateName;
            }
            screenData = buildWMTemplate(
                context, "screens" + templateName);
        }
        output.addElement(screenData);
        return output;
    }
View Full Code Here

        FreeMarkerService fm = (FreeMarkerService)
            TurbineServices.getInstance()
            .getService(FreeMarkerService.SERVICE_NAME);

        StringElement output = new StringElement();
        output.setFilterState(false);
        output.addElement(
            fm.handleRequest(context, "screens" + templateName, true));
        return output;
    }
View Full Code Here

                                            boolean cache)
        throws Exception
    {
        FreeMarkerService fm = (FreeMarkerService)
            TurbineServices.getInstance().getService(FreeMarkerService.SERVICE_NAME);
        StringElement output = new StringElement();
        output.setFilterState(false);
        output.addElement(fm.handleRequest(context,templateFile, cache));
        return output;
    }
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.