use of org.xwiki.container.RequestInitializerManager in project xwiki-platform by xwiki.
the class DefaultServletContainerInitializer method initializeRequest.
@Override
public void initializeRequest(HttpServletRequest httpServletRequest, Object xwikiContext) throws ServletContainerException {
// 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 ServletRequest(httpServletRequest));
// 2) Create an 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 Container 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();
}
}
// 4) Call the request initializers to populate the Request further.
try {
RequestInitializerManager manager = this.componentManager.getInstance(RequestInitializerManager.class);
manager.initializeRequest(this.container.getRequest());
} catch (Exception e) {
throw new ServletContainerException("Failed to initialize request", e);
}
// 5) Call Execution Context initializers to perform further Execution Context initializations
try {
ExecutionContextManager manager = this.componentManager.getInstance(ExecutionContextManager.class);
manager.initialize(this.execution.getContext());
} catch (Exception e) {
throw new ServletContainerException("Failed to initialize Execution Context", e);
}
}
Aggregations