Package it.eng.spago.base

Examples of it.eng.spago.base.ResponseContainer


        // end modifications by Zerbetto on 25-02-2008: NEW_SESSION parameter can force a new session
    }

    private void render(RequestContextIFace requestContext, Exception serviceException)
            throws Exception {
        ResponseContainer responseContainer = requestContext.getResponseContainer();
      
        Boolean isHttpResponseFreezed = (Boolean) responseContainer
                .getAttribute(Constants.HTTP_RESPONSE_FREEZED);
        if ((isHttpResponseFreezed == null) || (!isHttpResponseFreezed.booleanValue())) {
         
          // Retrieve publisher configuration for current service
            PublisherConfiguration publisherConfig = Publisher.getPublisherConfiguration(requestContext,
View Full Code Here


            TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.CRITICAL,
                "ErrorTag::doStartTag:: httpRequest null");
            throw new JspException("httpRequest nullo");
        } // if (_httpRequest == null)
        //ResponseContainer responseContainer = ResponseContainerPortletAccess.getResponseContainer(httpRequest);
        ResponseContainer responseContainer = ChannelUtilities.getResponseContainer(httpRequest);
        if (responseContainer == null) {
            TracerSingleton.log(SpagoBIConstants.NAME_MODULE, TracerSingleton.CRITICAL,
                "ErrorTag::doStartTag:: responseContainer null");
            throw new JspException("responseContainer null");
        } // if (responseContainer == null)
        StringBuffer output = new StringBuffer();
        EMFErrorHandler engErrorHandler = responseContainer.getErrorHandler();

      Collection errors = engErrorHandler.getErrors();
     
     
      if (!errors.isEmpty()) {
View Full Code Here

            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");
View Full Code Here

    //  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);
View Full Code Here

    // This method is here but it shouldn't be!!!
    // Since a portlet loop render is missing, this method was copied here from HTTPLoopRenderer
  private void prepareRender(RequestContextIFace requestContext, PublisherConfiguration publisher) throws Exception {

    RequestContainer requestContainer = requestContext.getRequestContainer();
    ResponseContainer responseContainer = requestContext.getResponseContainer();

    // Prepare service request for loopback management
        try {
            SourceBean loopbackServiceRequest = new SourceBean(Constants.SERVICE_REQUEST);
            loopbackServiceRequest.setAttribute(Navigator.NAVIGATOR_DISABLED, "TRUE");
           
            SourceBean renderingConfig = publisher.getRenderingConfig();
            List resourcesConfig = renderingConfig.getAttributeAsList("RESOURCES.PARAMETER");
            for (int j = 0; j < resourcesConfig.size(); j++) {
                SourceBean consequence = (SourceBean) resourcesConfig.get(j);
                String parameterName = (String) consequence.getAttribute("NAME");
                String parameterScope = (String) consequence.getAttribute("SCOPE");
                String parameterType = (String) consequence.getAttribute("TYPE");
                String parameterValue = (String) consequence.getAttribute("VALUE");
                Object inParameterValue = null;
                if (parameterType.equalsIgnoreCase("ABSOLUTE"))
                    inParameterValue = parameterValue;
                else {
                  inParameterValue = ContextScooping.getScopedParameter(requestContainer,
                                responseContainer,
                                parameterValue, parameterScope, consequence);
                }
               
                if (inParameterValue == null)
                    continue;
                if (inParameterValue instanceof SourceBean)
                    loopbackServiceRequest.setAttribute((SourceBean) inParameterValue);
                else
                    loopbackServiceRequest.setAttribute(parameterName, inParameterValue);
            } // for (int j = 0; j < consequences.size(); j++)
            responseContainer.setLoopbackServiceRequest(loopbackServiceRequest);
        } // try
        catch (SourceBeanException sbe) {
            TracerSingleton.log(Constants.NOME_MODULO, TracerSingleton.CRITICAL,
                    "Publisher::getPublisher:", sbe);
        } // catch (SourceBeanException sbe)
View Full Code Here

    msgBuilder = MessageBuilderFactory.getMessageBuilder();
    requestContainer = RequestContainerAccess.getRequestContainer(httpRequest);
    SessionContainer spagoSession = requestContainer.getSessionContainer();
    SessionContainer spagoPermSession = spagoSession.getPermanentContainer();
    IEngUserProfile profile = (IEngUserProfile)spagoPermSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    ResponseContainer responseContainer = ResponseContainerAccess.getResponseContainer(httpRequest);
    SourceBean serviceRequest = requestContainer.getServiceRequest();
    SourceBean serviceResponse = responseContainer.getServiceResponse();
    EMFErrorHandler errorHandler = responseContainer.getErrorHandler();
    configuration = ConfigSingleton.getInstance();
    StringBuffer htmlStream = new StringBuffer();
    StringBuffer jsStream = new StringBuffer();
    try{
      makeMenu(htmlStream, jsStream, configuration, profile);
View Full Code Here

    } catch (SourceBeanException e1) {
      logger.error("Source Bean Exception");
      return null;
    }
    RequestContainer reqContainer = new RequestContainer();
    ResponseContainer resContainer = new ResponseContainer();
    reqContainer.setServiceRequest(request);
    resContainer.setServiceResponse(resp);
    DefaultRequestContext defaultRequestContext = new DefaultRequestContext(
        reqContainer, resContainer);
    resContainer.setErrorHandler(new EMFErrorHandler());
    RequestContainer.setRequestContainer(reqContainer);
    ResponseContainer.setResponseContainer(resContainer);
    SessionContainer session = new SessionContainer(true);
    reqContainer.setSessionContainer(session);
    errorHandler = defaultRequestContext.getErrorHandler();
View Full Code Here

   *
   * @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();
   
    Object objServices = config.getFilteredSourceBeanAttribute(
View Full Code Here

            resp = new SourceBean("");
          } catch (SourceBeanException e1) {
            e1.printStackTrace();
          }
          RequestContainer reqContainer = new RequestContainer();
          ResponseContainer resContainer = new ResponseContainer();
          reqContainer.setServiceRequest(request);
          resContainer.setServiceResponse(resp);
          DefaultRequestContext defaultRequestContext = new DefaultRequestContext(
              reqContainer, resContainer);
          resContainer.setErrorHandler(new EMFErrorHandler());
          RequestContainer.setRequestContainer(reqContainer);
          ResponseContainer.setResponseContainer(resContainer);
          Locale locale = new Locale("it","IT","");
          SessionContainer session = new SessionContainer(true);
          reqContainer.setSessionContainer(session);
View Full Code Here

    String country=(String)session.getPermanentContainer().getAttribute(SpagoBIConstants.AF_COUNTRY);
    if(lang!=null && country!=null){
      locale=new Locale(lang,country,"");
    }   
    //defines the chart type for the correct execution
    ResponseContainer responseContainer=ResponseContainer.getResponseContainer();
    EMFErrorHandler errorHandler=responseContainer.getErrorHandler();
    String chartType = getChartType(obj, errorHandler);
    Template templateUtil = new Template();
    try{
      if (chartType != null && chartType.startsWith(HIGHCHART_TEMPLATE)){
        //gets the dataset object informations
View Full Code Here

TOP

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

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.