Package org.oasis.wsrp.v2

Examples of org.oasis.wsrp.v2.UploadContext


   }

   public void setTemplatesIfNeeded(WSRPPortletInfo info, PortletInvocation invocation, RuntimeContext runtimeContext) throws PortletInvokerException
   {
      // todo: could store templates in producer session info to avoid to re-generate them all the time?
      SessionParams sessionParams = runtimeContext.getSessionParams();
      if (info != null && info.isDoesUrlTemplateProcessing()
         && (!info.isTemplatesStoredInSession() || sessionParams == null || sessionParams.getSessionID() == null))
      {
         // we need to supply the templates since the portlet does URL processing and either doesn't store
         // templates in the session or no session has been established yet
         runtimeContext.setTemplates(WSRPTypeFactory.createTemplates(invocation.getContext()));
      }
View Full Code Here


   }

   @Override
   AccessMode getAccessMode() throws MissingParameters
   {
      StateChange stateChange = request.getEventParams().getPortletStateChange();

      return WSRPUtils.getAccessModeFromStateChange(stateChange);
   }
View Full Code Here

      return request.getUserContext();
   }

   AccessMode getAccessMode() throws MissingParameters
   {
      StateChange stateChange = request.getInteractionParams().getPortletStateChange();
      WSRP2ExceptionFactory.throwMissingParametersIfValueIsMissing(stateChange, "portletStateChange", "InteractionParams");
      return WSRPUtils.getAccessModeFromStateChange(stateChange);
   }
View Full Code Here

      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse unsResponse = (UpdateNavigationalStateResponse)response;
         HandleEventsResponse eventsResponse = WSRPTypeFactory.createHandleEventsReponse();

         UpdateResponse updateResponse = createUpdateResponse(unsResponse);
         eventsResponse.setUpdateResponse(updateResponse);

         return eventsResponse;
      }
      else
View Full Code Here

      return state != null ? state.toString() : null;
   }

   protected UpdateResponse createUpdateResponse(UpdateNavigationalStateResponse stateResponse)
   {
      UpdateResponse updateResponse = WSRPTypeFactory.createUpdateResponse();
      updateResponse.setNewMode(WSRPUtils.convertJSR168PortletModeNameToWSRPName(getNewStateOrNull(stateResponse, true)));
      updateResponse.setNewWindowState(WSRPUtils.convertJSR168WindowStateNameToWSRPName(getNewStateOrNull(stateResponse, false)));
      NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(
         stateResponse.getNavigationalState(),
         stateResponse.getPublicNavigationalStateUpdates()
      );
      updateResponse.setNavigationalContext(navigationalContext);

      // events
      List<UpdateNavigationalStateResponse.Event> events = stateResponse.getEvents();
      if (ParameterValidation.existsAndIsNotEmpty(events))
      {
         for (UpdateNavigationalStateResponse.Event event : events)
         {
            updateResponse.getEvents().add(WSRPTypeFactory.createEvent(event.getName(), event.getPayload()));
         }
      }

      // deal with implicit cloning and state modification
      if (instanceContext.wasModified())
      {
         PortletContext updatedPortletContext = WSRPUtils.convertToWSRPPortletContext(instanceContext.getPortletContext());
         updateResponse.setPortletContext(updatedPortletContext);
      }
      return updateResponse;
   }
View Full Code Here

   protected BlockingInteractionResponse internalProcessResponse(PortletInvocationResponse response)
   {
      if (response instanceof UpdateNavigationalStateResponse)
      {
         UpdateNavigationalStateResponse stateResponse = (UpdateNavigationalStateResponse)response;
         UpdateResponse updateResponse = createUpdateResponse(stateResponse);

         return WSRPTypeFactory.createBlockingInteractionResponse(updateResponse);
      }
      else
      {
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);

                  String value = FileUpload.FORM_DATA + ";"
                     + " name=\"" + item.getFieldName() + "\";"
                     + " filename=\"" + item.getName() + "\"";
                  NamedString mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_DISPOSITION, value);
                  mimeAttributes.add(mimeAttribute);

                  mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_TYPE, item.getContentType());
                  mimeAttributes.add(mimeAttribute);

                  uploadContext.getMimeAttributes().addAll(mimeAttributes);

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

                  bos.close();

                  final byte[] uploadData = baos.toByteArray();
                  if (uploadData.length != 0)
                  {
                     UploadContext uploadContext = WSRPTypeFactory.createUploadContext(contentType, uploadData);

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

                     String value = FileUpload.FORM_DATA + ";" + " name=\"" + item.getFieldName() + "\";" + " filename=\"" + item.getName() + "\"";
                     NamedString mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_DISPOSITION, value);
                     mimeAttributes.add(mimeAttribute);

                     mimeAttribute = WSRPTypeFactory.createNamedString(FileUpload.CONTENT_TYPE, item.getContentType());
                     mimeAttributes.add(mimeAttribute);

                     uploadContext.getMimeAttributes().addAll(mimeAttributes);

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

      public UploadContext apply(V1UploadContext v1UploadContext)
      {
         if (v1UploadContext != null)
         {
            UploadContext result = WSRPTypeFactory.createUploadContext(v1UploadContext.getMimeType(), v1UploadContext.getUploadData());
            result.getExtensions().addAll(Lists.transform(v1UploadContext.getExtensions(), EXTENSION));
            result.getMimeAttributes().addAll(Lists.transform(v1UploadContext.getMimeAttributes(), NAMEDSTRING));

            return result;
         }
         else
         {
View Full Code Here

      if (uploadData == null || uploadData.length == 0)
      {
         throw new IllegalArgumentException("Must pass non-null, non-empty upload data");
      }

      UploadContext uploadContext = new UploadContext();
      uploadContext.setMimeType(mimeType);
      uploadContext.setUploadData(uploadData);
      return uploadContext;
   }
View Full Code Here

TOP

Related Classes of org.oasis.wsrp.v2.UploadContext

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.