Package javax.portlet

Examples of javax.portlet.ResourceURL


    LiferayResourceURL liferayResourceURL = null;

    if (friendlyURLMapperEnabled) {

      ResourceURL resourceURL = mimeResponse.createResourceURL();
      liferayResourceURL = new LiferayResourceURLFriendlyImpl(resourceURL, responseNamespace);
    }
    else {
      LiferayURLGenerator liferayURLGenerator = (LiferayURLGenerator) bridgeContext.getAttributes().get(
          RESOURCE_URL_GENERATOR);

      if (liferayURLGenerator == null) {

        ResourceURL resourceURL = mimeResponse.createResourceURL();
        liferayURLGenerator = new LiferayURLGeneratorResourceImpl(resourceURL.toString(), responseNamespace);
        bridgeContext.getAttributes().put(RESOURCE_URL_GENERATOR, liferayURLGenerator);
      }

      liferayResourceURL = new LiferayResourceURLImpl(liferayURLGenerator);
    }
View Full Code Here


      logger.debug("createResourceURL fromURL=[" + fromURL + "]");

      // Ask the portlet container to create a portlet resource URL.
      BridgeContext bridgeContext = BridgeContext.getCurrentInstance();
      MimeResponse mimeResponse = (MimeResponse) bridgeContext.getPortletResponse();
      ResourceURL resourceURL = createResourceURL(mimeResponse);

      // If the "javax.faces.resource" token is found in the URL, then
      int tokenPos = fromURL.indexOf(ResourceConstants.JAVAX_FACES_RESOURCE);

      if (tokenPos >= 0) {

        // Parse-out the resourceId
        String resourceId = fromURL.substring(tokenPos);

        // Parse-out the resourceName and convert it to a URL parameter on the portlet resource URL.
        int queryStringPos = resourceId.indexOf('?');

        String resourceName = resourceId;

        if (queryStringPos > 0) {
          resourceName = resourceName.substring(0, queryStringPos);
        }

        int slashPos = resourceName.indexOf('/');

        if (slashPos > 0) {
          resourceName = resourceName.substring(slashPos + 1);
        }
        else {
          logger.error("There is no slash after the [{0}] token in resourceURL=[{1}]",
            ResourceConstants.JAVAX_FACES_RESOURCE, fromURL);
        }

        resourceURL.setParameter(ResourceConstants.JAVAX_FACES_RESOURCE, resourceName);
        logger.debug("Added parameter to portletURL name=[{0}] value=[{1}]",
          ResourceConstants.JAVAX_FACES_RESOURCE, resourceName);
      }

      // Copy the request parameters to the portlet resource URL.
View Full Code Here

     *      java.util.Map)
     */
    public String createResourceURL(PortletConfig config, RenderRequest request, RenderResponse response, Map parameters)
            throws PortletException
    {       
        ResourceURL url = response.createResourceURL();
        if (parameters != null)
        {
            url.setParameters(parameters);
        }
        return url.toString();
    }
View Full Code Here

        PortletResponse portletResponse = (PortletResponse) pageContext.getRequest()
            .getAttribute(Constants.PORTLET_RESPONSE);
       
        if (portletResponse != null) {
         
          ResourceURL resourceURL = createResourceURL(portletResponse);
                
            if(id != null){
              resourceURL.setResourceID(id);
            }

            if(cachability != null){
              try{
                resourceURL.setCacheability(cachability);
              }
              catch(IllegalArgumentException e){
                throw new JspException(e);
              }
              catch(IllegalStateException e){
View Full Code Here

   * @param portletResponse
   * @return a resourceURL
   * @throws JspException
   */
  protected ResourceURL createResourceURL(PortletResponse portletResponse) throws JspException{
    ResourceURL result = null;
    if(portletResponse instanceof RenderResponse){
        result = ((RenderResponse)portletResponse).createResourceURL()
      }
      else if(portletResponse instanceof ResourceResponse){
        result = ((ResourceResponse)portletResponse).createResourceURL();
View Full Code Here

                }
            }

            @Override
            protected String getServiceUrl(BootstrapContext context) {
                ResourceURL portletResourceUrl = getRenderResponse(context)
                        .createResourceURL();
                portletResourceUrl.setResourceID(VaadinPortlet.RESOURCE_URL_ID);
                return portletResourceUrl.toString();
            }

            private RenderResponse getRenderResponse(BootstrapContext context) {
                PortletResponse response = ((VaadinPortletResponse) context
                        .getResponse()).getPortletResponse();

                RenderResponse renderResponse = (RenderResponse) response;
                return renderResponse;
            }

            @Override
            protected void appendMainScriptTagContents(
                    BootstrapContext context, StringBuilder builder)
                    throws JSONException, IOException {
                // fixed base theme to use - all portal pages with Vaadin
                // applications will load this exactly once
                String portalTheme = ((VaadinPortletRequest) context
                        .getRequest())
                        .getPortalProperty(VaadinPortlet.PORTAL_PARAMETER_VAADIN_THEME);
                if (portalTheme != null
                        && !portalTheme.equals(context.getThemeName())) {
                    String portalThemeUri = getThemeUri(context, portalTheme);
                    // XSS safe - originates from portal properties
                    builder.append("vaadin.loadTheme('" + portalThemeUri
                            + "');");
                }

                super.appendMainScriptTagContents(context, builder);
            }

            @Override
            protected String getMainDivStyle(BootstrapContext context) {
                VaadinService vaadinService = context.getRequest().getService();
                return vaadinService.getDeploymentConfiguration()
                        .getApplicationOrSystemProperty(
                                VaadinPortlet.PORTLET_PARAMETER_STYLE, null);
            }

            @Override
            protected JSONObject getApplicationParameters(
                    BootstrapContext context) throws JSONException,
                    PaintException {
                JSONObject parameters = super.getApplicationParameters(context);
                VaadinPortletResponse response = (VaadinPortletResponse) context
                        .getResponse();
                MimeResponse portletResponse = (MimeResponse) response
                        .getPortletResponse();
                ResourceURL resourceURL = portletResponse.createResourceURL();
                resourceURL.setResourceID("v-browserDetails");
                parameters.put("browserDetailsUrl", resourceURL.toString());

                // Always send path info as a query parameter
                parameters.put(
                        ApplicationConstants.SERVICE_URL_PATH_AS_PARAMETER,
                        true);
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
            // TODO exception ??
            return null;
        }
View Full Code Here

         * for uploads anymore, check if this is needed for some other things
         */
        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

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.