(ResourceResponse) response);
} else {
Application application = null;
+ boolean transactionStarted = false;
+ boolean requestStarted = false;
+
try {
// TODO What about PARAM_UNLOADBURST & redirectToApplication??
if (application instanceof PortletRequestListener) {
((PortletRequestListener) application).onRequestStart(
request, response);
+ requestStarted = true;
}
/* Start the newly created application */
* end is called in the finally block below.
*/
applicationContext.startTransaction(application, request);
+ transactionStarted = true;
/* Notify listeners */
handleServiceException(request, response, application, e);
} finally {
// Notifies transaction end
- if (application != null) {
- ((PortletApplicationContext2) application.getContext())
- .endTransaction(application, request);
-
- if (application instanceof PortletRequestListener) {
+ try {
+ if (transactionStarted) {
+ ((PortletApplicationContext2) application.getContext())
+ .endTransaction(application, request);
+ }
+ } finally {
+ if (requestStarted) {
((PortletRequestListener) application).onRequestEnd(
request, response);
- }
+ }
}
}
}
}
Application application = null;
+ boolean transactionStarted = false;
+ boolean requestStarted = false;
try {
// If a duplicate "close application" URL is received for an
if (application instanceof HttpServletRequestListener) {
((HttpServletRequestListener) application).onRequestStart(
request, response);
+ requestStarted = true;
}
// Start the newly created application
* is called in the finally block below.
*/
webApplicationContext.startTransaction(application, request);
+ transactionStarted = true;
/* Handle the request */
if (requestType == RequestType.FILE_UPLOAD) {
handleServiceException(request, response, application, e);
} finally {
// Notifies transaction end
- if (application != null) {
- ((WebApplicationContext) application.getContext())
- .endTransaction(application, request);
+ try {
+ if (transactionStarted) {
+ ((WebApplicationContext) application.getContext())
+ .endTransaction(application, request);
- if (application instanceof HttpServletRequestListener) {
+ }
+
+ } finally {
+ if (requestStarted) {
((HttpServletRequestListener) application).onRequestEnd(
request, response);
}
+
}
}