Examples of GetResource


Examples of com.simonepezzano.hshare.servlets.GetResource

    if (server == null){
      server = new Server(Integer.valueOf(Conf.getInstance().getPort()));
      Context root = new Context(server,"/",Context.SESSIONS);
      root.addServlet(new ServletHolder(new ListFiles()), "/*");
      root.addServlet(new ServletHolder(new DFile()),"/Download/*");
      root.addServlet(new ServletHolder(new GetResource()), "/Resources/*");
      try {
        fillBaseTemplates();
      } catch (IOException e) {
        HLog.iologger.fatal("Cannot copy resources from jar to resources directory", e);
      }
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      WSRP2Producer producer = ProducerHolder.getProducer();

      GetResource getResource = ResourceServingUtil.decode(req);

      try
      {
         ResourceResponse resource = producer.getResource(getResource);
         ResourceContext resourceContext = resource.getResourceContext();
         byte[] itemBinary = resourceContext.getItemBinary();
         String itemString = resourceContext.getItemString();

         final String mimeType = resourceContext.getMimeType();
         if (!ParameterValidation.isNullOrEmpty(mimeType))
         {
            resp.setContentType(mimeType);
         }

         if (itemBinary != null && itemBinary.length > 0)
         {
            resp.getOutputStream().write(itemBinary);
         }

         if (!ParameterValidation.isNullOrEmpty(itemString))
         {
            resp.getWriter().write(itemString);
         }
      }
      catch (Exception exception)
      {
         throw new ServletException("Couldn't get resource " + getResource.getResourceParams().getResourceID()
            + " for portlet " + getResource.getPortletContext(), exception);
      }
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      WSRP2Producer producer = ProducerHolder.getProducer();

      GetResource getResource = ResourceServingUtil.decode(req);

      try
      {
         ResourceResponse resource = producer.getResource(getResource);
         ResourceContext resourceContext = resource.getResourceContext();
         byte[] itemBinary = resourceContext.getItemBinary();
         String itemString = resourceContext.getItemString();

         final String mimeType = resourceContext.getMimeType();
         if (!ParameterValidation.isNullOrEmpty(mimeType))
         {
            resp.setContentType(mimeType);
         }

         if (itemBinary != null && itemBinary.length > 0)
         {
            resp.getOutputStream().write(itemBinary);
         }

         if (!ParameterValidation.isNullOrEmpty(itemString))
         {
            resp.getWriter().write(itemString);
         }
      }
      catch (Exception exception)
      {
         throw new ServletException("Couldn't get resource " + getResource.getResourceParams().getResourceID()
            + " for portlet " + getResource.getPortletContext(), exception);
      }
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   ) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
      InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
      ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
   {
      forceSessionAccess();
      GetResource getResource = WSRPTypeFactory.createGetResource(registrationContext, portletContext.value, runtimeContext, userContext, resourceParams);

      ResourceResponse response = producer.getResource(getResource);

      resourceContext.value = response.getResourceContext();
      sessionContext.value = response.getSessionContext();
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   ) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
      InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
      ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
   {
      forceSessionAccess();
      GetResource getResource = WSRPTypeFactory.createGetResource(registrationContext, portletContext.value, runtimeContext, userContext, resourceParams);

      ResourceResponse response = producer.getResource(getResource);

      resourceContext.value = response.getResourceContext();
      sessionContext.value = response.getSessionContext();
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   ) throws AccessDenied, InconsistentParameters, InvalidCookie, InvalidHandle, InvalidRegistration, InvalidSession,
      InvalidUserCategory, MissingParameters, ModifyRegistrationRequired, OperationFailed, OperationNotSupported,
      ResourceSuspended, UnsupportedLocale, UnsupportedMimeType, UnsupportedMode, UnsupportedWindowState
   {
      forceSessionAccess();
      GetResource getResource = WSRPTypeFactory.createGetResource(registrationContext, portletContext.value, runtimeContext, userContext, resourceParams);

      ResourceResponse response = producer.getResource(getResource);

      resourceContext.value = response.getResourceContext();
      sessionContext.value = response.getSessionContext();
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

      ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(), "portlet handle", "PortletContext");
      ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext, "RuntimeContext");
      ParameterValidation.throwIllegalArgExceptionIfNull(resourceParams, "ResourceParams");

      GetResource getResource = new GetResource();
      getResource.setRegistrationContext(registrationContext);
      getResource.setPortletContext(portletContext);
      getResource.setRuntimeContext(runtimeContext);
      getResource.setUserContext(userContext);
      getResource.setResourceParams(resourceParams);
      return getResource;
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

   @Override
   protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
   {
      WSRP2Producer producer = ProducerHolder.getProducer();

      GetResource getResource = ResourceServingUtil.decode(req);

      try
      {
         ResourceResponse resource = producer.getResource(getResource);
         ResourceContext resourceContext = resource.getResourceContext();
         byte[] itemBinary = resourceContext.getItemBinary();
         String itemString = resourceContext.getItemString();

         final String mimeType = resourceContext.getMimeType();
         if (!ParameterValidation.isNullOrEmpty(mimeType))
         {
            resp.setContentType(mimeType);
         }

         if (itemBinary != null && itemBinary.length > 0)
         {
            resp.getOutputStream().write(itemBinary);
         }

         if (!ParameterValidation.isNullOrEmpty(itemString))
         {
            resp.getWriter().write(itemString);
         }
      }
      catch (Exception exception)
      {
         throw new ServletException("Couldn't get resource " + getResource.getResourceParams().getResourceID()
            + " for portlet " + getResource.getPortletContext(), exception);
      }
   }
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

               "Couldn't initiate EventRequestProcessor", operationNotSupported);
         }
      }
      else if (request instanceof GetResource)
      {
         GetResource getResource = (GetResource)request;
         return new ResourceRequestProcessor(producer, getResource);
      }
      else
      {
         throw new IllegalArgumentException("Unknown request type: " + request.getClass().getSimpleName());
View Full Code Here

Examples of org.oasis.wsrp.v2.GetResource

      ParameterValidation.throwIllegalArgExceptionIfNull(portletContext, "PortletContext");
      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletContext.getPortletHandle(), "portlet handle", "PortletContext");
      ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext, "RuntimeContext");
      ParameterValidation.throwIllegalArgExceptionIfNull(resourceParams, "ResourceParams");

      GetResource getResource = new GetResource();
      getResource.setRegistrationContext(registrationContext);
      getResource.setPortletContext(portletContext);
      getResource.setRuntimeContext(runtimeContext);
      getResource.setUserContext(userContext);
      getResource.setResourceParams(resourceParams);
      return getResource;
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.