Package org.oasis.wsrp.v1

Examples of org.oasis.wsrp.v1.MarkupResponse


      {
         persistentEndpointInfo.refresh();

         try
         {
            RegistrationContext registrationContext = getRegistrationContext();
            persistentEndpointInfo.getRegistrationService().deregister(
               registrationContext.getRegistrationHandle(),
               registrationContext.getRegistrationState(),
               new ArrayList<Extension>());
            log.info("Consumer with id '" + persistentId + "' deregistered.");
         }
         catch (Exception e)
         {
View Full Code Here


      {
         persistentEndpointInfo.refresh();

         try
         {
            RegistrationContext registrationContext = getRegistrationContext();
            Holder<byte[]> registrationState = new Holder<byte[]>();

            // invocation
            persistentEndpointInfo.getRegistrationService().modifyRegistration(
               registrationContext,
View Full Code Here

   public RegistrationContext getRegistrationContext()
   {
      if (persistentRegistrationHandle != null)
      {
         RegistrationContext registrationContext = WSRPTypeFactory.createRegistrationContext(persistentRegistrationHandle);
         registrationContext.setRegistrationState(persistentRegistrationState);
         return registrationContext;
      }
      else
      {
         return null;
View Full Code Here

            if (!result.hasIssues())
            {
               try
               {
                  log.debug("Attempting registration");
                  RegistrationData registrationData = persistentRegistrationInfo.getRegistrationData();
                  Holder<String> registrationHandle = new Holder<String>();
                  Holder<byte[]> registrationState = new Holder<byte[]>();

                  // invocation
                  persistentEndpointInfo.getRegistrationService().register(
                     registrationData.getConsumerName(),
                     registrationData.getConsumerAgent(),
                     registrationData.isMethodGetSupported(),
                     registrationData.getConsumerModes(),
                     registrationData.getConsumerWindowStates(),
                     registrationData.getConsumerUserScopes(),
                     registrationData.getCustomUserProfileData(),
                     registrationData.getRegistrationProperties(),
                     new Holder<List<Extension>>(),
                     registrationHandle,
                     registrationState
                  );
View Full Code Here

         log.debug("performRequest: " + retryCount + " attempt(s) out of " + MAXIMUM_RETRY_NUMBER + " possible");
         SessionHandler sessionHandler = consumer.getSessionHandler();

         // prepare everything for the request
         updateRegistrationContext(request);
         RuntimeContext runtimeContext = getRuntimeContextFrom(request);

         WindowContext windowContext = invocation.getWindowContext();
         runtimeContext.setNamespacePrefix(getNamespaceFrom(windowContext));

         InstanceContext instanceContext = invocation.getInstanceContext();
         runtimeContext.setPortletInstanceKey(instanceContext == null ? null : instanceContext.getId());

         updateUserContext(request, consumer.getUserContextFrom(invocation, runtimeContext));
         consumer.setTemplatesIfNeeded(invocation, runtimeContext);

         try
View Full Code Here

      return result;
   }

   private RefreshResult internalRefresh(boolean forceRefresh) throws PortletInvokerException
   {
      ServiceDescription serviceDescription;

      if (isModifyRegistrationRequired)
      {
         return new RefreshResult(RefreshResult.Status.MODIFY_REGISTRATION_REQUIRED);
      }
View Full Code Here

   }

   private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailed, InvalidRegistration
   {
      //todo: might need to implement customization of default service description
      ServiceDescription serviceDescription;
      try
      {
         Holder<Boolean> requiresRegistration = new Holder<Boolean>();
         Holder<List<PortletDescription>> offeredPortlets = new Holder<List<PortletDescription>>();
         Holder<List<ItemDescription>> userCategoryDescriptions = new Holder<List<ItemDescription>>();
         Holder<List<ItemDescription>> userProfileItemDescriptions = new Holder<List<ItemDescription>>();
         Holder<List<ItemDescription>> windowStateDescriptions = new Holder<List<ItemDescription>>();
         Holder<List<ItemDescription>> modeDescriptions = new Holder<List<ItemDescription>>();
         Holder<CookieProtocol> initCookie = new Holder<CookieProtocol>();
         Holder<ModelDescription> registrationPropertyDescription = new Holder<ModelDescription>();
         Holder<List<String>> locales = new Holder<List<String>>();
         Holder<ResourceList> resourceList = new Holder<ResourceList>();

         // invocation
         persistentEndpointInfo.getServiceDescriptionService().getServiceDescription(
            asUnregistered ? null : getRegistrationContext(),
            WSRPConstants.getDefaultLocales(), // todo: deal with locales better
            requiresRegistration,
            offeredPortlets,
            userCategoryDescriptions,
            userProfileItemDescriptions,
            windowStateDescriptions,
            modeDescriptions,
            initCookie,
            registrationPropertyDescription,
            locales,
            resourceList,
            new Holder<List<Extension>>());

         serviceDescription = WSRPTypeFactory.createServiceDescription(requiresRegistration.value);
         serviceDescription.setRegistrationPropertyDescription(registrationPropertyDescription.value);
         serviceDescription.setRequiresInitCookie(initCookie.value);
         serviceDescription.setResourceList(resourceList.value);
         serviceDescription.getCustomModeDescriptions().addAll(modeDescriptions.value);
         serviceDescription.getCustomUserProfileItemDescriptions().addAll(userProfileItemDescriptions.value);
         serviceDescription.getCustomWindowStateDescriptions().addAll(windowStateDescriptions.value);
         serviceDescription.getLocales().addAll(locales.value);
         serviceDescription.getOfferedPortlets().addAll(offeredPortlets.value);
         serviceDescription.getUserCategoryDescriptions().addAll(userCategoryDescriptions.value);

         return serviceDescription;
      }
      catch (Exception e)
      {
View Full Code Here

   {
      BlockingInteractionResponse blockingInteractionResponse = (BlockingInteractionResponse)response;
      log.debug("Starting processing response");

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

      if (redirectURL != null)
      {
         return new HTTPRedirectionResponse(redirectURL); // do we need to process URLs?
      }
      else
      {
         // updateResponse.getMarkupContext(); // ignore bundled markup for now.

         UpdateNavigationalStateResponse result = new UpdateNavigationalStateResponse();
         // new mode
         String newMode = updateResponse.getNewMode();
         if (newMode != null)
         {
            result.setMode(WSRPUtils.getJSR168PortletModeFromWSRPName(newMode));
         }
         // new window state
         String newWindowState = updateResponse.getNewWindowState();
         if (newWindowState != null)
         {
            result.setWindowState(WSRPUtils.getJSR168WindowStateFromWSRPName(newWindowState));
         }
         // navigational state
         String navigationalState = updateResponse.getNavigationalState();
         if (navigationalState != null)
         {
            result.setNavigationalState(new OpaqueStateString(navigationalState));
         }

         // check if the portlet was cloned
         PortletContext portletContext = updateResponse.getPortletContext();
         if (portletContext != null)
         {
            PortletContext originalContext = requestPrecursor.getPortletContext();
            InstanceContext context = invocation.getInstanceContext();

            String handle = portletContext.getPortletHandle();
            if (!originalContext.getPortletHandle().equals(handle))
            {
               log.debug("Portlet '" + requestPrecursor.getPortletHandle() + "' was implicitely cloned. New handle is '"
                  + handle + "'");
               StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_CLONED_EVENT);
               context.onStateEvent(event);
            }
            else
            {
               // check if the state was modified
               byte[] originalState = originalContext.getPortletState();
               byte[] newState = portletContext.getPortletState();
               if (!Arrays.equals(originalState, newState))
               {
                  StateEvent event = new StateEvent(WSRPUtils.convertToPortalPortletContext(portletContext), StateEvent.Type.PORTLET_MODIFIED_EVENT);
                  context.onStateEvent(event);
               }
            }

            // update the session information associated with the portlet handle
            consumer.getSessionHandler().updateSessionInfoFor(originalContext.getPortletHandle(), handle, invocation);
         }
         else
         {
            portletContext = requestPrecursor.getPortletContext();
         }

         // update the session info, using either the original or cloned portlet context, as appropriate
         consumer.getSessionHandler().updateSessionIfNeeded(updateResponse.getSessionContext(), invocation,
            portletContext.getPortletHandle());

         log.debug("Response processed");
         return result;
      }
View Full Code Here

                  bos.flush();
                  baos.flush();
                  bufIn.close();
                  bos.close();

                  UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, baos.toByteArray());

                  List<NamedString> mimeAttributes = new ArrayList<NamedString>(2);

                  NamedString mimeAttribute = new NamedString();
                  mimeAttribute.setName(FileUpload.CONTENT_DISPOSITION);
                  mimeAttribute.setValue(FileUpload.FORM_DATA + ";"
                     + " name=\"" + item.getFieldName() + "\";"
                     + " filename=\"" + item.getName() + "\"");
                  mimeAttributes.add(mimeAttribute);

                  mimeAttribute = new NamedString();
                  mimeAttribute.setName(FileUpload.CONTENT_TYPE);
                  mimeAttribute.setValue(item.getContentType());
                  mimeAttributes.add(mimeAttribute);

                  uploadContext.getMimeAttributes().addAll(mimeAttributes);

                  uploadContexts.add(uploadContext);
               }
               else
               {
View Full Code Here

   {
      if (updateResponse == null)
      {
         throw new IllegalArgumentException("BlockingInteractionResponse requires either an UpdateResponse or a redirect URL.");
      }
      V1BlockingInteractionResponse interactionResponse = new V1BlockingInteractionResponse();
      interactionResponse.setUpdateResponse(updateResponse);
      return interactionResponse;
   }
View Full Code Here

TOP

Related Classes of org.oasis.wsrp.v1.MarkupResponse

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.