// get the request (wrapped if contains multipart-form data)
RenderRequest request = req;
// Get the cocoon engine instance
Cocoon cocoon = getCocoon();
// Check if cocoon was initialized
if (cocoon == null) {
manageException(request, res, null, null,
"Initialization Problem",
null /* "Cocoon was not initialized" */,
null /* "Cocoon was not initialized, cannot process request" */,
this.exception);
return;
}
// We got it... Process the request
String servletPath = this.servletPath;
if (servletPath == null) {
servletPath = "portlets/" + getPortletConfig().getPortletName();
}
String pathInfo = getPathInfo(request);
String uri = servletPath;
if (pathInfo != null) {
uri += pathInfo;
}
String contentType = null;
ContextMap ctxMap = null;
Environment env;
try {
if (uri.charAt(0) == '/') {
uri = uri.substring(1);
}
env = getEnvironment(servletPath, pathInfo, uri, request, res);
} catch (Exception e) {
if (getLogger().isErrorEnabled()) {
getLogger().error("Problem with Cocoon portlet", e);
}
manageException(request, res, null, uri,
"Problem in creating the Environment", null, null, e);
return;
}
try {
try {
// Initialize a fresh log context containing the object model: it
// will be used by the CocoonLogFormatter
ctxMap = ContextMap.getCurrentContext();
// Add thread name (default content for empty context)
String threadName = Thread.currentThread().getName();
ctxMap.set("threadName", threadName);
// Add the object model
ctxMap.set("objectModel", env.getObjectModel());
// Add a unique request id (threadName + currentTime
ctxMap.set("request-id", threadName + System.currentTimeMillis());
if (cocoon.process(env)) {
} else {
// We reach this when there is nothing in the processing change that matches
// the request. For example, no matcher matches.
getLogger().fatalError("The Cocoon engine failed to process the request.");
manageException(request, res, env, uri,