Package org.webmacro.servlet

Examples of org.webmacro.servlet.WebContext


     * @param data Turbine information.
     * @exception Exception, a generic exception.
     */
    protected void doBuildBeforeAction(RunData data) throws Exception
    {
        WebContext wc_data = TurbineWebMacro.getContext(data);
        data.getTemplateInfo().setTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT, wc_data);
    }
View Full Code Here


     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data )
        throws Exception
    {
        WebContext context = getContext( data );

        String templateName = data.getTemplateInfo().getNavigationTemplate();

        StringElement output = new StringElement();
        output.setFilterState(false);
View Full Code Here

    protected WebContext getContext(RunData data)
    {
        // Attempt to get it from the TemplateInfo first.  If it
        // doesn't exist, create it and then stuff it into the
        // TemplateInfo.
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     * @return A ConcreteElement.
     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data ) throws Exception
    {
        WebContext context = getContext(data);

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

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
            (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) != '/'))
            {
View Full Code Here

     */
    public static WebContext getContext(RunData data)
    {
        // Attempt to get it from the session first.  If it doesn't
        // exist, create it and then stuff it into the session.
        WebContext wc = (WebContext)data.getTemplateInfo().getTemplateContext(
            WebMacroService.WEBMACRO_CONTEXT);
        if (wc == null)
        {
            wc = TurbineWebMacro.getContext(data);
            data.getTemplateInfo().setTemplateContext(
View Full Code Here

     *
     * @return A new, empty context.
     */
    public WebContext getContext()
    {
        return new WebContext(broker);
    }
View Full Code Here

     * @param data The Turbine RunData object.
     * @return A clone of the WebContext needed by WebMacro.
     */
    public WebContext getContext(RunData data)
    {
        WebContext newWC = wcPrototype.newInstance(data.getRequest(),
                                                   data.getResponse());
        newWC.put( "data", data );
        newWC.put( "link", new TemplateLink(data) );
        newWC.put( "page", new TemplatePageAttributes(data) );
        newWC.put( "formatter", new WebMacroFormatter(newWC) );
        newWC.put( "content", new ContentURI(data) );
        return newWC;
    }
View Full Code Here

     *
     * @return A new, empty context.
     */
    public WebContext getContext()
    {
        return new WebContext(broker);
    }
View Full Code Here

     * @param data The Turbine RunData object.
     * @return A clone of the WebContext needed by WebMacro.
     */
    public WebContext getContext(RunData data)
    {
        WebContext newWC = wcPrototype.newInstance(data.getRequest(),
                                                   data.getResponse());
        newWC.put( "data", data );
        newWC.put( "link", new TemplateLink(data) );
        newWC.put( "page", new TemplatePageAttributes(data) );
        newWC.put( "formatter", new WebMacroFormatter(newWC) );
        newWC.put( "content", new ContentURI(data) );
        return newWC;
    }
View Full Code Here

     * @return A ConcreteElement.
     * @exception Exception, a generic exception.
     */
    public ConcreteElement buildTemplate( RunData data ) throws Exception
    {
        WebContext context = getContext(data);

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

        // Template service adds the leading slash, but make it sure.
        if ((templateName.length() > 0) &&
            (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) != '/'))
            {
View Full Code Here

TOP

Related Classes of org.webmacro.servlet.WebContext

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.