Search in sources :

Example 1 with RequestInitializerException

use of org.xwiki.container.RequestInitializerException in project xwiki-platform by xwiki.

the class DefaultPortletContainerInitializer method initializeRequest.

@Override
public void initializeRequest(javax.portlet.PortletRequest portletRequest, Object xwikiContext) throws PortletContainerException {
    // 1) Create an empty request. From this point forward request initializers can use the
    // Container object to get any data they want from the Request.
    this.container.setRequest(new PortletRequest(portletRequest));
    // 2) Create en empty Execution context so that the Container initializers can put things in the
    // execution context when they execute.
    this.execution.setContext(new ExecutionContext());
    // XWikiContext object whereas new code uses the ExecutionContext found in the Execution component.
    if (xwikiContext != null) {
        ExecutionContext ec = this.execution.getContext();
        String key = "xwikicontext";
        if (ec.hasProperty(key)) {
            ec.setProperty(key, xwikiContext);
        } else {
            ec.newProperty(key).inherited().initial(xwikiContext).declare();
        }
    }
    // initializers.
    try {
        this.requestInitializerManager.initializeRequest(this.container.getRequest());
    } catch (RequestInitializerException e) {
        throw new PortletContainerException("Failed to initialize request", e);
    }
    // 5) Call Execution Context initializers to perform further Execution Context initializations
    try {
        this.executionContextManager.initialize(this.execution.getContext());
    } catch (ExecutionContextException e) {
        throw new PortletContainerException("Failed to initialize Execution Context", e);
    }
}
Also used : PortletRequest(org.xwiki.container.portlet.PortletRequest) ExecutionContext(org.xwiki.context.ExecutionContext) RequestInitializerException(org.xwiki.container.RequestInitializerException) PortletContainerException(org.xwiki.container.portlet.PortletContainerException) ExecutionContextException(org.xwiki.context.ExecutionContextException)

Aggregations

RequestInitializerException (org.xwiki.container.RequestInitializerException)1 PortletContainerException (org.xwiki.container.portlet.PortletContainerException)1 PortletRequest (org.xwiki.container.portlet.PortletRequest)1 ExecutionContext (org.xwiki.context.ExecutionContext)1 ExecutionContextException (org.xwiki.context.ExecutionContextException)1