Package org.apache.tapestry.web

Examples of org.apache.tapestry.web.WebContext


    public void testNotFound() throws Exception
    {
        PortletConfig config = newConfig("myportlet");

        MockControl contextc = newControl(WebContext.class);
        WebContext context = (WebContext) contextc.getMock();

        context.getResource("/WEB-INF/myportlet/myportlet.application");
        contextc.setReturnValue(null);

        context.getResource("/WEB-INF/myportlet.application");
        contextc.setReturnValue(null);

        replayControls();

        ApplicationGlobals globals = new ApplicationGlobalsImpl();
View Full Code Here


        return getRequest().getContextPath();
    }

    public Resource getContextRoot()
    {
        WebContext context = (WebContext) getProperty("context");

        return new WebContextResource(context, "/");
    }
View Full Code Here

    private ApplicationGlobals _globals;

    public void initialize(HttpServlet servlet)
    {
        ServletContext servletContext = servlet.getServletContext();
        WebContext context = new ServletWebContext(servletContext);

        _globals.storeContext(context);
    }
View Full Code Here

    private ApplicationGlobals _applicationGlobals;

    public void initialize(PortletConfig portletConfig)
    {
        WebActivator activator = new PortletWebActivator(portletConfig);
        WebContext context = new PortletWebContext(portletConfig
                .getPortletContext());

        _applicationGlobals.storeActivator(activator);
        _applicationGlobals.storeWebContext(context);
    }
View Full Code Here

    private ApplicationGlobals _applicationGlobals;

    public void initialize(PortletConfig portletConfig)
    {
        WebActivator activator = new PortletWebActivator(portletConfig);
        WebContext context = new PortletWebContext(portletConfig.getPortletContext());

        _applicationGlobals.storeActivator(activator);
        _applicationGlobals.storeContext(context);
    }
View Full Code Here

        ClassResolver resolver = new DefaultClassResolver();

        builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(resolver));

        String name = config.getPortletName();
        WebContext context = new PortletWebContext(config.getPortletContext());

        addModuleIfExists(builder, resolver, context, "/WEB-INF/" + name + "/hivemodule.xml");
        addModuleIfExists(builder, resolver, context, "/WEB-INF/hivemodule.xml");

        return builder.constructRegistry(Locale.getDefault());
View Full Code Here

        return (WebContext) newMock(WebContext.class);
    }

    public void testConstructor()
    {
        WebContext context = newContext();

        replayControls();

        Resource r = new WebContextResource(context, "/foo/bar/baz_en.html", Locale.ENGLISH);
View Full Code Here

    }

    public void testLocalizationExists() throws Exception
    {
        MockControl control = newControl(WebContext.class);
        WebContext context = (WebContext) control.getMock();

        context.getResource("/foo/bar/baz_en.html");
        control.setReturnValue(new URL("http://foo.com"));

        replayControls();

        Resource r1 = new WebContextResource(context, "/foo/bar/baz.html");
View Full Code Here

    }

    public void testLocalizationSame() throws Exception
    {
        MockControl control = newControl(WebContext.class);
        WebContext context = (WebContext) control.getMock();

        context.getResource("/foo/bar/baz_en.html");
        control.setReturnValue(null);

        context.getResource("/foo/bar/baz.html");
        control.setReturnValue(new URL("http://foo.com"));

        replayControls();

        Resource r1 = new WebContextResource(context, "/foo/bar/baz.html");
View Full Code Here

    }

    public void testLocalizationMissing() throws Exception
    {
        MockControl control = newControl(WebContext.class);
        WebContext context = (WebContext) control.getMock();

        context.getResource("/foo/bar/baz_en.html");
        control.setReturnValue(null);

        context.getResource("/foo/bar/baz.html");
        control.setReturnValue(null);

        replayControls();

        Resource r1 = new WebContextResource(context, "/foo/bar/baz.html");
View Full Code Here

TOP

Related Classes of org.apache.tapestry.web.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.