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

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


   protected PortletInvocationResponse processResponse(HandleEventsResponse response, EventInvocation invocation, RequestPrecursor<EventInvocation> requestPrecursor) throws PortletInvokerException
   {
      final List<HandleEventsFailed> failed = WSRPUtils.replaceByEmptyListIfNeeded(response.getFailedEvents());
      if (ParameterValidation.existsAndIsNotEmpty(failed))
      {
         return new ErrorResponse("Couldn't process events: " + failed);
      }

      return processUpdateResponse(invocation, requestPrecursor, response.getUpdateResponse(), response);
   }
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)
      {
         // invalidate the currently held session information
         log.debug("Session invalidated after InvalidSessionFault, will re-send session-stored information.");
         sessionHandler.handleInvalidSessionFault(invocation, runtimeContext);

         // and re-attempt invocation as we can recover from this
         return handle(invocation);
      }
      else if (error instanceof InvalidRegistration)
      {
         // invalidate the registration information, we can't recover from this, the user will have to check the admin UI to see what's wrong
         consumer.handleInvalidRegistrationFault();

         return new ErrorResponse(error);
      }
      else if (error instanceof ModifyRegistrationRequired)
      {
         // we can't recover from this, the user will need to check the admin UI to see how to modify the current registration to make it comply with the new producer's requirements
         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

                     PortletContainerException pcException;

                     if (response instanceof ErrorResponse)
                     {
                        ErrorResponse errorResponse = (ErrorResponse)response;
                        pcException =
                           new PortletContainerException(errorResponse.getMessage(), errorResponse.getCause());
                     }
                     else
                     {
                        pcException =
                           new PortletContainerException("Unknown invocation response type [" + response.getClass()
View Full Code Here

         // todo: handle the error response better than this.
         if (!(piResponse instanceof UpdateNavigationalStateResponse))
         {
            if (piResponse instanceof ErrorResponse)
            {
               ErrorResponse errorResponse = (ErrorResponse)piResponse;
               throw (Exception)errorResponse.getCause();
            }
            else
            {
               throw new Exception("Unexpected response type [" + piResponse
                  + "]. Expected a UpdateNavigationResponse or an ErrorResponse.");
View Full Code Here

            // todo: handle the error response better than this.
            if (!(portletResponse instanceof ContentResponse))
            {
               if (portletResponse instanceof ErrorResponse)
               {
                  ErrorResponse errorResponse = (ErrorResponse)portletResponse;
                  throw (Exception)errorResponse.getCause();
               }
               else
               {
                  throw new Exception("Unexpected response type [" + portletResponse
                     + "]. Expected a ContentResponse or an ErrorResponse.");
View Full Code Here

         {
            PortletContainerException pcException;

            if (portletResponse instanceof ErrorResponse)
            {
               ErrorResponse errorResponse = (ErrorResponse)portletResponse;
               pcException = new PortletContainerException(errorResponse.getMessage(), errorResponse.getCause());
            }
            else
            {
               pcException =
                  new PortletContainerException("Unknown invocation response type [" + portletResponse.getClass()
View Full Code Here

        } else {

            PortletContainerException pcException;

            if (pir instanceof ErrorResponse) {
                ErrorResponse errorResponse = (ErrorResponse) pir;
                pcException = new PortletContainerException(errorResponse.getMessage(), errorResponse.getCause());
            } else {
                pcException = new PortletContainerException("Unknown invocation response type [" + pir.getClass()
                        + "]. Expected a FragmentResponse or an ErrorResponse");
            }
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.