Package javax.portlet.faces

Examples of javax.portlet.faces.BridgeException


      }
      return mFacesContextFactory;
    }
    catch (FacesException e)
    {
      throw new BridgeException(e);
    }
  }
View Full Code Here


      }
      return mLifecycle;
    }
    catch (FacesException e)
    {
      throw new BridgeException(e);
    }
  }
View Full Code Here

  public void init(PortletConfig config)
    throws BridgeException
  {
    //TODO: Should we throw an exception if the bridge is already initialized?
    if (mInitialized)
      throw new BridgeException("Bridge already initialized.");

    mPortletConfig = config;
    PortletContext portletContext = mPortletConfig.getPortletContext();

    // get preserveActionParams and excludedAttributes configuration settings.
    mPreserveActionParams = (Boolean) portletContext.getAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName() +
                                            "." + Bridge.PRESERVE_ACTION_PARAMS);
   
    mExcludedRequestAttributes = (List <String>) portletContext.getAttribute(Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName() +
                                            "." + Bridge.EXCLUDED_REQUEST_ATTRIBUTES);
    if (mExcludedRequestAttributes != null)
    {
      // copy the list as we may be adding to it and don't want to worry that this might be immutable
      mExcludedRequestAttributes = new ArrayList(mExcludedRequestAttributes);
    }
    else
    {
      // Otherwise create an empty list
      mExcludedRequestAttributes = new ArrayList(5);
    }

    // Read excludedAttributes that may be defined in any face-config.xml
    readExcludedAttributesFromFacesConfig(portletContext, mExcludedRequestAttributes);

    // Set up the synchronziation object for the RequestScopeMap as we don't
    // want to sync on the PortletContext because its too broad. Note:
    // needed
    // because we not only need to sync the Map but also creating the Map
    // and
    // putting it in the PortletContext. Hence the sync object allows us
    // to limit syncronizing the PortletContext to once per portlet (init
    // time);

    // TODO: What about synching on a static object or using a class lock?
    //       Perhaps even the LRUMap itself if said map is a singleton?
    synchronized (portletContext)
    {
      Object lock = portletContext.getAttribute(REQUEST_SCOPE_LOCK);
      if (lock == null)
      {
        portletContext.setAttribute(REQUEST_SCOPE_LOCK, new Object());
      }
    }

    // Add self as ELContextListener to the Faces App so we can add the
    // portletConfig to any newly created contexts.
    ApplicationFactory appFactory =
      (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
    Application app = appFactory.getApplication();
    app.addELContextListener(this);

    // Process and cache the FacesServlet mappings for use by
    // ExternalContext
    WebConfigurationProcessor webConfig = new WebConfigurationProcessor(portletContext);
    mFacesMappings = webConfig.getFacesMappings();
    if (mFacesMappings == null || mFacesMappings.size() == 0)
    {
      throw new BridgeException("BridgeImpl.init(): unable to determine Faces servlet web.xml mapping.");
    }

    // Set defaults for each mode's last active view session attribute
    mDefaultViewIdMap = (Map<String,String>) portletContext.getAttribute(
                                Bridge.BRIDGE_PACKAGE_PREFIX + mPortletConfig.getPortletName()
View Full Code Here

    {
      mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:action", e);
      if (!(e instanceof BridgeException))
      {
        Throwable rootCause = e.getCause();
        throw new BridgeException(e.getMessage(), rootCause);
      }
      else
      {
        throw (BridgeException) e;
      }
View Full Code Here

      mPortletConfig.getPortletContext().log("Exception thrown in doFacesRequest:render", e);
      if (!(e instanceof BridgeException))
      {
        Throwable rootCause = e.getCause();
        throw new BridgeException(e.getMessage(), rootCause);
      }
      else
      {
        throw (BridgeException) e;
      }
View Full Code Here

      return mFacesContextFactory;
    }
    catch (FacesException e)
    {
      Throwable rootCause = e.getCause();
      throw new BridgeException(e.getMessage(), rootCause);
    }
  }
View Full Code Here

      return mLifecycle;
    }
    catch (FacesException e)
    {
      Throwable rootCause = e.getCause();
      throw new BridgeException(e.getMessage(), rootCause);
    }
  }
View Full Code Here

    if (null == config) {
      throw new NullPointerException(
          "No PortletConfig at the bridge initialization");
    }
    if (initialized) {
      throw new BridgeException("JSF portlet bridge already initialized");
    }
    String portletName = config.getPortletName();
    if (log.isLoggable(Level.FINE)) {
      log.fine("Start portletbridge initialization for " + portletName);
    }
    this.portletConfig = config;
    PortletContext portletContext = config.getPortletContext();
    // add locales to faces application
    stateHolder = PortletStateHolder.init(portletContext);
    initFaces(portletContext);
    transferLocales(config);
    exceptionHandler = createExceptionHandler(portletContext);
    // Parse web.xml for a Faces Servlet mappings.
    WebXML webXml = new WebXML();
    webXml.parse(portletContext);
    this.facesServletMappings = webXml.getFacesServletMappings();
    if (null == facesServletMappings || facesServletMappings.size() == 0) {
      throw new BridgeException("Unable to get Faces Servlet mapping");
    }
    errorPages = webXml.getErrorViews();
    // Get defined role names from portlet.xml
    PortletXML portletXML = new PortletXML();
    portletXML.parse(portletContext);
    userRoles = portletXML.getUserRoles(portletName);
    // Get all excluded request attributes names.
    this.excludedAttributes = new HashSet<ExcludedRequestAttribute>();
    String bridgeParametersPrefix = Bridge.BRIDGE_PACKAGE_PREFIX
        + portletName + ".";
    List<String> excluded = (List<String>) portletContext
        .getAttribute(bridgeParametersPrefix
            + Bridge.EXCLUDED_REQUEST_ATTRIBUTES);
    if (null != excluded) {
      for (String name : excluded) {
        excludedAttributes.add(new ExcludedRequestAttribute(name));
      }
    }
    FacesConfig facesConfig = new FacesConfig();
    facesConfig.parse(portletContext);
    excluded = facesConfig.getExcludedAttributes();
    if (null != excluded) {
      for (String name : excluded) {
        excludedAttributes.add(new ExcludedRequestAttribute(name));
      }
    }
    // Get preserve action parameters flag
    Boolean preserveParams = (Boolean) portletContext
        .getAttribute(bridgeParametersPrefix
            + Bridge.PRESERVE_ACTION_PARAMS);
    this.preserveActionParams = Boolean.TRUE.equals(preserveParams);
    // Get devault view's Map.
    this.defaultViewIdMap = (Map<String, String>) portletContext
        .getAttribute(bridgeParametersPrefix
            + Bridge.DEFAULT_VIEWID_MAP);
    if (null == this.defaultViewIdMap || 0 == this.defaultViewIdMap.size()) {
      throw new BridgeException("No JSF view id's defined in portlet");
    }
    // Initialization done.
    initialized = true;
    if (log.isLoggable(Level.FINE)) {
      log.fine("Done portletbridge initialization for " + portletName);
View Full Code Here

                UIViewRoot.COMPONENT_TYPE,
                richFacesHelper.getViewRootRenderer());
        context.release();
      }
    } catch (FacesException e) {
      throw new BridgeException("JSF Initialization error", e);
    }
  }
View Full Code Here

    }
    if (null == response) {
      throw new NullPointerException("Response parameter is null");
    }
    if (!isInitialized()) {
      throw new BridgeException("JSF Portlet bridge is not initialized");
    }
    if (log.isLoggable(Level.FINE)) {
      log.fine("Start bridge action request processing for portlet "
          + getPortletName());
    }
View Full Code Here

TOP

Related Classes of javax.portlet.faces.BridgeException

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.