Package javax.portlet

Examples of javax.portlet.PortletConfig


public class TestPortletApplicationSpecificationInitializer extends HiveMindTestCase
{
    private PortletConfig newConfig(String name)
    {
        MockControl control = newControl(PortletConfig.class);
        PortletConfig config = (PortletConfig) control.getMock();

        config.getPortletName();
        control.setReturnValue(name);

        return config;
    }
View Full Code Here


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

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

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

        IApplicationSpecification specification = newSpecification();
View Full Code Here

        verifyControls();
    }

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

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

        IApplicationSpecification specification = newSpecification();
View Full Code Here

        verifyControls();
    }

    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");
View Full Code Here

public class PortletConfigStrategy implements DescribableStrategy
{

    public void describeObject(Object object, DescriptionReceiver receiver)
    {
        PortletConfig pc = (PortletConfig) object;

        receiver.title("Portlet Config");

        receiver.property("portletName", pc.getPortletName());

        receiver.section("Init Parameters");

        Iterator i = WebUtils.toSortedList(pc.getInitParameterNames()).iterator();

        while (i.hasNext())
        {
            String name = (String) i.next();
            receiver.property(name, pc.getInitParameter(name));
        }
    }
View Full Code Here

    public void testParseOptionalDescriptors() throws Exception
    {
        MockControl configc = MockControl.createControl(PortletConfig.class);
        addControl(configc);
        PortletConfig config = (PortletConfig) configc.getMock();

        MockControl contextc = MockControl.createControl(PortletContext.class);
        addControl(contextc);
        PortletContext context = (PortletContext) contextc.getMock();

        config.getPortletName();
        configc.setReturnValue("myportlet", 3);

        // Called once in ApplicationPortlet code,
        // then inside PortletWebContextInitializer

        config.getPortletContext();
        configc.setReturnValue(context, 2);

        context.getResource("/WEB-INF/myportlet/hivemodule.xml");
        contextc.setReturnValue(getClass().getResource("hivemodule-portlet.xml"), 2);
View Full Code Here

        PortletApplicationInitializer initializer = newInitializer();
        ActionRequestServicer actionRequestServicer = newActionRequestServicer();
        RenderRequestServicer renderRequestServicer = newRenderRequestServicer();

        Registry registry = newRegistry(initializer, actionRequestServicer, renderRequestServicer);
        PortletConfig config = newConfig();

        initializer.initialize(config);

        replayControls();
View Full Code Here

        ActionRequestServicer actionRequestServicer = newActionRequestServicer();
        RenderRequestServicer renderRequestServicer = newRenderRequestServicer();

        Registry registry = newRegistry(initializer, actionRequestServicer, renderRequestServicer);

        PortletConfig config = newConfig();

        initializer.initialize(config);

        replayControls();
View Full Code Here

        ActionRequestServicer actionRequestServicer = newActionRequestServicer();
        RenderRequestServicer renderRequestServicer = newRenderRequestServicer();

        Registry registry = newRegistry(initializer, actionRequestServicer, renderRequestServicer);

        PortletConfig config = newConfig();

        initializer.initialize(config);

        replayControls();
View Full Code Here

     * @throws PortletException
     * @throws IOException
     */
    protected void executeRenderResult(final String finalLocation) throws PortletException, IOException {
        LOG.debug("Executing result in Render phase");
        PortletConfig cfg = PortletActionContext.getPortletConfig();
        RenderRequest req = PortletActionContext.getRenderRequest();
        RenderResponse res = PortletActionContext.getRenderResponse();
        LOG.debug("PortletConfig: " + cfg);
        LOG.debug("RenderRequest: " + req);
        LOG.debug("RenderResponse: " + res);
        res.setContentType(contentType);
        if (StringUtils.isNotEmpty(title)) {
            res.setTitle(title);
        }
        LOG.debug("Location: " + finalLocation);
        PortletRequestDispatcher preparator = cfg.getPortletContext()
                .getNamedDispatcher("preparator");
        if(preparator == null) {
            throw new PortletException("Cannot look up 'preparator' servlet. Make sure that you" +
                "have configured it correctly in the web.xml file.");
        }
        new IncludeTemplate() {
            protected void when(PortletException e) {
                LOG.error("PortletException while dispatching to 'preparator' servlet", e);
            }
            protected void when(IOException e) {
                LOG.error("IOException while dispatching to 'preparator' servlet", e);
            }
        }.include(preparator, req, res);
        PortletRequestDispatcher dispatcher = cfg.getPortletContext().getRequestDispatcher(finalLocation);
        if(dispatcher == null) {
            throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'");
        }
        new IncludeTemplate() {
            protected void when(PortletException e) {
View Full Code Here

TOP

Related Classes of javax.portlet.PortletConfig

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.