Package it.eng.spago.base

Examples of it.eng.spago.base.RequestContainer


            EMFExceptionHandler exceptionHandler = new EMFExceptionHandler();
           
            // Retrieve LOOP responseContainer, if any
            ResponseContainer loopbackResponseContainer = ResponseContainer.getResponseContainer();
           
            RequestContainer requestContainer = new RequestContainer();
            RequestContainer.setRequestContainer(requestContainer);
           
            ResponseContainer responseContainer = new ResponseContainer();
            ResponseContainer.setResponseContainer(responseContainer);
           
            requestContext = new DefaultRequestContext(requestContainer,
                    responseContainer);
           
            // Retrieve HTTP session
            HttpSession session = request.getSession(true);

          eventNotifier = EventNotifierFactory.getEventNotifier();
          eventNotifier.notifyEvent(
                new ServiceStartEvent(session),
                requestContext);           
          // Trace only after calling listener, so the session id can be written on log files
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: invocato");

            boolean loopback = (request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null);
            if (loopback) {
                TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                "AdapterHTTP::service: loop-back rilevato");

                // remove from the request the loopback attribute
              request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
           
                loopbackResponseContainer = ResponseContainerAccess.getResponseContainer(request);
                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)
                requestContainer.setServiceRequest(serviceRequest);
               
                // The errors are kept in loop mode, so retrieve old error handler
                emfErrorHandler = loopbackResponseContainer.getErrorHandler();
               
                if (emfErrorHandler == null) {
                    emfErrorHandler = new EMFErrorHandler();
                }
            } // if (loopbackResponseContainer != null)
            else {
                monitor = MonitorFactory.start("controller.adapter.http");
                serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                requestContainer.setServiceRequest(serviceRequest);

                // Get header parameter before parsing the request
                setHttpRequestData(request, requestContainer);
               
                // Check if the service was invoked with the .action or .page URL
                handleServiceName(serviceRequest, requestContainer);
               
                boolean isMultipart = ServletFileUpload.isMultipartContent(new ServletRequestContext(request));
                if (isMultipart) {
                  handleMultipartForm(request, requestContext);
                } else {
                  handleSimpleForm(request, requestContext);
                }

                emfErrorHandler = new EMFErrorHandler();
            } // if (loopbackResponseContainer != null) else

           
            //***************** NAVIGATION CONTROL *******************************************************
            serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
            requestContainer.setServiceRequest(serviceRequest);
            //********************************************************************************************
           
            Exception serviceException = null;
            CoordinatorIFace coordinator = null;
            try {
              responseContainer.setErrorHandler(emfErrorHandler);
             
              String channelType = Constants.HTTP_CHANNEL;
              String channelTypeParameter = (String) (serviceRequest
                      .getAttribute(Constants.CHANNEL_TYPE));
              String channelTypeHeader = (String) (requestContainer.getAttribute(HTTP_ACCEPT_HEADER));
              if (((channelTypeParameter != null) && channelTypeParameter
                      .equalsIgnoreCase(Constants.WAP_CHANNEL))
                      || ((channelTypeHeader != null) && (channelTypeHeader.indexOf(WAP_MIME_TYPE) != -1)))
                  channelType = Constants.WAP_CHANNEL;
              requestContainer.setChannelType(channelType);
              requestContainer.setInternalRequest(request);
              requestContainer.setInternalResponse(response);
              requestContainer.setAdapterConfig(getServletConfig());
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: requestContainer", requestContainer);
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: sessionContainer", requestContainer
                              .getSessionContainer());
 
              SourceBean serviceResponse = new SourceBean(Constants.SERVICE_RESPONSE);
              responseContainer.setServiceResponse(serviceResponse);

              checkSession(session, requestContext);
                Navigator.checkNavigation(requestContainer);
             
              // Refresh service request because Navigator services can changed it
              serviceRequest = requestContainer.getServiceRequest();
             
              // Suspend/Resume service
              handleSuspendResume(serviceRequest, requestContainer);
             
              coordinator = DispatcherManager.getCoordinator(requestContext);
              if (coordinator == null) {
                  TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.WARNING,
                          "AdapterHTTP::service: coordinator nullo !");
                  serviceException = new Exception("Coordinatore non trovato");
                  emfErrorHandler.addError(new EMFInternalError(EMFErrorSeverity.ERROR,
                          "Coordinatore non trovato !"));
              } // if (coordinator == null)
              else {
                  ((RequestContextIFace) coordinator).setRequestContext(requestContext);
                  responseContainer.setBusinessType(coordinator.getBusinessType());
                  responseContainer.setBusinessName(coordinator.getBusinessName());
                  responseContainer.setPublisherName(coordinator.getPublisherName());
                      coordinator.service(serviceRequest, serviceResponse);
                     
                    ((RequestContextIFace) coordinator).setRequestContext(null);
//                    requestContainer.setInternalRequest(null);
              } // if (coordinator == null) else

            } // try
            catch (Exception ex) {
              ServiceIFace service = (coordinator != null)? coordinator.getService() : null;
              exceptionHandler.handleException(ex, service, requestContext);
            } // catch (Exception ex)
           
//            requestContainer.setInternalResponse(null);
//            requestContainer.setAdapterConfig(null);
            // nel caso in cui sia attiva la persistenza della sessione
            // forza la scrittura sul database
            synchronized (session) {
                session.setAttribute(Constants.REQUEST_CONTAINER, session.getAttribute(Constants.REQUEST_CONTAINER));
            } // synchronized (session)
           
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: responseContainer", responseContainer);
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: sessionContainer", requestContainer
                            .getSessionContainer());

            if (serializeSession) {
                TracerSingleton
                        .log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                                "AdapterHTTP::service: sessionContainer size ["
                                        + Serializer.serialize(requestContainer
                                                .getSessionContainer()).length + "]");
            }

            render(requestContext, serviceException);
        } // try
View Full Code Here


      throws SessionExpiredException {
     
      // start modifications by Zerbetto on 25-02-2008: NEW_SESSION parameter can force a new session
        boolean isRequestedSessionIdValid = true;
        boolean isRequiredNewSession = false;    // Zerbetto on 25-02-2008
        RequestContainer requestContainer = requestContext.getRequestContainer();
               
        if (session.isNew()) {
            isRequestedSessionIdValid = (requestContainer.getAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID) == null);
          String newSessionRequestAttr = (String) requestContainer.getServiceRequest().getAttribute(NEW_SESSION); // Zerbetto on 25-02-2008
          isRequiredNewSession = newSessionRequestAttr != null && newSessionRequestAttr.equalsIgnoreCase("TRUE"); // Zerbetto on 25-02-2008
        } // if (session.isNew())
        synchronized (session) {
            RequestContainer parentRequestContainer = (RequestContainer) session
                    .getAttribute(Constants.REQUEST_CONTAINER);
            if (!Navigator.isNavigatorEnabled()) {
                if (parentRequestContainer == null)
                    requestContainer.setSessionContainer(new SessionContainer(true));
                else
                    requestContainer.setSessionContainer(parentRequestContainer
                            .getSessionContainer());
            }
            else {
                if (parentRequestContainer == null)
                    requestContainer.setSessionContainer(new SessionContainer(true));
View Full Code Here

    responseContainer = ChannelUtilities.getResponseContainer(httpRequest);
    urlBuilder = UrlBuilderFactory.getUrlBuilder();
    msgBuilder = MessageBuilderFactory.getMessageBuilder();
    TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.DEBUG,
                    "ScriptWizardTag::doStartTag:: invoked");
    RequestContainer aRequestContainer = RequestContainer.getRequestContainer();
        SessionContainer aSessionContainer = aRequestContainer.getSessionContainer();
        SessionContainer permanentSession = aSessionContainer.getPermanentContainer();
    IEngUserProfile userProfile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

      currTheme=ThemesManager.getCurrentTheme(requestContainer);
      if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
View Full Code Here

      httpRequest = (HttpServletRequest) pageContext.getRequest();
      requestContainer = ChannelUtilities.getRequestContainer(httpRequest);
      responseContainer = ChannelUtilities.getResponseContainer(httpRequest);
      urlBuilder = UrlBuilderFactory.getUrlBuilder();
      msgBuilder = MessageBuilderFactory.getMessageBuilder();
      RequestContainer aRequestContainer = RequestContainer.getRequestContainer();
          SessionContainer aSessionContainer = aRequestContainer.getSessionContainer();
          SessionContainer permanentSession = aSessionContainer.getPermanentContainer();
      IEngUserProfile userProfile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

        currTheme=ThemesManager.getCurrentTheme(requestContainer);
        if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
View Full Code Here

   * @return a boolean value which says if conditions are verified.
   *
   * @throws Exception if an exception occurs.
   */
  public boolean validate(String serviceType, String serviceName, RequestContextIFace context)  {
    RequestContainer requestContainer = context.getRequestContainer();
    ResponseContainer responseContainer = context.getResponseContainer();
    _serviceName = serviceName;
    _serviceType = serviceType;
    ConfigSingleton config = ConfigSingleton.getInstance();
   
View Full Code Here

   * @return the list i face
   *
   * @throws Exception the exception
   */
  public ListIFace filterListForCorrelatedParam(SourceBean request, ListIFace list, HttpServletRequest httpRequest) throws Exception {
    RequestContainer reqCont = ChannelUtilities.getRequestContainer(httpRequest);
    ResponseContainer respCont = ChannelUtilities.getResponseContainer(httpRequest);
    errorHand = respCont.getErrorHandler();
    SessionContainer sessionCont = reqCont.getSessionContainer();
    contextManager = new CoreContextManager(new SpagoBISessionContainer(sessionCont),
        new LightNavigatorContextRetrieverStrategy(request));
    // get biobject from the session
    ExecutionInstance instance = contextManager.getExecutionInstance(ExecutionInstance.class.getName());
    BIObject obj = instance.getBIObject();
View Full Code Here

            EMFExceptionHandler exceptionHandler = new EMFExceptionHandler();
           
            // Retrieve LOOP responseContainer, if any
            ResponseContainer loopbackResponseContainer = ResponseContainer.getResponseContainer();
           
            RequestContainer requestContainer = new RequestContainer();
            RequestContainer.setRequestContainer(requestContainer);
           
            ResponseContainer responseContainer = new ResponseContainer();
            ResponseContainer.setResponseContainer(responseContainer);
           
            requestContext = new DefaultRequestContext(requestContainer,
                    responseContainer);
           
            // Retrieve HTTP session
            HttpSession session = request.getSession(true);

          eventNotifier = EventNotifierFactory.getEventNotifier();
          eventNotifier.notifyEvent(
                new ServiceStartEvent(session),
                requestContext);
           
          // Trace only after calling listener, so the session id can be written on log files
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: invocato");

            boolean loopback = (request.getAttribute(Constants.PUBLISHING_MODE_LOOPBACK) != null);
            if (loopback) {
                TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                "AdapterHTTP::service: loop-back rilevato");

                // remove from the request the loopback attribute
              request.removeAttribute(Constants.PUBLISHING_MODE_LOOPBACK);
           
                loopbackResponseContainer = ResponseContainerAccess.getResponseContainer(request);
                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)
                requestContainer.setServiceRequest(serviceRequest);
               
                // The errors are kept in loop mode, so retrieve old error handler
                emfErrorHandler = loopbackResponseContainer.getErrorHandler();
               
                if (emfErrorHandler == null) {
                    emfErrorHandler = new EMFErrorHandler();
                }
            } // if (loopbackResponseContainer != null)
            else {
                monitor = MonitorFactory.start("controller.adapter.http");
                serviceRequest = new SourceBean(Constants.SERVICE_REQUEST);
                requestContainer.setServiceRequest(serviceRequest);

                // Get header parameter before parsing the request
                setHttpRequestData(request, requestContainer);
               
                // Check if the service was invoked with the .action or .page URL
                handleServiceName(serviceRequest, requestContainer);
               
                boolean isMultipart = ServletFileUpload.isMultipartContent(new ServletRequestContext(request));
                if (isMultipart) {
                  handleMultipartForm(request, requestContext);
                } else {
                  handleSimpleForm(request, requestContext);
                }

                emfErrorHandler = new EMFErrorHandler();
            } // if (loopbackResponseContainer != null) else

           
            //***************** NAVIGATION CONTROL *******************************************************
            serviceRequest = LightNavigationManager.controlLightNavigation(request, serviceRequest);
            requestContainer.setServiceRequest(serviceRequest);
            //********************************************************************************************
           
            Exception serviceException = null;
            CoordinatorIFace coordinator = null;
            try {
              responseContainer.setErrorHandler(emfErrorHandler);
             
              String channelType = Constants.HTTP_CHANNEL;
              String channelTypeParameter = (String) (serviceRequest
                      .getAttribute(Constants.CHANNEL_TYPE));
              String channelTypeHeader = (String) (requestContainer.getAttribute(HTTP_ACCEPT_HEADER));
              if (((channelTypeParameter != null) && channelTypeParameter
                      .equalsIgnoreCase(Constants.WAP_CHANNEL))
                      || ((channelTypeHeader != null) && (channelTypeHeader.indexOf(WAP_MIME_TYPE) != -1)))
                  channelType = Constants.WAP_CHANNEL;
              requestContainer.setChannelType(channelType);
              requestContainer.setInternalRequest(request);
              requestContainer.setInternalResponse(response);
              requestContainer.setAdapterConfig(getServletConfig());
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: requestContainer", requestContainer);
              TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                      "AdapterHTTP::service: sessionContainer", requestContainer
                              .getSessionContainer());
 
              SourceBean serviceResponse = new SourceBean(Constants.SERVICE_RESPONSE);
              responseContainer.setServiceResponse(serviceResponse);

              checkSession(session, requestContext);
                Navigator.checkNavigation(requestContainer);
             
              // Refresh service request because Navigator services can changed it
              serviceRequest = requestContainer.getServiceRequest();
             
              // Suspend/Resume service
              handleSuspendResume(serviceRequest, requestContainer);
             
              coordinator = DispatcherManager.getCoordinator(requestContext);
              if (coordinator == null) {
                  TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.WARNING,
                          "AdapterHTTP::service: coordinator nullo !");
                  serviceException = new Exception("Coordinatore non trovato");
                  emfErrorHandler.addError(new EMFInternalError(EMFErrorSeverity.ERROR,
                          "Coordinatore non trovato !"));
              } // if (coordinator == null)
              else {
                  ((RequestContextIFace) coordinator).setRequestContext(requestContext);
                  responseContainer.setBusinessType(coordinator.getBusinessType());
                  responseContainer.setBusinessName(coordinator.getBusinessName());
                  responseContainer.setPublisherName(coordinator.getPublisherName());
                      coordinator.service(serviceRequest, serviceResponse);
                     
                    ((RequestContextIFace) coordinator).setRequestContext(null);
//                    requestContainer.setInternalRequest(null);
              } // if (coordinator == null) else

            } // try
            catch (Exception ex) {
              ServiceIFace service = (coordinator != null)? coordinator.getService() : null;
              exceptionHandler.handleException(ex, service, requestContext);
            } // catch (Exception ex)
           
//            requestContainer.setInternalResponse(null);
//            requestContainer.setAdapterConfig(null);
            // nel caso in cui sia attiva la persistenza della sessione
            // forza la scrittura sul database
            synchronized (session) {
                session.setAttribute(Constants.REQUEST_CONTAINER, session.getAttribute(Constants.REQUEST_CONTAINER));
            } // synchronized (session)
           
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: responseContainer", responseContainer);
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                    "AdapterHTTP::service: sessionContainer", requestContainer
                            .getSessionContainer());

            if (serializeSession) {
                TracerSingleton
                        .log(Constants.NOME_MODULO, TracerSingleton.DEBUG,
                                "AdapterHTTP::service: sessionContainer size ["
                                        + Serializer.serialize(requestContainer
                                                .getSessionContainer()).length + "]");
            }

            render(requestContext, serviceException);
        } // try
View Full Code Here

      throws SessionExpiredException {
     
      // start modifications by Zerbetto on 25-02-2008: NEW_SESSION parameter can force a new session
        boolean isRequestedSessionIdValid = true;
        boolean isRequiredNewSession = false;    // Zerbetto on 25-02-2008
        RequestContainer requestContainer = requestContext.getRequestContainer();
               
        if (session.isNew()) {
            isRequestedSessionIdValid = (requestContainer.getAttribute(HTTP_REQUEST_REQUESTED_SESSION_ID) == null);
          String newSessionRequestAttr = (String) requestContainer.getServiceRequest().getAttribute(NEW_SESSION); // Zerbetto on 25-02-2008
          isRequiredNewSession = newSessionRequestAttr != null && newSessionRequestAttr.equalsIgnoreCase("TRUE"); // Zerbetto on 25-02-2008
        } // if (session.isNew())
        synchronized (session) {
            RequestContainer parentRequestContainer = (RequestContainer) session
                    .getAttribute(Constants.REQUEST_CONTAINER);
            if (!Navigator.isNavigatorEnabled()) {
                if (parentRequestContainer == null)
                    requestContainer.setSessionContainer(new SessionContainer(true));
                else
                    requestContainer.setSessionContainer(parentRequestContainer
                            .getSessionContainer());
            }
            else {
                if (parentRequestContainer == null)
                    requestContainer.setSessionContainer(new SessionContainer(true));
View Full Code Here

      //if (execCtrl.directExecution()) {
    ExecutionProxy proxy = new ExecutionProxy();
    proxy.setBiObject(biobj);
   
    IEngUserProfile profile = null;
    RequestContainer reqCont = RequestContainer.getRequestContainer();
    SessionContainer sessCont = reqCont.getSessionContainer();
    SessionContainer permSess = sessCont.getPermanentContainer();
    profile = (IEngUserProfile) permSess.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

    if (profile == null) {
     
View Full Code Here

    httpRequest = (HttpServletRequest) pageContext.getRequest();
    requestContainer = ChannelUtilities.getRequestContainer(httpRequest);
    responseContainer = ChannelUtilities.getResponseContainer(httpRequest);
    urlBuilder = UrlBuilderFactory.getUrlBuilder();
    msgBuilder = MessageBuilderFactory.getMessageBuilder();
    RequestContainer aRequestContainer = RequestContainer.getRequestContainer();
        SessionContainer aSessionContainer = aRequestContainer.getSessionContainer();
        SessionContainer permanentSession = aSessionContainer.getPermanentContainer();
    IEngUserProfile userProfile = (IEngUserProfile)permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);

      currTheme=ThemesManager.getCurrentTheme(requestContainer);
      if(currTheme==null)currTheme=ThemesManager.getDefaultTheme();
View Full Code Here

TOP

Related Classes of it.eng.spago.base.RequestContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.