Author: mposolda
Date: 2012-01-31 07:27:56 -0500 (Tue, 31 Jan 2012)
New Revision: 8327
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebRequestHandler.java
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/UploadHandler.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/DefaultRequestHandler.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/StaticResourceRequestHandler.java
Log:
JBEPP-1496 WebAppController needs to start RequestLifeCycle for every processing
(including static resource processing)
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebAppController.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -326,12 +326,6 @@
{
while (matcher.hasNext() && !processed)
{
- if (!started)
- {
- RequestLifeCycle.begin(ExoContainerContext.getCurrentContainer());
- started = true;
- }
-
//
Map<QualifiedName, String> parameters = matcher.next();
String handlerKey = parameters.get(HANDLER_PARAM);
@@ -345,12 +339,25 @@
log.debug("Serving request path=" + portalPath +
", parameters=" + parameters + " with handler " + handler);
}
+ if (!started && handler.getRequiresLifeCycle())
+ {
+ if (debug)
+ {
+ log.debug("Starting RequestLifeCycle for handler " +
handler);
+ }
+
RequestLifeCycle.begin(ExoContainerContext.getCurrentContainer());
+ started = true;
+ }
+
//
processed = handler.execute(new ControllerContext(this, router, req,
res, parameters));
}
else
{
- log.debug("No handler " + handlerKey + " for request
path=" + portalPath + ", parameters=" + parameters);
+ if (debug)
+ {
+ log.debug("No handler " + handlerKey + " for
request path=" + portalPath + ", parameters=" + parameters);
+ }
}
}
}
@@ -359,6 +366,10 @@
{
if (started)
{
+ if (debug)
+ {
+ log.debug("Finishing RequestLifeCycle for current request");
+ }
RequestLifeCycle.end();
}
}
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebRequestHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/controller/src/main/java/org/exoplatform/web/WebRequestHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -64,4 +64,12 @@
public void onDestroy(WebAppController controller) throws Exception
{
}
+
+ /**
+ * Flag if particular handler requires lifecycle.
+ *
+ * @return true if processing of particular handler requires to be wrapped
+ * within {@link org.exoplatform.container.component.RequestLifeCycle} block.
+ */
+ protected abstract boolean getRequiresLifeCycle();
}
\ No newline at end of file
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/DownloadHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -98,6 +98,12 @@
}
}
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return false;
+ }
+
private static void optimalRead(InputStream is, OutputStream os) throws Exception
{
int bufferLength = 1024; //TODO: Better to compute bufferLength in term of -Xms,
-Xmx properties
Modified:
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/UploadHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/UploadHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/component/web/server/src/main/java/org/exoplatform/web/handler/UploadHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -124,6 +124,12 @@
}
}
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return false;
+ }
+
public String encodeName(String name) throws Exception
{
String[] arr = name.split(" ");
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/DefaultRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/DefaultRequestHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/DefaultRequestHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -66,4 +66,10 @@
resp.sendRedirect(resp.encodeRedirectURL(s));
return true;
}
+
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return false;
+ }
}
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/LegacyRequestHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -131,4 +131,10 @@
resp.sendRedirect(resp.encodeRedirectURL(s));
return true;
}
+
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return true;
+ }
}
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/PortalRequestHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -244,4 +244,10 @@
((ApplicationRequestPhaseLifecycle) lifecycle).onEndRequestPhase(app,
context, phase);
}
}
+
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return true;
+ }
}
Modified:
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/StaticResourceRequestHandler.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/StaticResourceRequestHandler.java 2012-01-31
12:14:29 UTC (rev 8326)
+++
epp/portal/branches/EPP_5_2_Branch/webui/portal/src/main/java/org/exoplatform/portal/application/StaticResourceRequestHandler.java 2012-01-31
12:27:56 UTC (rev 8327)
@@ -49,4 +49,10 @@
mergedContext.getNamedDispatcher("default").forward(req, res);
return true;
}
+
+ @Override
+ protected boolean getRequiresLifeCycle()
+ {
+ return false;
+ }
}
Show replies by date