Package org.gatein.pc.api.invocation.response

Examples of org.gatein.pc.api.invocation.response.ErrorResponse


         else if (cause instanceof RemoteException)
         {
            cause = ((RemoteException)cause).detail;
         }
         log.debug("Invocation of action failed: " + cause.getMessage(), cause); // fix-me?
         return new ErrorResponse(cause);
      }
      else
      {
         log.debug("Invocation of action failed: " + errorResponse.getMessage());
         return errorResponse;
View Full Code Here


         return resp.getResponse();
      }
      catch (NoClassDefFoundError e)
      {
         //
         return new ErrorResponse(e);
      }
      catch (Exception e)
      {
         log.error("The portlet threw an exception", e);

         //
         if (e instanceof PortletSecurityException)
         {
            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
            return new ErrorResponse(e);
         }
      }
      finally
      {
         dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
View Full Code Here

         return resp.getResponse();
      }
      catch (NoClassDefFoundError e)
      {
         //
         return new ErrorResponse(e);
      }
      catch (Exception e)
      {
         log.error("The portlet threw an exception", e);

         //
         if (e instanceof PortletSecurityException)
         {
            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
            return new ErrorResponse(e);
         }
      }
      finally
      {
         dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
View Full Code Here

         return resp.getResponse();
      }
      catch (NoClassDefFoundError e)
      {
         //
         return new ErrorResponse(e);
      }
      catch (Exception e)
      {
         log.error("The portlet threw an exception", e);

         //
         if (e instanceof PortletSecurityException)
         {
            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
            return new ErrorResponse(e);
         }
      }
      finally
      {
         dreq.removeAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
View Full Code Here

                     log.trace("Obtained matching event class " + dstPayloadClass.getName() + " in application " + applicationId + " for event " + eventName);
                  }
               }
               catch (ClassNotFoundException e)
               {
                  return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
                     + srcPayloadClassName, e);
               }
               catch (NoClassDefFoundError e)
               {
                  return new ErrorResponse("The application " + applicationId + " does not have access to the event payload class"
                     + srcPayloadClassName, e);
               }
            }

            // We need maybe to perform some serialization to the classloader
            if (dstPayloadClass != srcPayload.getClass())
            {
               if (trace)
               {
                  log.trace("Need to convert event payload from class " + srcPayloadClassName + " to " + dstPayloadClass.getName());
               }
               try
               {
                  dstPayload = IOTools.clone(srcPayload, applicationClassLoader);
               }
               catch (ClassNotFoundException e)
               {
                  return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
               }
               catch (IOException e)
               {
                  // The cause is likely a non compatible changes in class version
                  return new ErrorResponse("Could not convert the event payload from class " + srcPayloadClassName + " to class " + dstPayloadClass.getName(), e);
               }
            }
            else
            {
               dstPayload = srcPayload;
View Full Code Here

   {
      String markup = mimeResponse.getItemString();
      byte[] binary = mimeResponse.getItemBinary();
      if (markup != null && binary != null)
      {
         return new ErrorResponse(new IllegalArgumentException("Markup response cannot contain both string and binary " +
            "markup. Per Section 6.1.10 of the WSRP 1.0 specification, this is a Producer error."));
      }

      if (markup == null && binary == null)
      {
         if (mimeResponse.isUseCachedItem() != null && mimeResponse.isUseCachedItem())
         {
            //todo: deal with cache GTNWSRP-40
            log.debug("Consumer " + consumer.getProducerId() + " requested cached data. Not implemented yet!");
         }
         else
         {
            return new ErrorResponse(new IllegalArgumentException("Markup response must contain at least string or binary" +
               " markup. Per Section 6.1.10 of the WSRP 1.0 specification, this is a Producer error."));
         }
      }

      final String mimeType = mimeResponse.getMimeType();
View Full Code Here

   {
      String redirectURL = response.getRedirectURL();
      UpdateResponse updateResponse = response.getUpdateResponse();
      if (redirectURL != null && updateResponse != null)
      {
         return new ErrorResponse(new IllegalArgumentException("Producer error: response cannot both redirect and update state."));
      }

      if (redirectURL == null && updateResponse == null)
      {
         return new ErrorResponse(new IllegalArgumentException("Producer error: response must redirect or update state."));
      }

      if (redirectURL != null)
      {
         return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
View Full Code Here

            return handle(invocation);
         }
         catch (Exception e)
         {
            log.debug("Couldn't init cookie: " + e.getLocalizedMessage());
            return new ErrorResponse(e);
         }
      }
      else if (error instanceof InvalidSession)
      {
         log.debug("Session invalidated after InvalidSessionFault, will re-send session-stored information.");
         sessionHandler.handleInvalidSessionFault(invocation, runtimeContext);

         return handle(invocation);
      }
      else if (error instanceof InvalidRegistration)
      {
         consumer.handleInvalidRegistrationFault();

         return new ErrorResponse(error);
      }
      else if (error instanceof ModifyRegistrationRequired)
      {
         consumer.handleModifyRegistrationRequiredFault();

         return new ErrorResponse(error);
      }
      else
      {
         // other errors cannot be dealt with: we have an error condition
         return new ErrorResponse(error);
      }
   }
View Full Code Here

         else if (cause instanceof RemoteException)
         {
            cause = ((RemoteException)cause).detail;
         }
         log.debug("Invocation of action failed: " + cause.getMessage(), cause); // fix-me?
         return new ErrorResponse(cause);
      }
      else
      {
         log.debug("Invocation of action failed: " + errorResponse.getMessage());
         return errorResponse;
View Full Code Here

         }
         else
         {
            if (consumer.isUsingWSRP2())
            {
               return new ErrorResponse("Did not get a resource URL or a resource ID, cannot fetch resource.");
            }
            else //using WSRP1
            {
               return new ErrorResponse("Did not get a resource URL, cannot fetch resource.");
            }
         }
      }
      else if (invocation instanceof EventInvocation)
      {
         final ProducerInfo producerInfo = consumer.getProducerInfo();
         if (producerInfo.getSupportedOptions().contains(WSRP2Constants.OPTIONS_EVENTS))
         {
            handler = eventHandler;
         }
         else
         {
            // do something better here?
            return new ErrorResponse("Producer " + producerInfo.getId() + " doesn't support event processing.");
         }
      }
      else
      {
         throw new InvocationException("Unknown invocation type: " + invocation);
View Full Code Here

TOP

Related Classes of org.gatein.pc.api.invocation.response.ErrorResponse

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.