Package javax.portlet

Examples of javax.portlet.PortletRequestDispatcher


        if (app != null) {
            PortletSession sess = request.getPortletSession();
            PortletApplicationContext ctx = PortletApplicationContext
                    .getApplicationContext(sess);

            PortletRequestDispatcher dispatcher = sess.getPortletContext()
                    .getRequestDispatcher("/" + app);

            try {
                // portal-wide settings
                PortalContext portalCtx = request.getPortalContext();

                boolean isLifeRay = portalCtx.getPortalInfo().toLowerCase()
                        .contains("liferay");

                request.setAttribute(ApplicationServlet.REQUEST_FRAGMENT,
                        "true");

                // fixed base theme to use - all portal pages with Vaadin
                // applications will load this exactly once
                String portalTheme = getPortalProperty(
                        Constants.PORTAL_PARAMETER_VAADIN_THEME, portalCtx);

                String portalWidgetset = getPortalProperty(
                        Constants.PORTAL_PARAMETER_VAADIN_WIDGETSET, portalCtx);

                // location of the widgetset(s) and default theme (to which
                // /VAADIN/widgetsets/...
                // is appended)
                String portalResourcePath = getPortalProperty(
                        Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH,
                        portalCtx);

                if (portalResourcePath != null) {
                    // if portalResourcePath is defined, set it as a request
                    // parameter which will override the default location in
                    // servlet
                    request.setAttribute(
                            ApplicationServlet.REQUEST_VAADIN_STATIC_FILE_PATH,
                            portalResourcePath);
                }

                // - if the user has specified a widgetset for this portlet, use
                // it from the portlet (not fully supported)
                // - otherwise, if specified, use the portal-wide widgetset
                // and widgetset path settings (recommended)
                // - finally, default to use the default widgetset if nothing
                // else is found
                if (portletWidgetset != null) {
                    request.setAttribute(ApplicationServlet.REQUEST_WIDGETSET,
                            portletWidgetset);
                }
                if (portalWidgetset != null) {
                    request.setAttribute(
                            ApplicationServlet.REQUEST_SHARED_WIDGETSET,
                            portalWidgetset);
                }

                if (style != null) {
                    request.setAttribute(ApplicationServlet.REQUEST_APPSTYLE,
                            style);
                }

                // portalTheme is only used if the shared portal resource
                // directory is defined
                if (portalTheme != null && portalResourcePath != null) {
                    request.setAttribute(
                            ApplicationServlet.REQUEST_DEFAULT_THEME,
                            portalTheme);

                    String defaultThemeUri = null;
                    defaultThemeUri = portalResourcePath + "/"
                            + AbstractApplicationServlet.THEME_DIRECTORY_PATH
                            + portalTheme;
                    /*
                     * Make sure portal default Vaadin theme is included in DOM.
                     * Vaadin portlet themes do not "inherit" base theme, so we
                     * need to force loading of the common base theme.
                     */
                    OutputStream out = response.getPortletOutputStream();

                    // Using portal-wide theme
                    String loadDefaultTheme = ("<script type=\"text/javascript\">\n"
                            + "if(!vaadin) { var vaadin = {} } \n"
                            + "if(!vaadin.themesLoaded) { vaadin.themesLoaded = {} } \n"
                            + "if(!vaadin.themesLoaded['"
                            + portalTheme
                            + "']) {\n"
                            + "var stylesheet = document.createElement('link');\n"
                            + "stylesheet.setAttribute('rel', 'stylesheet');\n"
                            + "stylesheet.setAttribute('type', 'text/css');\n"
                            + "stylesheet.setAttribute('href', '"
                            + defaultThemeUri
                            + "/styles.css');\n"
                            + "document.getElementsByTagName('head')[0].appendChild(stylesheet);\n"
                            + "vaadin.themesLoaded['"
                            + portalTheme
                            + "'] = true;\n}\n" + "</script>\n");
                    out.write(loadDefaultTheme.getBytes());
                }

                dispatcher.include(request, response);

                if (isLifeRay) {
                    /*
                     * Temporary support to heartbeat Liferay session when using
                     * Vaadin based portlet. We hit an extra xhr to liferay
View Full Code Here


            putRequestVariable(request, "ERRORS", errors);
        }
        request.setAttribute(FrameworkConstants.MODEL_TOOL, model);

        PortletContext context = getPortletContext();
        PortletRequestDispatcher rd = context.getRequestDispatcher(template);
        rd.include(request, response);
    }
View Full Code Here

        }

        if (customPage != null)
        {
            PortletContext context = getPortletContext();
            PortletRequestDispatcher rd = context.getRequestDispatcher(customPage);
            rd.include(request, response);
        }
        return;
    }
View Full Code Here

        }

        if (editPage != null)
        {
            PortletContext context = getPortletContext();
            PortletRequestDispatcher rd = context.getRequestDispatcher(editPage);
            rd.include(request, response);
        }
        return;
    }
View Full Code Here

        }

        if (helpPage != null)
        {
            PortletContext context = getPortletContext();
            PortletRequestDispatcher rd = context.getRequestDispatcher(helpPage);
            rd.include(request, response);
        }
        return;
    }
View Full Code Here

        }

        if (viewPage != null)
        {
            PortletContext context = getPortletContext();
            PortletRequestDispatcher rd = context.getRequestDispatcher(viewPage);
            rd.include(request, response);
        }
        return;
    }
View Full Code Here

        }
        if (!(this.portletRequest instanceof RenderRequest))
        {
            throw new IllegalArgumentException("Only RenderRequest can be dispatched");
        }
        PortletRequestDispatcher portletRequestDispatcher = this.portletContext.getRequestDispatcher(requestURI);
        try
        {
            portletRequestDispatcher
                    .include((RenderRequest) this.portletRequest, (RenderResponse) this.portletResponse);
        }
        catch (PortletException e)
        {
            if (e.getMessage() != null)
View Full Code Here

        { // dispatch only allowed for RenderRequest
            String msg = "Can not call dispatch() during a portlet ActionRequest";
            throw new IllegalStateException(msg);
        }

        PortletRequestDispatcher requestDispatcher
            = _portletContext.getRequestDispatcher(path); //TODO: figure out why I need named dispatcher
        try
        {
            requestDispatcher.include((RenderRequest)_portletRequest,
                                      (RenderResponse)_portletResponse);
        }
        catch (PortletException e)
        {
            if (e.getMessage() != null)
View Full Code Here

    if (mPhase == Bridge.PortletPhase.ACTION_PHASE)
    {
      throw new IllegalStateException("Request cannot be an ActionRequest");
    }

    PortletRequestDispatcher prd = mPortletContext.getRequestDispatcher(requestURI);

    if (prd == null)
    {
      throw new IllegalArgumentException("No request dispatcher can be created for the specified path: " +
                                         requestURI);
    }

    try
    {
      prd.include((RenderRequest) mOrigPortletRequest, (RenderResponse) mOrigPortletResponse);
    }
    catch (PortletException e)
    {
      if (e.getMessage() != null)
      {
View Full Code Here

      res.setTitle(title);
    }
    LOG.debug("Location: " + finalLocation);
    if (useDispatcherServlet) {
      req.setAttribute(DISPATCH_TO, finalLocation);
      PortletRequestDispatcher dispatcher = ctx.getNamedDispatcher(dispatcherServletName);
      if(dispatcher == null) {
        throw new PortletException("Could not locate dispatcher servlet \"" + dispatcherServletName + "\". Please configure it in your web.xml file");
      }
      dispatcher.include(req, res);
    } else {
      PortletRequestDispatcher dispatcher = ctx.getRequestDispatcher(finalLocation);
      if (dispatcher == null) {
        throw new PortletException("Could not locate dispatcher for '" + finalLocation + "'");
      }
      dispatcher.include(req, res);
    }
  }
View Full Code Here

TOP

Related Classes of javax.portlet.PortletRequestDispatcher

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.