PortletTracer.info(Constants.NOME_MODULO, "AdapterPortlet", "processService", "Invocato");
try {
SourceBean serviceRequest = null;
EMFErrorHandler emfErrorHandler = null;
RequestContainer requestContainer = new RequestContainer();
RequestContainer.setRequestContainer(requestContainer);
ResponseContainer responseContainer = new ResponseContainer();
ResponseContainer.setResponseContainer(responseContainer);
RequestContextIFace requestContext = new DefaultRequestContext(requestContainer,
responseContainer);
// try to get from the request the loopback attribute. If present the method has to serve
// a loopback request (the method has been called from the doRenderService)
// if not present is a normal request
boolean isLoop = request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null;
if(isLoop) {
// remove from the request the loopback attribute
request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
//String responseContainerName = (String)request.getAttribute(Constants.RESPONSE_CONTAINER);
//**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
// get from the session the previous response container name
//String responseContainerName = (String)request.getPortletSession().getAttribute(RESPONSE_CONTAINER_NAME);
// get from the session the previous response container
//ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(responseContainerName);
ResponseContainer loopbackResponseContainer = (ResponseContainer)request.getPortletSession().getAttribute(Constants.RESPONSE_CONTAINER);
//**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
TracerSingleton.log(
Constants.NOME_MODULO,
TracerSingleton.DEBUG,
"AdapterPortlet::service: loop-back rilevato");
serviceRequest =
loopbackResponseContainer.getLoopbackServiceRequest();
if (serviceRequest == null)
serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
else {
Object newServiceRequest =
serviceRequest.getAttribute(Constants.SERVICE_REQUEST);
if ((newServiceRequest != null)
&& (newServiceRequest instanceof SourceBean))
serviceRequest = (SourceBean) newServiceRequest;
} // if (serviceRequest == null)
emfErrorHandler = loopbackResponseContainer.getErrorHandler();
if (emfErrorHandler == null)
emfErrorHandler = new EMFErrorHandler();
} // if (isLoop)
else {
monitor = MonitorFactory.start("controller.adapter.portlet");
serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
requestContainer.setServiceRequest(serviceRequest);
boolean isMultipart = false;
// only an ActionRequest can have a multipart content
if (request instanceof ActionRequest && PortletFileUpload.isMultipartContent((ActionRequest) request)) {
isMultipart = true;
}
if (isMultipart) {
handleMultipartForm((ActionRequest) request, requestContext);
} else {
handleSimpleForm(request, requestContext);
}
// ***************** START SERVICE ***********************************************
String actionName = (String) request.getAttribute("ACTION_NAME");
if(actionName!=null) {
request.removeAttribute("ACTION_NAME");
serviceRequest.setAttribute("ACTION_NAME", actionName);
serviceRequest.setAttribute(NEW_SESSION, "TRUE");
}
String page = (String)request.getAttribute("PAGE");
if(page!=null) {
request.removeAttribute("PAGE");
serviceRequest.setAttribute("PAGE", page);
serviceRequest.setAttribute(NEW_SESSION, "TRUE");
}
// *******************************************************************************************
emfErrorHandler = new EMFErrorHandler();
}
//***************** NAVIGATION CONTROL *******************************************************
String navigation = getInitParameter("light_navigation");
if ("enabled".equalsIgnoreCase(navigation)) {
serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
}
//updates service request after LightNavigationManager control
requestContainer.setServiceRequest(serviceRequest);
//********************************************************************************************
boolean isRequestedSessionIdValid = true;
PortletSession session = request.getPortletSession(true);
/*
if (session.isNew()) {
String newSessionString =
(String) (serviceRequest.getAttribute(NEW_SESSION));
isRequestedSessionIdValid =
((newSessionString != null)
&& (newSessionString.equalsIgnoreCase("TRUE")));
} // if (session.isNew())
*/
synchronized (session) {
// try to get the previous request container. Download from the session the previous
// request container name and if it isn't null (it's null only formthe first invocation)
//use it for download the request container object
RequestContainer parentRequestContainer = null;
//**************** START MODFIFICATION ZERBETTO 09-10-2006 ****************
//String parentRequestContainerName =
// (String) session.getAttribute(REQUEST_CONTAINER_NAME);
//if(parentRequestContainerName != null) {
// parentRequestContainer = (RequestContainer) session.getAttribute(parentRequestContainerName);
//}
parentRequestContainer = (RequestContainer) session.getAttribute(Constants.REQUEST_CONTAINER);
//**************** END MODFIFICATION ZERBETTO 09-10-2006 ****************
if (!Navigator.isNavigatorEnabled()) {
if (parentRequestContainer == null)
requestContainer.setSessionContainer(
new PortletSessionContainer(true));
else
requestContainer.setSessionContainer(
parentRequestContainer.getSessionContainer());
}
else {
if (parentRequestContainer == null)
requestContainer.setSessionContainer(
new PortletSessionContainer(true));