Package org.jasig.portal.channels.error

Examples of org.jasig.portal.channels.error.CError


                + errorCode + " message: " + message + " and throwable [" + t +"]",t);

        channelTable.remove(channelSubscribeId);
        rendererTable.remove(channelSubscribeId);

        CError errorChannel =
            new CError(errorCode,t,channelSubscribeId,oldInstance,message);
        if(setRuntimeData) {
            ChannelRuntimeData rd=new ChannelRuntimeData();
            rd.setBrowserInfo(browserInfo);
            if (localeManager != null)  {
                rd.setLocales(localeManager.getLocales());
            }
           
            final PortalControlStructures pcs = this.getPortalControlStructuresForChannel(request, response, channelSubscribeId);
           
      rd.setRemoteAddress(pcs.getHttpServletRequest().getRemoteAddr());
            rd.setHttpRequestMethod(pcs.getHttpServletRequest().getMethod());
            UPFileSpec up=new UPFileSpec(uPElement);
            up.setTargetNodeId(channelSubscribeId);
            rd.setUPFile(up);
            try {
                errorChannel.setRuntimeData(rd);
                errorChannel.setPortalControlStructures(pcs);
            } catch (Throwable e) {

                log.error("Encountered an exception while trying to set runtime data or portal control structures on the error channel!", e);
            }
        }
View Full Code Here


        // check if the user has permissions to instantiate this channel

        final IChannel channel;
        if(authorizationPrincipal.canRender(Integer.parseInt(channelPublishId))) {
      if (request == null) {
                channel = new CError(ErrorCode.GENERAL_ERROR, "Unable to get SessionId. No HttpServletRequest provided.", channelSubscribeId, null);
            }
            else {
                final HttpSession session = request.getSession();
                final String sessionId = session.getId();
                channel = ChannelFactory.instantiateLayoutChannel(channelDescription, sessionId);

                if (channel == null) {
                    throw new IllegalStateException("ChannelFactory returned null on request to instantiate layout channel with id [" + sessionId + "] and description [" + channelDescription + "]");
                }

                final IPerson person = userPreferencesManager.getPerson();
               
                final ApplicationEventPublisher applicationEventPublisher = EventPublisherLocator.getApplicationEventPublisher();
                final UserProfile currentProfile = userPreferencesManager.getCurrentProfile();
               
                IUserLayoutNodeDescription parentNode = null;
                try {
                    final IUserLayoutManager userLayoutManager = userPreferencesManager.getUserLayoutManager();
                   
                    final String parentNodeId = userLayoutManager.getParentId(channelDescription.getId());
                    if (parentNodeId != null) {
                        parentNode = userLayoutManager.getNode(parentNodeId);
                    }
                }
                catch (PortalException pe) {
                    log.warn("Failed to load parent IUserLayoutNodeDescription for channel with subscribe id: " + channelDescription.getChannelPublishId(), pe);
                }
                applicationEventPublisher.publishEvent(new ChannelInstanciatedInLayoutPortalEvent(this, person, currentProfile, channelDescription, parentNode));

                // Create and stuff the channel static data
                final ChannelStaticData channelStaticData = new ChannelStaticData(channelDescription.getParameterMap(), userPreferencesManager.getUserLayoutManager());
                channelStaticData.setChannelSubscribeId(channelSubscribeId);
                channelStaticData.setTimeout(channelDescription.getTimeout());
                channelStaticData.setPerson(person);
                channelStaticData.setJNDIContext(channelContext);
                channelStaticData.setICCRegistry(new ICCRegistry(this, channelSubscribeId));
                channelStaticData.setChannelPublishId(channelDescription.getChannelPublishId());
                channelStaticData.setSerializerName(serializerName);
                channelStaticData.setWebApplicationContext(PortalApplicationContextLocator.getRequiredWebApplicationContext());

                if (channel instanceof IPrivileged) {
                    this.feedPortalControlStructuresToChannel(request, response, channelSubscribeId, (IPrivileged)channel);
                }

                channel.setStaticData(channelStaticData);
            }
        }
        else {
            // user is not authorized to instantiate this channel
            // create an instance of an error channel instead
            channel = new CError(ErrorCode.CHANNEL_AUTHORIZATION_EXCEPTION, "You don't have authorization to render this channel.", channelSubscribeId, null);
        }

        this.channelTable.put(channelSubscribeId, channel);
        return channel;
    }
View Full Code Here

                + errorCode + " message: " + message + " and throwable [" + t +"]",t);
       
        channelTable.remove(channelSubscribeId);
        rendererTable.remove(channelSubscribeId);

        CError errorChannel =
            new CError(errorCode,t,channelSubscribeId,oldInstance,message);
        if(setRuntimeData) {
            ChannelRuntimeData rd=new ChannelRuntimeData();
            rd.setBrowserInfo(binfo);
            if (lm != null)  {
                rd.setLocales(lm.getLocales());
            }
      rd.setRemoteAddress(pcs.getHttpServletRequest().getRemoteAddr());
            rd.setHttpRequestMethod(pcs.getHttpServletRequest().getMethod());
            UPFileSpec up=new UPFileSpec(uPElement);
            up.setTargetNodeId(channelSubscribeId);
            rd.setUPFile(up);
            try {
                errorChannel.setRuntimeData(rd);
                errorChannel.setPortalControlStructures(pcs);
            } catch (Throwable e) {

                log.error("Encountered an exception while trying to set runtime data or portal control structures on the error channel!", e);
            }
        }
View Full Code Here

            // Instantiate the channel and notify the StatsRecorder

      HttpServletRequest sr = this.pcs.getHttpServletRequest();
      if (sr == null){
        ch=new CError(ErrorCode.GENERAL_ERROR,"Unable to get SessionId. getHttpServletRequest returned null.",channelSubscribeId,null);
      }else{
        HttpSession hs  = sr.getSession(false);
        if (hs == null){
          ch=new CError(ErrorCode.GENERAL_ERROR,"Unable to get SessionId. getSession returned null.",channelSubscribeId,null);
        }else{       
          String id = hs.getId();
          if (id == null){
            ch=new CError(ErrorCode.GENERAL_ERROR,"Unable to get SessionId. getId returned null.",channelSubscribeId,null);
          }else{     
                        
            ch = ChannelFactory.instantiateLayoutChannel(cd,id);
                  StatsRecorder.recordChannelInstantiated(upm.getPerson(), upm.getCurrentProfile(), cd);

                  // Create and stuff the channel static data
                  ChannelStaticData sd = new ChannelStaticData();
                  sd.setChannelSubscribeId(channelSubscribeId);
                  sd.setTimeout(cd.getTimeout());
                   sd.setParameters(cd.getParameterMap());
                  sd.setPerson(upm.getPerson());
                  sd.setJNDIContext(channelContext);
                  sd.setICCRegistry(new ICCRegistry(this,channelSubscribeId));
                  sd.setChannelPublishId(cd.getChannelPublishId());

                  ch.setStaticData(sd);
          }
        }
      }
  
        } else {
            // user is not authorized to instantiate this channel
            // create an instance of an error channel instead
            ch=new CError(ErrorCode.CHANNEL_AUTHORIZATION_EXCEPTION,"You don't have authorization to render this channel.",channelSubscribeId,null);
        }

        channelTable.put(channelSubscribeId,ch);
        return ch;
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.channels.error.CError

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.