Examples of PortletURL


Examples of javax.portlet.PortletURL

            } else {
                writer.write("    Key: " + key + " Value: <br />");
            }
        }

        PortletURL url;
        url = res.createActionURL();
        url.setPortletMode(PortletMode.EDIT);

        writer.write("<form method=\"POST\" action=\"" + url.toString() + "\"><br />");
        writer.write("Update Preferences: <br />");
        writer.write("  Key: <input type=\"text\" name=\"name\" size=\"16\" maxlength=\"16\">");
        writer.write("  Value: <input type=\"text\" name=\"value\" size=\"32\" maxlength=\"32\">");
        writer.write("<br /><input type=\"submit\" value=\"Update Preferences\"/>");
        writer.write("</form>");
        writer.write("<table><tr><td>Change Portlet Mode:</td>");

        url = res.createRenderURL();
        url.setPortletMode(PortletMode.EDIT);
        this.writeLink(writer, url, "Edit");


        url = res.createRenderURL();
        url.setPortletMode(PortletMode.HELP);
        this.writeLink(writer, url, "Help");

        url = res.createRenderURL();
        url.setPortletMode(PortletMode.VIEW);
        this.writeLink(writer, url, "View");
       
        writer.write("</tr><tr><td>Change Window Mode:</td>");
        url = res.createRenderURL();
        url.setWindowState(WindowState.MINIMIZED);
        this.writeLink(writer, url, "Minimized");

        url = res.createRenderURL();
        url.setWindowState(WindowState.NORMAL);
        this.writeLink(writer, url, "Normal");

        url = res.createRenderURL();
        url.setWindowState(WindowState.MAXIMIZED);
        this.writeLink(writer, url, "Maximized");
        writer.write("</tr></table>");
    }
View Full Code Here

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

Examples of javax.portlet.PortletURL

         
          //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

Examples of javax.portlet.PortletURL

        // 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

Examples of javax.portlet.PortletURL

        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

Examples of javax.portlet.PortletURL

     *             (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

Examples of javax.portlet.PortletURL

        /*
         * 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

Examples of javax.portlet.PortletURL

     * @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

Examples of javax.portlet.PortletURL

        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

Examples of javax.portlet.PortletURL

  /**
   * @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
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.