Example usage for javax.servlet.jsp JspFactory releasePageContext

List of usage examples for javax.servlet.jsp JspFactory releasePageContext

Introduction

In this page you can find the example usage for javax.servlet.jsp JspFactory releasePageContext.

Prototype


public abstract void releasePageContext(PageContext pc);

Source Link

Document

called to release a previously allocated PageContext object.

Usage

From source file:org.apache.jsp.html.portlet.ext.ecommerce.admin.view_jsp.java

public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;//  www.  j  av  a2  s. c  om
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
        _jspxFactory = JspFactory.getDefaultFactory();
        response.setContentType("text/html; charset=UTF-8");
        pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
        _jspx_page_context = pageContext;
        application = pageContext.getServletContext();
        config = pageContext.getServletConfig();
        session = pageContext.getSession();
        out = pageContext.getOut();
        _jspx_out = out;

        out.write('\n');

        /**
         * Copyright (c) 2000-2006 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //  liferay-theme:defineObjects
        com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.theme.DefineObjectsTag.class);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doStartTag();
        if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0
                .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody
                .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0);
        com.liferay.portal.theme.ThemeDisplay themeDisplay = null;
        com.liferay.portal.model.Company company = null;
        com.liferay.portal.model.Account account = null;
        com.liferay.portal.model.User user = null;
        com.liferay.portal.model.User realUser = null;
        com.liferay.portal.model.Contact contact = null;
        com.liferay.portal.model.Layout layout = null;
        java.util.List layouts = null;
        java.lang.Long plid = null;
        com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null;
        java.lang.Long portletGroupId = null;
        com.liferay.portal.kernel.security.permission.PermissionChecker permissionChecker = null;
        java.util.Locale locale = null;
        java.util.TimeZone timeZone = null;
        com.liferay.portal.model.Theme theme = null;
        com.liferay.portal.model.ColorScheme colorScheme = null;
        com.liferay.portal.theme.PortletDisplay portletDisplay = null;
        themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay");
        company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company");
        account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account");
        user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user");
        realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser");
        contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact");
        layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout");
        layouts = (java.util.List) _jspx_page_context.findAttribute("layouts");
        plid = (java.lang.Long) _jspx_page_context.findAttribute("plid");
        layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context
                .findAttribute("layoutTypePortlet");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        permissionChecker = (com.liferay.portal.kernel.security.permission.PermissionChecker) _jspx_page_context
                .findAttribute("permissionChecker");
        locale = (java.util.Locale) _jspx_page_context.findAttribute("locale");
        timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone");
        theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme");
        colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme");
        portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context
                .findAttribute("portletDisplay");
        out.write("\r\n");
        out.write("\r\n");

        /**
         * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        //@ page import="com.liferay.portal.kernel.util.PortletExtKeys" 
        out.write("\r\n");
        out.write("\r\n");

        String contextPath = PropsUtil.get(PropsUtil.PORTAL_CTX);
        if (contextPath.equals("/")) {
            contextPath = "";
        }

        out.write('\r');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write('\n');
        out.write('\n');
        //  portlet:defineObjects
        com.liferay.taglib.portlet.DefineObjectsTag _jspx_th_portlet_005fdefineObjects_005f0 = (com.liferay.taglib.portlet.DefineObjectsTag) _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.portlet.DefineObjectsTag.class);
        _jspx_th_portlet_005fdefineObjects_005f0.setPageContext(_jspx_page_context);
        _jspx_th_portlet_005fdefineObjects_005f0.setParent(null);
        int _jspx_eval_portlet_005fdefineObjects_005f0 = _jspx_th_portlet_005fdefineObjects_005f0.doStartTag();
        if (_jspx_th_portlet_005fdefineObjects_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_portlet_005fdefineObjects_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .reuse(_jspx_th_portlet_005fdefineObjects_005f0);
        javax.portlet.PortletConfig portletConfig = null;
        java.lang.String portletName = null;
        javax.portlet.PortletPreferences portletPreferences = null;
        javax.portlet.PortletSession portletSession = null;
        javax.portlet.RenderRequest renderRequest = null;
        javax.portlet.RenderResponse renderResponse = null;
        portletConfig = (javax.portlet.PortletConfig) _jspx_page_context.findAttribute("portletConfig");
        portletName = (java.lang.String) _jspx_page_context.findAttribute("portletName");
        portletPreferences = (javax.portlet.PortletPreferences) _jspx_page_context
                .findAttribute("portletPreferences");
        portletSession = (javax.portlet.PortletSession) _jspx_page_context.findAttribute("portletSession");
        renderRequest = (javax.portlet.RenderRequest) _jspx_page_context.findAttribute("renderRequest");
        renderResponse = (javax.portlet.RenderResponse) _jspx_page_context.findAttribute("renderResponse");
        out.write('\n');
        out.write('\n');

        PortletURL currentURLObj = PortletURLUtil.getCurrent(renderRequest, renderResponse);

        //String currentURL = currentURLObj.toString();
        String currentURL = PortalUtil.getCurrentURL(request);

        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2006 Liferay, LLC. All rights reserved.
         *
         * Permission is hereby granted, free of charge, to any person obtaining a copy
         * of this software and associated documentation files (the "Software"), to deal
         * in the Software without restriction, including without limitation the rights
         * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         * copies of the Software, and to permit persons to whom the Software is
         * furnished to do so, subject to the following conditions:
         *
         * The above copyright notice and this permission notice shall be included in
         * all copies or substantial portions of the Software.
         *
         * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         * SOFTWARE.
         */

        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");

        String defLang = com.liferay.portal.util.PropsUtil.get("locale.default");
        //String redirect = (String)request.getParameter("redirect");
        PortletRequest portletRequest = (PortletRequest) request
                .getAttribute(com.liferay.portal.kernel.util.JavaConstants.JAVAX_PORTLET_REQUEST);
        String portletID = null;
        if (portletRequest instanceof RenderRequest) {
            RenderRequestImpl req = (RenderRequestImpl) portletRequest;
            portletID = req.getPortletName();
        } else {
            ActionRequestImpl req = (ActionRequestImpl) portletRequest;
            portletID = req.getPortletName();
        }

        boolean managetopic = true;

        Boolean managetopics = (Boolean) request.getAttribute("managetopics");

        if (managetopics != null) {
            managetopic = managetopics.booleanValue();
        } else {
            String isTopicPermissions = GetterUtil.getString(PropsUtil.get("gn.topics.permissions"), "off");
            int isTopics = 0;
            if (request.getAttribute("isTopics") != null)
                isTopics = ((Integer) request.getAttribute("isTopics")).intValue();
            String topicid = (String) request.getParameter("topicid");

            if (isTopicPermissions.equals("on") && isTopics != GnPortletSetting.TOPICS_ENABLED_FALSE) {

                if (topicid != null && !topicid.equals("")
                        && !com.ext.portlet.topics.service.permission.GnTopicPermission.contains(
                                permissionChecker, new Integer(topicid),
                                com.liferay.portal.kernel.security.permission.ActionExtKeys.MANAGECONTENT))
                    managetopic = false;

            }
        }

        out.write('\n');
        out.write('\n');

        boolean hasAdmin = PortletPermissionUtil.contains(permissionChecker, plid, portletID,
                ActionExtKeys.ADMINISTRATE) && managetopic;
        boolean hasPublish = PermissionsService.getInstance()
                .isPortletPublishingEnabled(PortalUtil.getCompanyId(request), portletID)
                && PortletPermissionUtil.contains(permissionChecker, plid, portletID, ActionExtKeys.PUBLISH)
                && managetopic;
        boolean hasViewUnPublished = hasPublish; //PermissionsService.getInstance().isPortletPublishingEnabled(portletID) && PortletPermission.contains(permissionChecker, plid, portletID, ActionExtKeys.VIEW_UNPUBLISHED) && managetopic;
        boolean hasAdd = PortletPermissionUtil.contains(permissionChecker, plid, portletID, ActionExtKeys.ADD)
                && managetopic;
        boolean hasEdit = PortletPermissionUtil.contains(permissionChecker, plid, portletID, ActionExtKeys.EDIT)
                && managetopic;
        boolean hasDelete = PortletPermissionUtil.contains(permissionChecker, plid, portletID,
                ActionExtKeys.DELETE) && managetopic;

        out.write('\n');
        out.write('\n');
        out.write('\n');
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");

        PortletPreferences prefs = renderRequest.getPreferences();

        String portletResource = ParamUtil.getString(request, "portletResource");

        if (Validator.isNotNull(portletResource)) {
            prefs = PortletPreferencesFactoryUtil.getPortletSetup(request, portletResource, true, true);
        }

        int instanceTopicId = GetterUtil.getInteger(prefs.getValue("topic-id", StringPool.BLANK));
        String instancePortletSearch = GetterUtil.getString(prefs.getValue("portlet-search", StringPool.BLANK));
        String instancePortletBrowseType = GetterUtil
                .getString(prefs.getValue("browse-type", StringPool.BLANK));
        String instancePortletListStyle = ParamUtil.getString(request, "listStyle",
                prefs.getValue("list-style", StringPool.BLANK));
        String instancePortletTopicStyle = ParamUtil.getString(request, "topicStyle",
                prefs.getValue("topic-style", StringPool.BLANK));

        String instancePortletShowRelContent = prefs.getValue("showRelContent", StringPool.BLANK);
        String instancePortletShowRelContentDescription = prefs.getValue("showRelContentDescription",
                StringPool.BLANK);
        com.ext.portlet.base.contentrel.ContentRelUtil relUtil = com.ext.portlet.base.contentrel.ContentRelUtil
                .getInstance();
        String[] classNames = relUtil.getPortletClassNames();
        String[] portletNames = relUtil.getPortletNames();

        String instanceYearsStartYear = GetterUtil
                .getString(prefs.getValue("years_startYear", StringPool.BLANK));
        boolean instanceYearsShowFuture = GetterUtil.getBoolean(prefs.getValue("years_showFuture", "true"),
                true);
        boolean instanceYearsShowEmptyYears = GetterUtil
                .getBoolean(prefs.getValue("years_showEmptyYears", "true"), true);

        boolean topicsOnOff = GetterUtil.getBoolean(prefs.getValue("topicsOnOff", "false"), false);
        String topicFieldSetkey = GetterUtil.getString(prefs.getValue("topicFieldSetkey", StringPool.BLANK));

        String instanceUseTopicNav = GetterUtil.getString(prefs.getValue("use-topic-nav", "no"));

        boolean enableRatings = GetterUtil.getBoolean(prefs.getValue("enableRatings", StringPool.BLANK), false);
        boolean enableComments = GetterUtil.getBoolean(prefs.getValue("enableComments", StringPool.BLANK),
                false);

        String instanceEmbedMedia = GetterUtil.getString(prefs.getValue("embed_media", "no"));
        String instanceRelEmbedMedia = GetterUtil.getString(prefs.getValue("embed_rel_media", "no"));

        boolean showOnlyMine = GetterUtil.getBoolean(prefs.getValue("showOnlyMine", StringPool.BLANK), false);
        boolean notifyPublisher = GetterUtil.getBoolean(prefs.getValue("notifyPublisher", StringPool.BLANK),
                false);

        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        out.write("\n");
        //  portlet:defineObjects
        com.liferay.taglib.portlet.DefineObjectsTag _jspx_th_portlet_005fdefineObjects_005f1 = (com.liferay.taglib.portlet.DefineObjectsTag) _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .get(com.liferay.taglib.portlet.DefineObjectsTag.class);
        _jspx_th_portlet_005fdefineObjects_005f1.setPageContext(_jspx_page_context);
        _jspx_th_portlet_005fdefineObjects_005f1.setParent(null);
        int _jspx_eval_portlet_005fdefineObjects_005f1 = _jspx_th_portlet_005fdefineObjects_005f1.doStartTag();
        if (_jspx_th_portlet_005fdefineObjects_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                    .reuse(_jspx_th_portlet_005fdefineObjects_005f1);
            return;
        }
        _005fjspx_005ftagPool_005fportlet_005fdefineObjects_005fnobody
                .reuse(_jspx_th_portlet_005fdefineObjects_005f1);
        portletConfig = (javax.portlet.PortletConfig) _jspx_page_context.findAttribute("portletConfig");
        portletName = (java.lang.String) _jspx_page_context.findAttribute("portletName");
        portletPreferences = (javax.portlet.PortletPreferences) _jspx_page_context
                .findAttribute("portletPreferences");
        portletSession = (javax.portlet.PortletSession) _jspx_page_context.findAttribute("portletSession");
        renderRequest = (javax.portlet.RenderRequest) _jspx_page_context.findAttribute("renderRequest");
        renderResponse = (javax.portlet.RenderResponse) _jspx_page_context.findAttribute("renderResponse");
        out.write('\n');
        out.write('\n');

        String redirect = (String) request.getParameter("redirect");

        long rootPlid1 = GetterUtil.getLong(prefs.getValue("root-plid", StringPool.BLANK));

        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        out.write("\r\n");
        String propertiesNamespace = GetterUtil.getString(prefs.getValue("propertiesNamespace", "eshop"));
        out.write("\r\n");
        out.write("\r\n");
        out.write("<form action=\"");
        if (_jspx_meth_portlet_005factionURL_005f0(_jspx_page_context))
            return;
        out.write("\"  method=\"post\" enctype=\"multipart/form-data\" >\r\n");
        out.write("<table>\t\t\r\n");
        out.write("\t");

        List headerNames = new ArrayList();

        headerNames.add("property");
        headerNames.add("value");

        Map portalProps = new TreeMap();

        portalProps.putAll(GnPropsUtil.getProperties(propertiesNamespace));

        List results = ListUtil.fromCollection(portalProps.entrySet());

        for (int i = 0; i < results.size(); i++) {
            Map.Entry entry = (Map.Entry) results.get(i);

            String property = (String) entry.getKey();
            String value = (String) entry.getValue();
            if (!property.equals("include-and-override")) {

                out.write("\r\n");
                out.write("\t\t\t<tr><td>");
                out.print(LanguageUtil.get(pageContext, property));
                out.write(" : </td><td><input name=\"");
                out.print(property);
                out.write("\" value=\"");
                out.print(value);
                out.write("\" type=\"text\"></td></tr>\r\n");
                out.write("\t");

            }
        }

        out.write("\r\n");
        out.write("\t\t\t<tr><td>\t\r\n");
        out.write("\t\t\t\t<input type=\"hidden\" name=\"submitted\" value=\"1\">\r\n");
        out.write("\t\t\t\t<input type=\"submit\" value=\"");
        out.print(LanguageUtil.get(pageContext, "save"));
        out.write("\">\r\n");
        out.write("\t\t\t\t</td>\r\n");
        out.write("\t\t\t</tr>\r\n");
        out.write("</table>\r\n");
        out.write("</form>\r\n");
        out.write("\r\n");
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        if (_jspxFactory != null)
            _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

From source file:org.apache.struts2.dispatcher.VelocityResult.java

/**
 * Creates a Velocity context from the action, loads a Velocity template and executes the
 * template. Output is written to the servlet output stream.
 *
 * @param finalLocation the location of the Velocity template
 * @param invocation    an encapsulation of the action execution state.
 * @throws Exception if an error occurs when creating the Velocity context, loading or executing
 *                   the template or writing output to the servlet response stream.
 *//*from  w ww.j a  v a2 s  .  c om*/
public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
    ValueStack stack = ActionContext.getContext().getValueStack();

    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    JspFactory jspFactory = null;
    ServletContext servletContext = ServletActionContext.getServletContext();
    Servlet servlet = JspSupportServlet.jspSupportServlet;

    velocityManager.init(servletContext);

    boolean usedJspFactory = false;
    PageContext pageContext = (PageContext) ActionContext.getContext().get(ServletActionContext.PAGE_CONTEXT);

    if (pageContext == null && servlet != null) {
        jspFactory = JspFactory.getDefaultFactory();
        pageContext = jspFactory.getPageContext(servlet, request, response, null, true, 8192, true);
        ActionContext.getContext().put(ServletActionContext.PAGE_CONTEXT, pageContext);
        usedJspFactory = true;
    }

    try {
        String encoding = getEncoding(finalLocation);
        String contentType = getContentType(finalLocation);

        if (encoding != null) {
            contentType = contentType + ";charset=" + encoding;
        }

        Template t = getTemplate(stack, velocityManager.getVelocityEngine(), invocation, finalLocation,
                encoding);

        Context context = createContext(velocityManager, stack, request, response, finalLocation);
        Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding);

        response.setContentType(contentType);

        t.merge(context, writer);

        // always flush the writer (we used to only flush it if this was a jspWriter, but someone asked
        // to do it all the time (WW-829). Since Velocity support is being deprecated, we'll oblige :)
        writer.flush();
    } catch (Exception e) {
        log.error("Unable to render Velocity Template, '" + finalLocation + "'", e);
        throw e;
    } finally {
        if (usedJspFactory) {
            jspFactory.releasePageContext(pageContext);
        }
    }

    return;
}

From source file:org.apache.struts2.portlet.result.PortletVelocityResult.java

/**
 * Creates a Velocity context from the action, loads a Velocity template and
 * executes the template. Output is written to the servlet output stream.
 *
 * @param finalLocation the location of the Velocity template
 * @param invocation an encapsulation of the action execution state.
 * @throws Exception if an error occurs when creating the Velocity context,
 *         loading or executing the template or writing output to the
 *         servlet response stream./*from  w w  w.  jav  a  2s  .c o m*/
 */
public void executeRenderResult(String finalLocation, ActionInvocation invocation) throws Exception {
    prepareServletActionContext();
    ValueStack stack = ActionContext.getContext().getValueStack();

    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    JspFactory jspFactory = null;
    ServletContext servletContext = ServletActionContext.getServletContext();
    Servlet servlet = JspSupportServlet.jspSupportServlet;

    velocityManager.init(servletContext);

    boolean usedJspFactory = false;
    PageContext pageContext = (PageContext) ActionContext.getContext().get(ServletActionContext.PAGE_CONTEXT);

    if (pageContext == null && servlet != null) {
        jspFactory = JspFactory.getDefaultFactory();
        pageContext = jspFactory.getPageContext(servlet, request, response, null, true, 8192, true);
        ActionContext.getContext().put(ServletActionContext.PAGE_CONTEXT, pageContext);
        usedJspFactory = true;
    }

    try {
        String encoding = getEncoding(finalLocation);
        String contentType = getContentType(finalLocation);

        if (encoding != null) {
            contentType = contentType + ";charset=" + encoding;
        }

        Template t = getTemplate(stack, velocityManager.getVelocityEngine(), invocation, finalLocation,
                encoding);

        Context context = createContext(velocityManager, stack, request, response, finalLocation);
        Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding);

        response.setContentType(contentType);

        t.merge(context, writer);

        // always flush the writer (we used to only flush it if this was a
        // jspWriter, but someone asked
        // to do it all the time (WW-829). Since Velocity support is being
        // deprecated, we'll oblige :)
        writer.flush();
    } catch (Exception e) {
        log.error("Unable to render Velocity Template, '" + finalLocation + "'", e);
        throw e;
    } finally {
        if (usedJspFactory) {
            jspFactory.releasePageContext(pageContext);
        }
    }

    return;
}

From source file:org.apache.struts2.views.zipscript.ZipScriptResult.java

/**
 * Creates a ZipScript context from the action, loads a ZipScript template and
 * executes the template. Output is written to the servlet output stream.
 * //from  ww  w  .  j ava  2s.  c  om
 * @param finalLocation
 *            the location of the ZipScript template
 * @param invocation
 *            an encapsulation of the action execution state.
 * @throws Exception
 *             if an error occurs when creating the ZipScript context,
 *             loading or executing the template or writing output to the
 *             servlet response stream.
 */
public void doExecute(String finalLocation, ActionInvocation invocation) throws Exception {
    ResultData resultData = new ResultData(finalLocation);

    // get working values
    ValueStack stack = ActionContext.getContext().getValueStack();
    HttpServletRequest request = ServletActionContext.getRequest();
    HttpServletResponse response = ServletActionContext.getResponse();
    JspFactory jspFactory = null;
    ServletContext servletContext = ServletActionContext.getServletContext();
    Servlet servlet = JspSupportServlet.jspSupportServlet;

    if (null == zipScriptManager) {
        zipScriptManager = (ZipScriptManager) servletContext.getAttribute(ZipScriptManager.class.getName());
        if (null == zipScriptManager) {
            zipScriptManager = new ZipScriptManager();
            servletContext.setAttribute(ZipScriptManager.class.getName(), zipScriptManager);
        }
    }

    ZipEngine zipEngine = zipScriptManager.getZipEngine(servletContext);

    boolean usedJspFactory = false;
    PageContext pageContext = (PageContext) ActionContext.getContext().get(ServletActionContext.PAGE_CONTEXT);

    if (pageContext == null && servlet != null) {
        jspFactory = JspFactory.getDefaultFactory();
        pageContext = jspFactory.getPageContext(servlet, request, response, null, true, 8192, true);
        ActionContext.getContext().put(ServletActionContext.PAGE_CONTEXT, pageContext);
        usedJspFactory = true;
    }

    try {
        String encoding = getEncoding(finalLocation);
        String contentType = getContentType(finalLocation);

        if (encoding != null) {
            contentType = contentType + ";charset=" + encoding;
        }

        Writer writer = new OutputStreamWriter(response.getOutputStream(), encoding);
        Context context = zipScriptManager.createContext(invocation, resultData, request);
        loadContext(context);

        writeOutput(context, stack, zipEngine, invocation, resultData, servletContext, request, response,
                writer);

        response.setContentType(contentType);
        writer.flush();
    } catch (Exception e) {
        log.error("Unable to render ZipScript Template, '" + finalLocation + "'", e);
        throw e;
    } catch (Throwable e) {
        log.error("Unable to render ZipScript Template, '" + finalLocation + "'", e);
        throw new Exception(e);
    } finally {
        if (usedJspFactory) {
            jspFactory.releasePageContext(pageContext);
        }
    }
    return;
}