Package javax.portlet

Examples of javax.portlet.ResourceURL


      // the response
      // (interaction
      // state)
      MimeResponse mimeResponse = (MimeResponse) getResponse();
      PortletURL actionURL = null;
      ResourceURL resourceURL = null;
      BaseURL baseURL = null;
      // Non-JSF actions are renderURLs as we merely dispatch to them
      if (urlType == Bridge.PortletPhase.ACTION_PHASE)
      {
        baseURL = actionURL = mimeResponse.createActionURL();
View Full Code Here


    }
   

    // Encode the URL
   
    ResourceURL resource = ((MimeResponse) mPortletResponse).createResourceURL();
    resource.setResourceID(path);
   
    // Walk through the queryStr Params and add as resourceParams
    // remove any attempt to set Mode/WindowState/etc. as
    // not feasible here
    // Add parameters so they don't get lost
    Enumeration<String> list = queryStr.getParameterNames();
    while (list.hasMoreElements())
    {
      String param = list.nextElement().toString();
      if (param.equals(Bridge.PORTLET_MODE_PARAMETER))
      {
        // do nothing -- just ignore -- can't encode in a resourceURL
      }
      else if (param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
      {
        // do nothing -- just ignore -- can't encode in a resourceURL
      }
      else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
      {
        try
        {
          resource.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
        }
        catch (Exception e)
        {
          ; // do nothing -- just ignore
        }
      }
      else
      {
        resource.setParameter(param, queryStr.getParameter(param));
      }
    }

    return portletURLToString(resource, isStrictXhtmlEncoded);
  }
View Full Code Here

    @Override
    public String generateApplicationResourceURL(ApplicationResource resource,
            String mapKey) {
        if (response instanceof MimeResponse) {
            ResourceURL resourceURL = ((MimeResponse) response)
                    .createResourceURL();
            final String filename = resource.getFilename();
            if (filename == null) {
                resourceURL.setResourceID("APP/" + mapKey + "/");
            } else {
                resourceURL.setResourceID("APP/" + mapKey + "/" + filename);
            }
            return resourceURL.toString();
        } else {
            // in a background thread or otherwise outside a request
            return null;
        }
    }
View Full Code Here

                    /*
                     * The application manager needs an URL to the dummy page.
                     * See the PortletCommunicationManager.sendUploadResponse
                     * method for more information.
                     */
                    ResourceURL dummyURL = ((RenderResponse) response)
                            .createResourceURL();
                    dummyURL.setResourceID("DUMMY");
                    applicationManager.dummyURL = dummyURL.toString();
                }

                /* Update browser information from request */
                updateBrowserProperties(applicationContext.getBrowser(),
                        request);
View Full Code Here

         * We need this in order to get uploads to work.
         */
        PortletURL appUri = response.createActionURL();
        config.put("appUri", "'" + appUri.toString() + "'");
        config.put("usePortletURLs", "true");
        ResourceURL uidlUrlBase = response.createResourceURL();
        uidlUrlBase.setResourceID("UIDL");
        config.put("portletUidlURLBase", "'" + uidlUrlBase.toString() + "'");
        config.put("pathInfo", "''");
        config.put("themeUri", "'" + themeURI + "'");

        String versionInfo = "{vaadinVersion:\""
                + AbstractApplicationServlet.VERSION
View Full Code Here

    final String formAction = externalContext.encodeActionURL(viewHandler.getActionURL(facesContext, viewId));
    final String partialAction;
    final boolean portlet = PortletUtils.isPortletApiAvailable() && response instanceof MimeResponse;
    if (portlet) {
      final MimeResponse mimeResponse = (MimeResponse) response;
      final ResourceURL resourceURL = mimeResponse.createResourceURL();
      partialAction = externalContext.encodeResourceURL(resourceURL.toString());
    } else {
      partialAction = null;
    }

    final String contentType = writer.getContentTypeWithCharSet();
View Full Code Here

       }

  @Override
    protected String createResourceUrl(PortalActionURL portalUrl) {
      MimeResponse renderResponse = getResponse();
      ResourceURL resourceURL =
        PlatformUtil.createResourceURL(renderResponse);
      portalUrl.removeParameter(Bridge.PORTLET_MODE_PARAMETER);
      portalUrl.removeParameter(Bridge.PORTLET_WINDOWSTATE_PARAMETER);
      String secure = portalUrl.getParameter(Bridge.PORTLET_SECURE_PARAMETER);
      if(null != secure){
        try {
        if("true".equalsIgnoreCase(secure)){
          resourceURL.setSecure(true);
        } else if ("false".equalsIgnoreCase(secure)) {
          resourceURL.setSecure(false);       
        }
        } catch (PortletSecurityException e) {
          // do nothing
        }
        portalUrl.removeParameter(Bridge.PORTLET_SECURE_PARAMETER);
      }
      resourceURL.setResourceID(portalUrl.getPath());
      resourceURL.setParameters(portalUrl.getParameters());
      return resourceURL.toString();
    }
View Full Code Here

      Object storeData) {
    if (BridgeUtil.isPortletRequest() && !specialResource(resource)) {
      Object response = context.getExternalContext().getResponse();
      if (response instanceof MimeResponse) {
        MimeResponse mimeResponse = (MimeResponse) response;
        ResourceURL resourceURL = PlatformUtil
            .createResourceURL(mimeResponse);
        FacesResourceContext resourceContext = new FacesResourceContext(
            context);
        resourceContext.setResourceData(storeData);
        if (resource.isCacheable(resourceContext)) {
          try {
            // resourceURL.setCacheability(ResourceURL.FULL);
          } catch (IllegalStateException e) {
            // Ignore that, use default cache level.
          }
        }
        StringBuffer uri = new StringBuffer(RFRES);// ResourceServlet.DEFAULT_SERVLET_PATH).append("/");
        uri.append(resource.getKey());
        // append serialized data as Base-64 encoded request string.
        if (storeData != null) {
          try {
            byte[] objectData;
            if (storeData instanceof byte[]) {
              objectData = (byte[]) storeData;
              uri.append(DATA_BYTES_SEPARATOR);
            } else {
              ByteArrayOutputStream dataSteram = new ByteArrayOutputStream(
                  1024);
              ObjectOutputStream objStream = new ObjectOutputStream(
                  dataSteram);
              objStream.writeObject(storeData);
              objStream.flush();
              objStream.close();
              dataSteram.close();
              objectData = dataSteram.toByteArray();
              uri.append(DATA_SEPARATOR);
            }
            byte[] dataArray = encrypt(objectData);
            uri.append(new String(dataArray, "ISO-8859-1"));

            // / byte[] objectData = dataSteram.toByteArray();
            // / uri.append("?").append(new
            // String(Base64.encodeBase64(objectData),
            // / "ISO-8859-1"));
          } catch (Exception e) {
            // Ignore errors, log it
            log.log(Level.SEVERE,
                Messages.getMessage(Messages.QUERY_STRING_BUILDING_ERROR),
                e);
          }
        }
        resourceURL.setResourceID(uri.toString());
        return resourceURL.toString().replaceAll("\\&amp\\;", "&");
      } else {
        return PortletExternalContextImpl.RESOURCE_URL_DO_NOTHITG;
      }
    } else {
      return getDefaultUri(resource, context, storeData);
View Full Code Here

  private static final Logger log = BridgeLogger.AJAX.getLogger();

  public static ResourceURL createResourceURL(MimeResponse response) {

    ResourceURL rurl = response.createResourceURL();

    Platform currentPlatform = getPlatform(response);
    if (currentPlatform == Platform.LIFERAY) {
      try {
        Method m = rurl.getClass().getMethod(
            "setCopyCurrentRenderParameters", boolean.class);

        m.invoke(rurl, false);
      } catch (SecurityException e) {
        // should never happen
View Full Code Here

    @Override
    public void serveResource(ResourceRequest req, ResourceResponse resp) throws PortletException, IOException {
        resp.setContentType("text/html");
        PrintWriter writer = resp.getWriter();
        String namespace = "n_" + resp.getNamespace();
        ResourceURL resourceURL = resp.createResourceURL();
        resourceURL.setCacheability(ResourceURL.PAGE);
        PortletURL renderURL = resp.createRenderURL();
        Locale current = req.getLocale();

        //
        writer.print("<html>" + "<head>" + "<script type='text/javascript'>" + "function openLinkInParent(){"
View Full Code Here

TOP

Related Classes of javax.portlet.ResourceURL

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.