// responseContainer = (ResponseContainer)session.getAttribute(responseContainerName);
//else
// TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.INFORMATION, "AdapterPortlet::doView: responseContainerName nullo");
// if request container is not null set into RequestContainer ThreadLocal variable
RequestContainer requestContainer = (RequestContainer)session.getAttribute(Constants.REQUEST_CONTAINER);
ResponseContainer responseContainer = (ResponseContainer)session.getAttribute(Constants.RESPONSE_CONTAINER);
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.DEBUG,
"AdapterPortlet::doView: request container retrieved from session: " + requestContainer);
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.DEBUG,
"AdapterPortlet::doView: response container retrieved from session: " + responseContainer);
//**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
if(requestContainer != null)
RequestContainer.setRequestContainer(requestContainer);
Boolean isHttpResponseFreezed = null;
if (responseContainer != null)
isHttpResponseFreezed = (Boolean) responseContainer.getAttribute(
Constants.HTTP_RESPONSE_FREEZED);
if ((isHttpResponseFreezed == null)
|| (!isHttpResponseFreezed.booleanValue())) {
String resource = null;
// if requestContainer and responseContainer are null meansthat is the first invocation of
// the doView method, so it's necessaty to get from the portlet configuration the type
// of service to execute
if (requestContainer == null && responseContainer == null) {
// ***************** START SERVICE ***********************************************
String serviceType = getPortletConfig().getInitParameter(SERVICE_TYPE);
String serviceName = getPortletConfig().getInitParameter(SERVICE_NAME);
if(serviceType==null) {
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.CRITICAL,
"AdapterPortlet::doView: type of start service not find (ACTION/PAGE/JSP)");
//System.out.println("AdapterPortlet::doView: type of start service not find (ACTION/PAGE/JSP)");
}
if(!serviceType.equalsIgnoreCase(SERVICE_JSP) &&
!serviceType.equalsIgnoreCase(SERVICE_ACTION) &&
!serviceType.equalsIgnoreCase(SERVICE_PAGE) ) {
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.CRITICAL,
"AdapterPortlet::doView: type of start service unknow (ACTION/PAGE/JSP)");
//System.out.println("AdapterPortlet::doView: type of start service unknow (ACTION/PAGE/JSP)");
return;
}
if(serviceName==null) {
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.CRITICAL,
"AdapterPortlet::doView: name of start service not find");
//System.out.println("AdapterPortlet::doView: name of start service not find");
return;
}
if(serviceType.equalsIgnoreCase(SERVICE_JSP)) {
RouterPortlet router = new RouterPortlet(serviceName);
try {
router.route(getPortletContext(), request, response);
} catch (Exception ex) {
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.CRITICAL,
"AdapterPortlet::doView: Error during the route to " + serviceName, ex);
// System.out.println("AdapterPortlet::doView: Error during the route to "
// + serviceName + " (see log file)");
}
} else {
if(serviceType.equalsIgnoreCase(SERVICE_ACTION)) {
request.setAttribute("ACTION_NAME", serviceName);
} else {
request.setAttribute("PAGE", serviceName);
}
try{
//**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
//HashMap map = (HashMap)processService(request, response);
//requestContainerName = (String) map.get(REQUEST_CONTAINER_NAME);
//responseContainerName = (String) map.get(RESPONSE_CONTAINER_NAME);
// the new request and response name are set into the session and into the request
// for the recursive call to the doRenderService
//session.setAttribute(REQUEST_CONTAINER_NAME, requestContainerName);
//session.setAttribute(RESPONSE_CONTAINER_NAME, responseContainerName);
//request.setAttribute(REQUEST_CONTAINER_NAME, requestContainerName);
//request.setAttribute(RESPONSE_CONTAINER_NAME, responseContainerName);
processService(request, response);
//**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
// recall the method for presentation
doRenderService(request, response);
return;
} catch (Exception e) {
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.CRITICAL,
"AdapterPortlet::doView: Error during the process of the "
+ serviceType + " service " + serviceName, e);
// System.out.println("AdapterPortlet::doView: Error during the process of the "
// + serviceType + " service " + serviceName + " (see log file)");
}
}
// *******************************************************************
} else {
Exception serviceException = (Exception)responseContainer.getAttribute(PORTLET_EXCEPTION);
RequestContextIFace requestContext =
new DefaultRequestContext(requestContainer, responseContainer);
PublisherConfiguration publisher =
Publisher.getPublisherConfiguration(requestContext,
serviceException);