Package javax.portlet

Examples of javax.portlet.BaseURL


      }
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL =  super.generateURL();

      if (!properties.isEmpty())
      {
         for (String name : properties.keySet())
         {
            List<String> props = properties.get(name);
            for (String prop : props)
            {
               newPortletURL.setProperty(name, prop);
            }
         }
      }

      return newPortletURL;
View Full Code Here


      return typeParameter;
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL =  super.generateURL();

      setId((ResourceURL)newPortletURL);
      setCacheability((ResourceURL)newPortletURL);

      return newPortletURL;
View Full Code Here

      // (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();
      }
      else if (urlType == Bridge.PortletPhase.RESOURCE_PHASE)
      {
        baseURL = resourceURL = mimeResponse.createResourceURL();
      }
      else
      {
        baseURL = actionURL = mimeResponse.createRenderURL();
      }

      // Add parameters so they don't get lost
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement().toString();
        if (actionURL != null && param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionURL.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (actionURL != null && param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          try
          {
            baseURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          baseURL.setParameter(param, queryStr.getParameter(param));
        }
      }
     
      // Carry forward render parameters if this is a portlet:url that references the current view
      if (isPortletURLSelfReference)
View Full Code Here

        return resp.encodeURL(req.getContextPath() + sb.toString());
    }

    protected Object createUrl( String scheme, String type, Map<String, String[]> portletParams ) {
        MimeResponse response = (MimeResponse) PortletActionContext.getResponse();
        BaseURL url;
        if (URLTYPE_NAME_ACTION.equalsIgnoreCase(type)) {
            if (LOG.isDebugEnabled()) LOG.debug("Creating action url");
            url = response.createActionURL();
        }
        else if(URLTYPE_NAME_RESOURCE.equalsIgnoreCase(type)) {
          if (LOG.isDebugEnabled()) LOG.debug("Creating resource url");
          url = response.createResourceURL();
        }
        else {
            if (LOG.isDebugEnabled()) LOG.debug("Creating render url");
            url = response.createRenderURL();
        }

        url.setParameters(portletParams);

        if ("HTTPS".equalsIgnoreCase(scheme)) {
            try {
                url.setSecure(true);
            } catch ( PortletSecurityException e) {
                LOG.error("Cannot set scheme to https", e);
            }
        }
        return url;
View Full Code Here

   * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
   */
  @Override
  public int doStartTag() throws JspException{
   
    BaseURL url = getUrl();
   
    if(url == null){
      throw new IllegalStateException("internal error: url not set");
    }
   
    if (var != null) {
            pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
        }
   
    if (secure != null) {
            try {                 
                url.setSecure(getSecureBoolean());                   
            } catch (PortletSecurityException e) {                 
                throw new JspException(e);                   
            }
        }
   
View Full Code Here

   * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
   */
  @Override
  public int doEndTag() throws JspException{
   
    BaseURL url = getUrl();
   
    if(url == null){
      throw new IllegalStateException("internal error: url not set");
    }
   
    setUrlParameters(url);   
    setUrlProperties(url);
   
    HttpServletResponse response =
      (HttpServletResponse) pageContext.getResponse();
   
    //  properly encoding urls to allow non-cookie enabled sessions - PLUTO-252
    String urlString = response.encodeURL(url.toString());

     if(escapeXml)
     {
       urlString = doEscapeXml(urlString);
    }
View Full Code Here

      // (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 (nonFacesAction)
      {
        if (isPortletURL && urlType == Bridge.PortletPhase.ACTION_PHASE)
        {
          baseURL = actionURL = mimeResponse.createActionURL();
        }
        else if (isPortletURL && urlType == Bridge.PortletPhase.RESOURCE_PHASE)
        {
          baseURL = resourceURL = mimeResponse.createResourceURL();
        }
        else
        {
          baseURL = actionURL = mimeResponse.createRenderURL();
        }
      }
      else
      {
        baseURL = actionURL = mimeResponse.createActionURL();
      }

      // Add parameters so they don't get lost
      Enumeration<String> list = queryStr.getParameterNames();
      while (list.hasMoreElements())
      {
        String param = list.nextElement().toString();
        if (actionURL != null && param.equals(Bridge.PORTLET_MODE_PARAMETER))
        {
          try
          {
            actionURL.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (actionURL != null && param.equals(Bridge.PORTLET_WINDOWSTATE_PARAMETER))
        {
          try
          {
            actionURL.setWindowState(new WindowState(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (param.equals(Bridge.PORTLET_SECURE_PARAMETER))
        {
          try
          {
            baseURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          baseURL.setParameter(param, queryStr.getParameter(param));
        }
      }

      // Some portlet containers implementing wsrp choose to separate the
      // consumer rewrite string that represents this URL using &amp; as the
      // spec allows for either that or &.  If the container has chosen to
      // to do such -- undo it (use & instead) as faces renderkits/response writers
      // may reencode when writing XMl content.
      url = baseURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else if (getPortletPhase() == Bridge.PortletPhase.ACTION_PHASE ||
             getPortletPhase() == Bridge.PortletPhase.EVENT_PHASE)
    { // action - write the viewId to navigational state
View Full Code Here

      return EVAL_BODY_INCLUDE;
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL = getBasePortletEnvironmentAndURL();

      setSecure(newPortletURL);

      // Include parameters as part of the tag request.

      if (!parameters.isEmpty())
      {
         newPortletURL.setParameters(getURLParameters());
      }
      return newPortletURL;
   }
View Full Code Here

      }
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL =  super.generateURL();

      if (!properties.isEmpty())
      {
         for (String name : properties.keySet())
         {
            List<String> props = properties.get(name);
            for (String prop : props)
            {
               newPortletURL.setProperty(name, prop);
            }
         }
      }

      return newPortletURL;
View Full Code Here

      return typeParameter;
   }

   protected BaseURL generateURL() throws Exception
   {
      BaseURL newPortletURL = super.generateURL();

      setId((ResourceURL)newPortletURL);
      setCacheability((ResourceURL)newPortletURL);

      return newPortletURL;
View Full Code Here

TOP

Related Classes of javax.portlet.BaseURL

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.