Package javax.portlet

Examples of javax.portlet.UnavailableException


            this.defaultViewSelector.setPortletContext(getPortletContext());
        }
        catch (Exception e)
        {
            log.error("Failed to load " + DEFAULT_VIEW_SELECTOR, e);
            throw new UnavailableException(e.getMessage());
        }
    }
View Full Code Here


         {
            return new SecurityErrorResponse(e);
         }
         else if (e instanceof UnavailableException)
         {
            UnavailableException ue = (UnavailableException)e;
            if (ue.isPermanent())
            {
               return new UnavailableResponse();
            }
            else
            {
               return new UnavailableResponse(ue.getUnavailableSeconds());
            }
         }
         else
         {
            // The exception is either a PortletException, an IOException or a RuntimeException
View Full Code Here

         {
            return new SecurityErrorResponse(e);
         }
         else if (e instanceof UnavailableException)
         {
            UnavailableException ue = (UnavailableException)e;
            if (ue.isPermanent())
            {
               return new UnavailableResponse();
            }
            else
            {
               return new UnavailableResponse(ue.getUnavailableSeconds());
            }
         }
         else
         {
            // The exception is either a PortletException, an IOException or a RuntimeException
View Full Code Here

          }
          return targetHandlerMethods.get(bestMappingMatch);
        }
      }
      else {
        throw new UnavailableException("No matching handler method found for portlet request: mode '" +
            request.getPortletMode() + "', type '" + (response instanceof ActionResponse ? "action" : "render") +
            "', parameters " + StylerUtils.style(request.getParameterMap()));
      }
    }
View Full Code Here

      if (e instanceof PortletException) {
        String nested = e.getMessage();
        if (nested != null) {
          msg += ":" + nested;
        }
        throw Tools.initCause(new UnavailableException(msg), e.getCause());
      } else {
        throw new PortletException(msg, e);
      }
    }

    //
    final BridgeContext bridgeContext = new AbstractBridgeContext() {
      final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
      final ResourceResolver resolver = new ResourceResolver() {
        public URL resolve(String uri) {
          try {
            return context.getResource(uri);
          }
          catch (MalformedURLException e) {
            return null;
          }
        }
      };
      public ReadFileSystem<?> getResourcePath() {
        return WarFileSystem.create(context, "/WEB-INF/");
      }
      public ReadFileSystem<?> getClassPath() {
        return WarFileSystem.create(context, "/WEB-INF/classes/");
      }
      public ClassLoader getClassLoader() {
        return classLoader;
      }
      public String getInitParameter(String name) {
        return context.getInitParameter(name);
      }
      public ResourceResolver getResolver() {
        return resolver;
      }
      public Object getAttribute(String key) {
        return context.getAttribute(key);
      }
      public void setAttribute(String key, Object value) {
        context.setAttribute(key, value);
      }
    };

    //
    InjectorProvider injectorProvider = bridgeConfig.injectorProvider;
    if (injectorProvider == null) {
      throw new UnavailableException("No inject implementation selected");
    } else {
      portletLogger.info("Using inject implementation " + injectorProvider.getValue());
    }

    //
View Full Code Here

         {
            return new SecurityErrorResponse(e);
         }
         else if (e instanceof UnavailableException)
         {
            UnavailableException ue = (UnavailableException)e;
            if (ue.isPermanent())
            {
               return new UnavailableResponse();
            }
            else
            {
               return new UnavailableResponse(ue.getUnavailableSeconds());
            }
         }
         else
         {
            // The exception is either a PortletException, an IOException or a RuntimeException
View Full Code Here

         {
            return new SecurityErrorResponse(e);
         }
         else if (e instanceof UnavailableException)
         {
            UnavailableException ue = (UnavailableException)e;
            if (ue.isPermanent())
            {
               return new UnavailableResponse();
            }
            else
            {
               return new UnavailableResponse(ue.getUnavailableSeconds());
            }
         }
         else
         {
            // The exception is either a PortletException, an IOException or a RuntimeException
View Full Code Here

 
  private void checkAvailable() throws UnavailableException
  {
      if ( destroyed )
      {
          throw new UnavailableException("Portlet "+portletName+" no longer available");
      }
  }
View Full Code Here

                    {
                        PortletApplication pa = (PortletApplication)pd.getPortletApplicationDefinition();
                        ClassLoader paCl = (ClassLoader)classLoaderMap.get(pa.getId().toString());
                        if ( paCl == null )
                        {
                            throw new UnavailableException("Portlet Application "+pa.getName()+" not available");
                        }
                       
                        ClassLoader currentContextClassLoader = Thread.currentThread().getContextClassLoader();
                        try
                        {
View Full Code Here

            }
           
            ClassLoader paCl = (ClassLoader)classLoaderMap.get(pa.getId().toString());
            if ( paCl == null )
            {
                throw new UnavailableException("Portlet Application "+pa.getName()+" not available");
            }
           
            ClassLoader currentContextClassLoader = Thread.currentThread().getContextClassLoader();
            try
            {
              Class clazz = paCl.loadClass(pd.getClassName());
              try
            {
                Thread.currentThread().setContextClassLoader(paCl);
                // wrap new Portlet inside PortletInstance which ensures the destroy
                // method will wait for all its invocation threads to complete
                // and thereby releasing all its ClassLoader locks as needed for local portlets.
                portlet = new JetspeedPortletInstance(pd.getName(), (Portlet)clazz.newInstance());
            }
              finally
            {
                Thread.currentThread().setContextClassLoader(currentContextClassLoader);
              }
            }
            catch (Exception e)
            {
                String msg = "Cannot create Portlet instance "+pd.getClassName()+" for Portlet Application "+pa.getName();
                log.error(msg,e);
                throw new UnavailableException(msg);
            }
     
            PortletContext portletContext = PortalAccessor.createPortletContext(servletContext, pa);           
            PortletConfig portletConfig = PortalAccessor.createPortletConfig(portletContext, pd);
           
            try
            {
              try
              {
                Thread.currentThread().setContextClassLoader(paCl);
            portlet.init(portletConfig);           
              }
              finally
              {
                Thread.currentThread().setContextClassLoader(currentContextClassLoader);
              }
            }
            catch (PortletException e1)
            {
                log.error("Failed to initialize Portlet "+pd.getClassName()+" for Portlet Application "+pa.getName(), e1);
                throw e1;
            }           
            portletCache.put(pdId, portlet);
          }
        }
        catch (PortletException pe)
        {
            throw pe;
        }
        catch (Throwable e)
        {
            log.error("PortletFactory: Failed to load portlet "+pd.getClassName(), e);
            throw new UnavailableException( "Failed to load portlet " + pd.getClassName() +": "+e.toString());
        }
        return portlet;
    }
View Full Code Here

TOP

Related Classes of javax.portlet.UnavailableException

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.