Package javax.portlet

Examples of javax.portlet.PortletURL


                            + e.getMessage());
                }
            }
           
            //  Any HREFs and Form actions should be extended with the ActionURL
        PortletURL actionURL = response.createActionURL();
        byte[] content = this.doWebContent(page, actionURL, PerlParameters.ACTION_PARAMETER_PERL);
        ByteArrayInputStream bais = new ByteArrayInputStream(content);
        OutputStream oswriter = response.getPortletOutputStream();
       
        int BLOCK_SIZE = 4096;
View Full Code Here


         
          //PostProcess:
          //  replace all relative links with actions
         
          //Any HREFs and Form actions should be extended with the ActionURL
          PortletURL actionURL = response.createActionURL();
         
          // Get the buffered page from the PHP servlet
          StringBuffer page = phpServletImpl.getSourcePage();
         
          // Call into the PostProcess object which is the same for PERL and other script engine
View Full Code Here

        // in the node name, could remove this code if encode URL
        // and later request.getParameter() could deal with = and &
        // character in parameter values.
        String encodedNodeName = URLEncoder.encode(node.getName());

        PortletURL treeActionUrl = renderResponse.createActionURL();
        treeActionUrl.setParameter("node", node.getName());
        String treeAction = treeActionUrl.toString();
//        String action = replace(getAction(), "${name}", encodedNodeName);

       
//        String updateTreeAction =
//            replace(getAction(), "tree=${name}", "select=" + encodedNodeName);
//        updateTreeAction =
//            ((HttpServletResponse) pageContext.getResponse()).
//            encodeURL(updateTreeAction);

        out.print("    <td>");
       
    //add an anchor so that we can return to this node
        out.print("<a name=\"");
        out.print(node.getName());
        out.print("\">");
       
        if ((action != null) && !node.isLeaf()) {
            out.print("<a href=\"");
            out.print(response.encodeURL(treeAction));
            out.print("\">");
        }
        out.print("<img src=\"");
        out.print(images);
        out.print("/");
        if (node.isLeaf()) {
            if (node.isLast())
                out.print(IMAGE_LINE_LAST);
            else
                out.print(IMAGE_LINE_MIDDLE);
            out.print("\" alt=\"");
        } else if (node.isExpanded()) {
            if (node.isLast())
                out.print(IMAGE_HANDLE_DOWN_LAST);
            else
                out.print(IMAGE_HANDLE_DOWN_MIDDLE);
            out.print("\" alt=\"close node");
        } else {
            if (node.isLast())
                out.print(IMAGE_HANDLE_RIGHT_LAST);
            else
                out.print(IMAGE_HANDLE_RIGHT_MIDDLE);
            out.print("\" alt=\"expand node");
        }
        out.print("\" border=\"0\">");
        if ((action != null) && !node.isLeaf())
            out.print("</a>");
        out.println("</td>");

        // Calculate the hyperlink for this node (if any)
        String hyperlink = null;
        String nodeAction = node.getAction();
        if(nodeAction == null && node.isExpandWhenClicked())
        {
            hyperlink = treeAction;
        }
        if (nodeAction != null)
        {
            if(node.getAction().equals("portlet_url"))
            {
                PortletURL actionUrl = renderResponse.createActionURL();
                actionUrl.setParameter("select_node", node.getName());
                hyperlink = ((HttpServletResponse) pageContext.getResponse()).encodeURL(actionUrl.toString());
            }
            else
            {
              hyperlink = ((HttpServletResponse) pageContext.getResponse()).
                  encodeURL(node.getAction());
View Full Code Here

        if (response instanceof MimeResponse) {
            String actionKey = "" + System.currentTimeMillis();
            while (sharedParameterActionNameMap.containsKey(actionKey)) {
                actionKey = actionKey + ".";
            }
            PortletURL actionUrl = generateActionURL(actionKey);
            if (actionUrl != null) {
                sharedParameterActionNameMap.put(actionKey, name);
                sharedParameterActionValueMap.put(actionKey, value);
                window.open(new ExternalResource(actionUrl.toString()));
            } else {
                // this should never happen as we already know the response is a
                // MimeResponse
                throw new IllegalStateException(
                        "Shared parameters can only be set from a portlet request");
View Full Code Here

     *             (configuration, permissions etc.)
     */
    public void setPortletMode(Window window, PortletMode portletMode)
            throws IllegalStateException, PortletModeException {
        if (response instanceof MimeResponse) {
            PortletURL url = ((MimeResponse) response).createRenderURL();
            url.setPortletMode(portletMode);
            window.open(new ExternalResource(url.toString()));
        } else if (response instanceof StateAwareResponse) {
            ((StateAwareResponse) response).setPortletMode(portletMode);
        } else {
            throw new IllegalStateException(
                    "Portlet mode can only be changed from a portlet request");
View Full Code Here

        /*
         * We need this in order to get uploads to work. TODO this is not needed
         * 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", "''");
View Full Code Here

     * @param action
     * @return action URL or null if called outside a MimeRequest (outside a
     *         UIDL request or similar)
     */
    public PortletURL generateActionURL(String action) {
        PortletURL url = null;
        if (response instanceof MimeResponse) {
            url = ((MimeResponse) response).createActionURL();
            url.setParameter("javax.portlet.action", action);
        } else {
            return null;
        }
        return url;
    }
View Full Code Here

        if (response instanceof MimeResponse) {
            String actionKey = "" + System.currentTimeMillis();
            while (eventActionDestinationMap.containsKey(actionKey)) {
                actionKey = actionKey + ".";
            }
            PortletURL actionUrl = generateActionURL(actionKey);
            if (actionUrl != null) {
                eventActionDestinationMap.put(actionKey, name);
                eventActionValueMap.put(actionKey, value);
                window.open(new ExternalResource(actionUrl.toString()));
            } else {
                // this should never happen as we already know the response is a
                // MimeResponse
                throw new IllegalStateException(
                        "Portlet events can only be sent from a portlet request");
View Full Code Here

  /**
   * @return The action url.
   */
  public static String setViewIdForUrl(FacesContext facesContext, String viewId) {
    RenderResponse response = (RenderResponse) facesContext.getExternalContext().getResponse();
    PortletURL url = response.createActionURL();
    url.setParameter(VIEW_ID, viewId);
    return url.toString();
  }
View Full Code Here

      // the viewId into
      // the response
      // (interaction
      // state)
      RenderResponse renderResponse = (RenderResponse) getResponse();
      PortletURL actionURL = null;
      // Non-JSF actions are renderURLs as we merely dispatch to them
      if (nonFacesAction)
      {
        if (isPortletURL && urlType == Bridge.PortletPhase.ACTION_PHASE)
        {
          actionURL = renderResponse.createActionURL();
        }
        else
        {
          actionURL = renderResponse.createRenderURL();
        }
      }
      else
      {
        actionURL = renderResponse.createActionURL();
      }

      // 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))
        {
          try
          {
            actionURL.setPortletMode(new PortletMode(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else if (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
          {
            actionURL.setSecure(Boolean.getBoolean(queryStr.getParameter(param)));
          }
          catch (Exception e)
          {
            ; // do nothing -- just ignore
          }
        }
        else
        {
          actionURL.setParameter(param, queryStr.getParameter(param));
        }
      }

      // TODO hack to workaround double encoding problem
      url = actionURL.toString();
      url = url.replaceAll("\\&amp\\;", "&");
    }
    else
    { // action - write the viewId to navigational state
      ActionResponse actionResponse = (ActionResponse) getResponse();
View Full Code Here

TOP

Related Classes of javax.portlet.PortletURL

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.