Example usage for javax.servlet.http HttpServletRequest removeAttribute

List of usage examples for javax.servlet.http HttpServletRequest removeAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest removeAttribute.

Prototype

public void removeAttribute(String name);

Source Link

Document

Removes an attribute from this request.

Usage

From source file:org.theospi.portfolio.matrix.util.MatrixJsfTool.java

@Override
protected void dispatch(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    logger.debug("dispatch()");

    String target = req.getPathInfo();

    ToolSession session = sessionManager.getCurrentToolSession();

    if (logger.isDebugEnabled()) {
        Map<String, String[]> reqParms = req.getParameterMap();
        for (Map.Entry<String, String[]> entry : reqParms.entrySet()) {
            StringBuffer sb = new StringBuffer();
            sb.append("REQ_PARM: ");
            sb.append(entry.getKey());/*from   ww  w . j a  v a2 s .  c  o m*/
            sb.append(" = ");
            sb.append('[');
            String[] reqParm = entry.getValue();
            for (int i = 0; i < reqParm.length;) {
                sb.append(reqParm[i]);
                if (++i < reqParm.length) {
                    sb.append(", ");
                }
            }
            sb.append(']');
            logger.debug(sb.toString());
        }
        Enumeration<String> sessionParmNames = session.getAttributeNames();
        while (sessionParmNames.hasMoreElements()) {
            String sessionParmName = sessionParmNames.nextElement();
            logger.debug("SESS_PARM: " + sessionParmName + " = " + session.getAttribute(sessionParmName));
        }
    }

    // see if this is the helper trying to return to caller
    if (HELPER_RETURN_NOTIFICATION.equals(target)) {
        target = (String) session.getAttribute(toolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
        if (target != null) {

            // FIXME: Workaround for
            // http://bugs.sakaiproject.org/jira/browse/GM-88
            Object viewCollection = session.getAttribute(STORED_MYFACES_VIEW_COLLECTION);
            if (viewCollection != null) {
                session.removeAttribute(STORED_MYFACES_VIEW_COLLECTION);
                session.setAttribute(MYFACES_VIEW_COLLECTION, viewCollection);
            }

            session.removeAttribute(toolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
            res.sendRedirect(target);
            return;
        }
    }

    // Need this here until ToolServlet is updated to support this in
    // sendToHelper method
    // http://bugs.sakaiproject.org/jira/browse/SAK-9043
    // http://bugs.sakaiproject.org/jira/browse/GM-69
    Enumeration<String> params = req.getParameterNames();
    while (params.hasMoreElements()) {
        String paramName = params.nextElement();
        if (paramName.startsWith(HELPER_SESSION_PREFIX)) {
            String attributeName = paramName.substring(HELPER_SESSION_PREFIX.length());
            session.setAttribute(attributeName, req.getParameter(paramName));
        }
    }

    if (sendToHelper(req, res, target)) {
        return;
    }

    // see if we have a resource request - i.e. a path with an extension,
    // and one that is not the JSF_EXT
    if (isResourceRequest(target)) {
        // get a dispatcher to the path
        RequestDispatcher resourceDispatcher = getServletContext().getRequestDispatcher(target);
        if (resourceDispatcher != null) {
            resourceDispatcher.forward(req, res);
            return;
        }
    }

    if ("Title".equals(req.getParameter(PANEL))) {
        // This allows only one Title JSF for each tool
        target = "/title.jsf";

    } else {

        if ((target == null) || "/".equals(target)) {
            target = computeDefaultTarget();

            // make sure it's a valid path
            if (!target.startsWith("/")) {
                target = "/" + target;
            }

            // now that we've messed with the URL, send a redirect to make
            // it official
            res.sendRedirect(Web.returnUrl(req, target));
            return;
        }

        // see if we want to change the specifically requested view
        String newTarget = redirectRequestedTarget(target);

        // make sure it's a valid path
        if (!newTarget.startsWith("/")) {
            newTarget = "/" + newTarget;
        }

        if (!newTarget.equals(target)) {
            // now that we've messed with the URL, send a redirect to make
            // it official
            res.sendRedirect(Web.returnUrl(req, newTarget));
            return;
        }
        target = newTarget;

        // store this
        if (m_defaultToLastView) {
            session.setAttribute(LAST_VIEW_VISITED, target);
        }
    }

    // add the configured folder root and extension (if missing)
    target = m_path + target;

    // add the default JSF extension (if we have no extension)
    int lastSlash = target.lastIndexOf('/');
    int lastDot = target.lastIndexOf('.');
    if ((lastDot < 0) || (lastDot < lastSlash)) {
        target += JSF_EXT;
    }

    // set the information that can be removed from return URLs
    req.setAttribute(URL_PATH, m_path);
    req.setAttribute(URL_EXT, ".jsp");

    // set the sakai request object wrappers to provide the native, not
    // Sakai set up, URL information
    // - this assures that the FacesServlet can dispatch to the proper view
    // based on the path info
    req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL);

    // TODO: Should setting the HTTP headers be moved up to the portal level
    // as well?
    res.setContentType("text/html; charset=UTF-8");
    res.addDateHeader("Expires", System.currentTimeMillis() - (1000L * 60L * 60L * 24L * 365L));
    res.addDateHeader("Last-Modified", System.currentTimeMillis());
    res.addHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
    res.addHeader("Pragma", "no-cache");

    // dispatch to the target
    /*
     * M_log.debug("dispatching path: " + req.getPathInfo() + " to: " +
     * target + " context: " + getServletContext().getServletContextName());
     */

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target);
    dispatcher.forward(req, res);

    // restore the request object
    req.removeAttribute(Tool.NATIVE_URL);
    req.removeAttribute(URL_PATH);
    req.removeAttribute(URL_EXT);
}

From source file:org.sakaiproject.siteassociation.tool.servlet.SiteAssocJsfTool.java

@Override
protected void dispatch(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    logger.debug("dispatch()");

    String target = req.getPathInfo();

    ToolSession session = sessionManager.getCurrentToolSession();

    if (logger.isDebugEnabled()) {
        Map<String, String[]> reqParms = req.getParameterMap();
        for (Map.Entry<String, String[]> entry : reqParms.entrySet()) {
            String reqParmKey = entry.getKey();
            StringBuffer sb = new StringBuffer();
            sb.append("REQ_PARM: ");
            sb.append(reqParmKey);//ww w.  j av a  2  s  .c o m
            sb.append(" = ");
            sb.append('[');
            String[] reqParm = reqParms.get(reqParmKey);
            for (int i = 0; i < reqParm.length;) {
                sb.append(reqParm[i]);
                if (++i < reqParm.length) {
                    sb.append(", ");
                }
            }
            sb.append(']');
            logger.debug(sb.toString());
        }
        Enumeration<String> sessionParmNames = session.getAttributeNames();
        while (sessionParmNames.hasMoreElements()) {
            String sessionParmName = sessionParmNames.nextElement();
            logger.debug("SESS_PARM: " + sessionParmName + " = " + session.getAttribute(sessionParmName));
        }
    }

    // see if this is the helper trying to return to caller
    if (HELPER_RETURN_NOTIFICATION.equals(target)) {
        target = (String) session.getAttribute(toolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
        if (target != null) {

            // FIXME: Workaround for
            // http://bugs.sakaiproject.org/jira/browse/GM-88
            Object viewCollection = session.getAttribute(STORED_MYFACES_VIEW_COLLECTION);
            if (viewCollection != null) {
                session.removeAttribute(STORED_MYFACES_VIEW_COLLECTION);
                session.setAttribute(MYFACES_VIEW_COLLECTION, viewCollection);
            }

            session.removeAttribute(toolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
            res.sendRedirect(target);
            return;
        }
    }

    // Need this here until ToolServlet is updated to support this in
    // sendToHelper method
    // http://bugs.sakaiproject.org/jira/browse/SAK-9043
    // http://bugs.sakaiproject.org/jira/browse/GM-69
    Enumeration<String> params = req.getParameterNames();
    while (params.hasMoreElements()) {
        String paramName = params.nextElement();
        if (paramName.startsWith(HELPER_SESSION_PREFIX)) {
            String attributeName = paramName.substring(HELPER_SESSION_PREFIX.length());
            session.setAttribute(attributeName, req.getParameter(paramName));
        }
    }

    if (sendToHelper(req, res, target)) {
        return;
    }

    // see if we have a resource request - i.e. a path with an extension,
    // and one that is not the JSF_EXT
    if (isResourceRequest(target)) {
        // get a dispatcher to the path
        RequestDispatcher resourceDispatcher = getServletContext().getRequestDispatcher(target);
        if (resourceDispatcher != null) {
            resourceDispatcher.forward(req, res);
            return;
        }
    }

    if ("Title".equals(req.getParameter(PANEL))) {
        // This allows only one Title JSF for each tool
        target = "/title.jsf";

    } else {

        if ((target == null) || "/".equals(target)) {
            target = computeDefaultTarget();

            // make sure it's a valid path
            if (!target.startsWith("/")) {
                target = "/" + target;
            }

            // now that we've messed with the URL, send a redirect to make
            // it official
            res.sendRedirect(Web.returnUrl(req, target));
            return;
        }

        // see if we want to change the specifically requested view
        String newTarget = redirectRequestedTarget(target);

        // make sure it's a valid path
        if (!newTarget.startsWith("/")) {
            newTarget = "/" + newTarget;
        }

        if (!newTarget.equals(target)) {
            // now that we've messed with the URL, send a redirect to make
            // it official
            res.sendRedirect(Web.returnUrl(req, newTarget));
            return;
        }
        target = newTarget;

        // store this
        if (m_defaultToLastView) {
            session.setAttribute(LAST_VIEW_VISITED, target);
        }
    }

    // add the configured folder root and extension (if missing)
    target = m_path + target;

    // add the default JSF extension (if we have no extension)
    int lastSlash = target.lastIndexOf('/');
    int lastDot = target.lastIndexOf('.');
    if ((lastDot < 0) || (lastDot < lastSlash)) {
        target += JSF_EXT;
    }

    // set the information that can be removed from return URLs
    req.setAttribute(URL_PATH, m_path);
    req.setAttribute(URL_EXT, ".jsp");

    // set the sakai request object wrappers to provide the native, not
    // Sakai set up, URL information
    // - this assures that the FacesServlet can dispatch to the proper view
    // based on the path info
    req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL);

    // TODO: Should setting the HTTP headers be moved up to the portal level
    // as well?
    res.setContentType("text/html; charset=UTF-8");
    res.addDateHeader("Expires", System.currentTimeMillis() - (1000L * 60L * 60L * 24L * 365L));
    res.addDateHeader("Last-Modified", System.currentTimeMillis());
    res.addHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
    res.addHeader("Pragma", "no-cache");

    // dispatch to the target
    /*
     * M_log.debug("dispatching path: " + req.getPathInfo() + " to: " +
     * target + " context: " + getServletContext().getServletContextName());
     */

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target);
    dispatcher.forward(req, res);

    // restore the request object
    req.removeAttribute(Tool.NATIVE_URL);
    req.removeAttribute(URL_PATH);
    req.removeAttribute(URL_EXT);
}

From source file:it.classhidra.core.controller.bsController.java

public static HttpServletResponse service(String id_action, ServletContext servletContext,
        HttpServletRequest request, HttpServletResponse response)
        throws ServletException, UnavailableException {

    auth_init auth = checkAuth_init(request);
    try {//from   ww  w . j  av a 2  s  . c om
        if (idApp == null)
            idApp = util_format.replace(getContextPathFor5(servletContext), "/", "");
    } catch (Exception ex) {
        if (idApp == null)
            idApp = util_format.replace(request.getContextPath(), "/", "");
    } catch (Throwable ex) {
        if (idApp == null)
            idApp = util_format.replace(request.getContextPath(), "/", "");
    }
    if (auth == null)
        auth = new auth_init();

    StatisticEntity stat = null;
    try {
        stat = new StatisticEntity(String.valueOf(request.getSession().getId()), auth.get_user_ip(),
                auth.get_matricola(), auth.get_language(), id_action, null, new Date(), null, request);
    } catch (Exception e) {
    }

    String id_rtype = request.getParameter(CONST_ID_REQUEST_TYPE);
    if (id_rtype == null)
        id_rtype = (String) request.getAttribute(CONST_ID_REQUEST_TYPE);
    if (id_rtype == null)
        id_rtype = CONST_REQUEST_TYPE_FORWARD;

    request.setAttribute(CONST_ID_REQUEST_TYPE, id_rtype);
    request.setAttribute(CONST_ID_COMPLETE, id_action);

    String id_call = null;
    if (bsController.getAppInit().get_actioncall_separator() != null
            && !bsController.getAppInit().get_actioncall_separator().equals("")) {
        char separator = bsController.getAppInit().get_actioncall_separator().charAt(0);
        if (id_action != null && id_action.indexOf(separator) > -1) {
            try {
                id_call = id_action.substring(id_action.indexOf(separator) + 1, id_action.length());
            } catch (Exception e) {
            }
            id_action = id_action.substring(0, id_action.indexOf(separator));
        }
    }
    request.setAttribute(CONST_ID_CALL, id_call);
    request.setAttribute(CONST_ID, id_action);

    if (id_action != null) {

        i_action action_instance = null;

        try {
            Vector _streams = getActionStreams_(id_action);

            info_stream blockStreamEnter = performStream_EnterRS(_streams, id_action, action_instance,
                    servletContext, request, response);
            if (blockStreamEnter != null) {
                isException(action_instance, request);
                if (stat != null) {
                    stat.setFt(new Date());
                    stat.setException(
                            new Exception("Blocked by STREAM ENTER:[" + blockStreamEnter.getName() + "]"));
                    putToStatisticProvider(stat);
                }
                return response;
            }

            action_instance = performAction(id_action, id_call, servletContext, request, response);

            if (action_instance == null) {
                isException(action_instance, request);
                if (stat != null) {
                    stat.setFt(new Date());
                    stat.setException(new Exception("ACTION INSTANCE is NULL"));
                    putToStatisticProvider(stat);
                }
                return response;
            }

            if (action_instance.get_infoaction() != null
                    && action_instance.get_infoaction().getStatistic() != null
                    && action_instance.get_infoaction().getStatistic().equalsIgnoreCase("false"))
                stat = null;

            if (!action_instance.isIncluded()) {
                if (!id_rtype.equals(CONST_REQUEST_TYPE_FORWARD))
                    action_instance.setIncluded(true);
            } else {
                if (id_rtype.equals(CONST_REQUEST_TYPE_FORWARD))
                    action_instance.setIncluded(false);
            }

            if (request.getAttribute(CONST_BEAN_$INSTANCEACTIONPOOL) == null)
                request.setAttribute(CONST_BEAN_$INSTANCEACTIONPOOL, new HashMap());
            HashMap included_pool = (HashMap) request.getAttribute(CONST_BEAN_$INSTANCEACTIONPOOL);
            if (action_instance.get_infoaction() != null && action_instance.get_infoaction().getName() != null)
                included_pool.put(action_instance.get_infoaction().getName(), action_instance);
            else if (action_instance.get_infoaction() != null
                    && action_instance.get_infoaction().getPath() != null)
                included_pool.put(action_instance.get_infoaction().getPath(), action_instance);

            request.setAttribute(CONST_BEAN_$INSTANCEACTION, action_instance);

            if (request.getParameter(CONST_ID_JS4AJAX) == null && action_instance != null
                    && action_instance.get_bean() != null)
                request.setAttribute(CONST_ID_JS4AJAX, action_instance.get_bean().getJs4ajax());

            if (action_instance.getCurrent_redirect() != null) {

                if (!action_instance.getCurrent_redirect().is_avoidPermissionCheck()) {
                    info_stream blockStreamExit = performStream_ExitRS(_streams, id_action, action_instance,
                            servletContext, request, response);
                    if (blockStreamExit != null) {
                        isException(action_instance, request);
                        if (stat != null) {
                            stat.setFt(new Date());
                            stat.setException(new Exception(
                                    "Blocked by STREAM EXIT:[" + blockStreamExit.getName() + "]"));
                            putToStatisticProvider(stat);
                        }
                        return response;
                    }
                }

                request.removeAttribute(CONST_ID_REQUEST_TYPE);

                response = execRedirect(action_instance, servletContext, request, response, true);
            }

            environmentState(request, id_action);

        } catch (bsControllerException e) {
            if (request.getAttribute(CONST_BEAN_$ERRORACTION) == null)
                request.setAttribute(CONST_BEAN_$ERRORACTION, e.toString());
            else
                request.setAttribute(CONST_BEAN_$ERRORACTION,
                        request.getAttribute(CONST_BEAN_$ERRORACTION) + ";" + e.toString());
            new bsControllerException(e, iStub.log_ERROR);
            isException(action_instance, request);
            addAsMessage(e, request);
            //            request.setAttribute(CONST_BEAN_$ERRORACTION, e);
            if (request.getSession().getAttribute(bsController.CONST_BEAN_$LISTMESSAGE) != null)
                request.getSession().removeAttribute(bsController.CONST_BEAN_$LISTMESSAGE);
            service_ErrorRedirect(id_action, servletContext, request, response);
            stat.setException(e);
        } catch (Exception ex) {
            if (request.getAttribute(CONST_BEAN_$ERRORACTION) == null)
                request.setAttribute(CONST_BEAN_$ERRORACTION, ex.toString());
            else
                request.setAttribute(CONST_BEAN_$ERRORACTION,
                        request.getAttribute(CONST_BEAN_$ERRORACTION) + ";" + ex.toString());

            new bsControllerException(ex, iStub.log_ERROR);
            isException(action_instance, request);
            addAsMessage(ex, request);
            //            request.setAttribute(CONST_BEAN_$ERRORACTION, ex);
            //            if(request.getSession().getAttribute(bsController.CONST_BEAN_$LISTMESSAGE)!=null) request.getSession().removeAttribute(bsController.CONST_BEAN_$LISTMESSAGE);

            service_ErrorRedirect(id_action, servletContext, request, response);
            stat.setException(ex);
        } catch (Throwable t) {
            if (request.getAttribute(CONST_BEAN_$ERRORACTION) == null)
                request.setAttribute(CONST_BEAN_$ERRORACTION, t.toString());
            else
                request.setAttribute(CONST_BEAN_$ERRORACTION,
                        request.getAttribute(CONST_BEAN_$ERRORACTION) + ";" + t.toString());

            new bsControllerException(t, iStub.log_ERROR);
            isException(action_instance, request);
            addAsMessage(t, request);
            //            request.setAttribute(CONST_BEAN_$ERRORACTION, t);
            //            if(request.getSession().getAttribute(bsController.CONST_BEAN_$LISTMESSAGE)!=null) request.getSession().removeAttribute(bsController.CONST_BEAN_$LISTMESSAGE);
            service_ErrorRedirect(id_action, servletContext, request, response);
            stat.setException(t);
        } finally {
            if (stat != null) {
                stat.setFt(new Date());
                putToStatisticProvider(stat);
                //               if(stat.getAction()!=null && !stat.getAction().equals("content") && !stat.getAction().equals("menuCreator"))
                //                  System.out.println(stat.getAction()+":"+stat.getDelta());               
            }
        }

    }
    return response;
}

From source file:org.agnitas.cms.web.CMTemplateAction.java

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req,
        HttpServletResponse res) throws IOException, ServletException {

    CMTemplateForm aForm;/*from  ww w  .j a  v a 2s  . co  m*/

    ActionMessages errors = new ActionMessages();
    ActionMessages messages = new ActionMessages();
    ActionForward destination = null;

    if (!AgnUtils.isUserLoggedIn(req)) {
        return mapping.findForward("logon");
    }

    if (form != null) {
        aForm = (CMTemplateForm) form;
    } else {
        aForm = new CMTemplateForm();
    }

    AgnUtils.logger().info("Action: " + aForm.getAction());

    // if preview size is changed - return to view page
    if (AgnUtils.parameterNotEmpty(req, "changePreviewSize")) {
        aForm.setAction(CMTemplateAction.ACTION_VIEW);
    }

    // if assign button is pressed - store mailings assignment
    if (AgnUtils.parameterNotEmpty(req, "assign")) {
        aForm.setAction(CMTemplateAction.ACTION_STORE_ASSIGNMENT);
    }

    try {
        switch (aForm.getAction()) {
        case CMTemplateAction.ACTION_LIST:
            initializeColumnWidthsListIfNeeded(aForm);
            destination = mapping.findForward("list");
            aForm.reset(mapping, req);
            setAvailableCharsets(aForm, req);
            aForm.setAction(CMTemplateAction.ACTION_LIST);
            break;

        case CMTemplateAction.ACTION_ASSIGN_LIST:
            initializeColumnWidthsListIfNeeded(aForm);
            destination = mapping.findForward("assign_list");
            aForm.reset(mapping, req);
            aForm.setAction(CMTemplateAction.ACTION_ASSIGN_LIST);
            break;

        case CMTemplateAction.ACTION_STORE_ASSIGNMENT:
            initializeColumnWidthsListIfNeeded(aForm);
            storeMailingAssignment(req, aForm);
            destination = mapping.findForward("assign_list");
            aForm.reset(mapping, req);
            aForm.setAction(CMTemplateAction.ACTION_ASSIGN_LIST);

            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved"));
            break;

        case CMTemplateAction.ACTION_VIEW:
            loadCMTemplate(req, aForm);
            aForm.setAction(CMTemplateAction.ACTION_SAVE);
            destination = mapping.findForward("view");
            break;

        case CMTemplateAction.ACTION_UPLOAD:
            aForm.setAction(CMTemplateAction.ACTION_STORE_UPLOADED);
            setAvailableCharsets(aForm, req);
            destination = mapping.findForward("upload");
            break;

        case CMTemplateAction.ACTION_STORE_UPLOADED:
            errors = storeUploadedTemplate(aForm, req);
            // if template is uploaded and stored successfuly - go to
            // template edit page, otherwise - stay on upload page to display
            // errors and allow user to repeat his try to upload template
            if (errors.isEmpty()) {
                AgnUtils.userlogger()
                        .info(AgnUtils.getAdmin(req).getUsername() + ": create CM template " + aForm.getName());
                loadCMTemplate(req, aForm);
                aForm.setAction(CMTemplateAction.ACTION_SAVE);
                destination = mapping.findForward("view");

                messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved"));
            } else {
                aForm.setAction(CMTemplateAction.ACTION_STORE_UPLOADED);
                destination = mapping.findForward("list");
            }
            break;

        case CMTemplateAction.ACTION_SAVE:
            boolean saveOk = saveCMTemplate(aForm);
            // if save is successful - stay on view page
            // if not - got to list page
            if (saveOk) {
                aForm.setAction(CMTemplateAction.ACTION_SAVE);
                destination = mapping.findForward("view");

                messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved"));
            } else {
                destination = mapping.findForward("list");
                aForm.setAction(CMTemplateAction.ACTION_LIST);
            }
            break;

        case CMTemplateAction.ACTION_PURE_PREVIEW:
            destination = mapping.findForward("pure_preview");
            aForm.reset(mapping, req);
            aForm.setPreview(getCmTemplatePreview(aForm.getCmTemplateId()));
            aForm.setAction(CMTemplateAction.ACTION_PURE_PREVIEW);
            break;

        case CMTemplateAction.ACTION_CONFIRM_DELETE:
            loadCMTemplate(req, aForm);
            aForm.setAction(CMTemplateAction.ACTION_DELETE);
            destination = mapping.findForward("delete");
            break;

        case CMTemplateAction.ACTION_DELETE:
            if (AgnUtils.parameterNotEmpty(req, "kill")) {
                deleteCMTemplate(aForm.getCmTemplateId(), req);
            }
            aForm.setAction(CMTemplateAction.ACTION_LIST);
            destination = mapping.findForward("list");

            messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved"));
            break;

        case CMTemplateAction.ACTION_EDIT_TEMPLATE:
            loadCMTemplate(req, aForm);
            aForm.setLMediaFile(this.getMediaFile(aForm.getCmTemplateId()));
            aForm.setContentTemplateNoConvertion(getContentTemplate(aForm.getCmTemplateId()));
            aForm.setAction(CMTemplateAction.ACTION_EDIT_TEMPLATE);
            destination = mapping.findForward("edit_template");
            break;
        case CMTemplateAction.ACTION_DELETE_IMAGE_TEMPLATE:
            this.deleteImage(req);
            aForm.setLMediaFile(this.getMediaFile(aForm.getCmTemplateId()));
            loadCMTemplate(req, aForm);
            aForm.setAction(CMTemplateAction.ACTION_EDIT_TEMPLATE);
            destination = mapping.findForward("edit_template");
            break;
        case CMTemplateAction.ACTION_SAVE_TEMPLATE:
            if (aForm.getErrorFieldMap().isEmpty()) {
                this.saveEditTemplate(req, aForm);
                aForm.setLMediaFile(this.getMediaFile(aForm.getCmTemplateId()));
                aForm.setAction(CMTemplateAction.ACTION_EDIT_TEMPLATE);
                destination = mapping.findForward("edit_template");
                if (errors.isEmpty()) {
                    messages.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.changes_saved"));
                    req.removeAttribute("save_ok");
                }
                break;
            } else {
                aForm.setAction(CMTemplateAction.ACTION_EDIT_TEMPLATE);
                destination = mapping.findForward("edit_template");
                for (String key : aForm.getErrorFieldMap().keySet()) {
                    errors.add(key, new ActionMessage(aForm.getErrorFieldMap().get(key)));
                }
                req.setAttribute("save_ok", "false");
            }
        }
    } catch (Exception e) {
        AgnUtils.logger().error(
                "Error while executing action with CM Template: " + e + "\n" + AgnUtils.getStackTrace(e));
        errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception"));
    }

    // collect list of CM Templates for list-page
    if (destination != null && "list".equals(destination.getName())) {
        try {
            setNumberOfRows(req, (StrutsFormBase) form);
            req.setAttribute("cmTemplateList", getCMTemplateList(req));
        } catch (Exception e) {
            AgnUtils.logger().error("cmTemplateList: " + e + "\n" + AgnUtils.getStackTrace(e));
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception"));
        }
    }

    // collect list of Mailings for assign-page
    if (destination != null && "assign_list".equals(destination.getName())) {
        try {
            setNumberOfRows(req, (StrutsFormBase) form);
            req.setAttribute("mailingsList", getMailingsList(req, aForm));
        } catch (Exception e) {
            AgnUtils.logger().error("getMailingsList: " + e + "\n" + AgnUtils.getStackTrace(e));
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("error.exception"));
        }
    }

    // Report any errors we have discovered back to the original form
    if (!errors.isEmpty()) {
        saveErrors(req, errors);
    }

    if (!messages.isEmpty()) {
        saveMessages(req, messages);
    }

    return destination;
}

From source file:org.jahia.services.render.webflow.WebflowDispatcherScript.java

/**
 * Execute the script and return the result as a string
 *
 * @param resource resource to display/*from   w  w w  .  j  av a  2s .  c  o  m*/
 * @param context
 * @return the rendered resource
 * @throws org.jahia.services.render.RenderException
 *
 */
public String execute(Resource resource, RenderContext context) throws RenderException {
    final View view = getView();
    if (view == null) {
        throw new RenderException("View not found for : " + resource);
    } else {
        if (logger.isDebugEnabled()) {
            logger.debug("View '" + view + "' resolved for resource: " + resource);
        }
    }

    String identifier;
    try {
        identifier = resource.getNode().getIdentifier();
    } catch (RepositoryException e) {
        throw new RenderException(e);
    }
    String identifierNoDashes = StringUtils.replace(identifier, "-", "_");
    if (!view.getKey().equals("default")) {
        identifierNoDashes += "__" + view.getKey();
    }

    HttpServletRequest request;
    HttpServletResponse response = context.getResponse();

    @SuppressWarnings("unchecked")
    final Map<String, List<String>> parameters = (Map<String, List<String>>) context.getRequest()
            .getAttribute("actionParameters");

    if (xssFilteringEnabled && parameters != null) {
        final Map<String, String[]> m = Maps.transformEntries(parameters,
                new Maps.EntryTransformer<String, List<String>, String[]>() {
                    @Override
                    public String[] transformEntry(@Nullable String key, @Nullable List<String> value) {
                        return value != null ? value.toArray(new String[value.size()]) : null;
                    }
                });
        request = new WebflowHttpServletRequestWrapper(context.getRequest(), m, identifierNoDashes);
    } else {
        request = new WebflowHttpServletRequestWrapper(context.getRequest(),
                new HashMap<>(context.getRequest().getParameterMap()), identifierNoDashes);
    }

    String s = (String) request.getSession().getAttribute("webflowResponse" + identifierNoDashes);
    if (s != null) {
        request.getSession().removeAttribute("webflowResponse" + identifierNoDashes);
        return s;
    }

    // skip aggregation for potentials fragments under the webflow
    boolean aggregationSkippedForWebflow = false;
    if (!AggregateFilter.skipAggregation(context.getRequest())) {
        aggregationSkippedForWebflow = true;
        context.getRequest().setAttribute(AggregateFilter.SKIP_AGGREGATION, true);
    }

    flowPath = MODULE_PREFIX_PATTERN.matcher(view.getPath()).replaceFirst("");

    RequestDispatcher rd = request.getRequestDispatcher("/flow/" + flowPath);

    Object oldModule = request.getAttribute("currentModule");
    request.setAttribute("currentModule", view.getModule());

    if (logger.isDebugEnabled()) {
        dumpRequestAttributes(request);
    }

    StringResponseWrapper responseWrapper = new StringResponseWrapper(response);

    try {
        FlowDefinitionRegistry reg = ((FlowDefinitionRegistry) view.getModule().getContext()
                .getBean("jahiaFlowRegistry"));
        final GenericApplicationContext applicationContext = (GenericApplicationContext) reg
                .getFlowDefinition(flowPath).getApplicationContext();
        applicationContext.setClassLoader(view.getModule().getClassLoader());
        applicationContext.setResourceLoader(new ResourceLoader() {
            @Override
            public org.springframework.core.io.Resource getResource(String location) {
                return applicationContext.getParent().getResource("/" + flowPath + "/" + location);
            }

            @Override
            public ClassLoader getClassLoader() {
                return view.getModule().getClassLoader();
            }
        });

        rd.include(request, responseWrapper);

        String redirect = responseWrapper.getRedirect();
        if (redirect != null && context.getRedirect() == null) {
            // if we have an absolute redirect, set it and move on
            if (redirect.startsWith("http:/") || redirect.startsWith("https://")) {
                context.setRedirect(responseWrapper.getRedirect());
            } else {
                while (redirect != null) {
                    final String qs = StringUtils.substringAfter(responseWrapper.getRedirect(), "?");
                    final Map<String, String[]> params = new HashMap<String, String[]>();
                    if (!StringUtils.isEmpty(qs)) {
                        params.put("webflowexecution" + identifierNoDashes, new String[] { StringUtils
                                .substringAfterLast(qs, "webflowexecution" + identifierNoDashes + "=") });
                    }
                    HttpServletRequestWrapper requestWrapper = new HttpServletRequestWrapper(request) {
                        @Override
                        public String getMethod() {
                            return "GET";
                        }

                        @SuppressWarnings("rawtypes")
                        @Override
                        public Map getParameterMap() {
                            return params;
                        }

                        @Override
                        public String getParameter(String name) {
                            return params.containsKey(name) ? params.get(name)[0] : null;
                        }

                        @Override
                        public Enumeration getParameterNames() {
                            return new Vector(params.keySet()).elements();
                        }

                        @Override
                        public String[] getParameterValues(String name) {
                            return params.get(name);
                        }

                        @Override
                        public Object getAttribute(String name) {
                            if (WebUtils.FORWARD_QUERY_STRING_ATTRIBUTE.equals(name)) {
                                return qs;
                            }
                            return super.getAttribute(name);
                        }

                        @Override
                        public String getQueryString() {
                            return qs;
                        }
                    };
                    rd = requestWrapper.getRequestDispatcher("/flow/" + flowPath + "?" + qs);
                    responseWrapper = new StringResponseWrapper(response);
                    rd.include(requestWrapper, responseWrapper);

                    String oldRedirect = redirect;
                    redirect = responseWrapper.getRedirect();
                    if (redirect != null) {
                        // if we have an absolute redirect, exit the loop
                        if (redirect.startsWith("http://") || redirect.startsWith("https://")) {
                            context.setRedirect(redirect);
                            break;
                        }
                    } else if (request.getMethod().equals("POST")) {
                        // set the redirect to the last non-null one
                        request.getSession().setAttribute("webflowResponse" + identifierNoDashes,
                                responseWrapper.getString());
                        context.setRedirect(oldRedirect);
                    }
                }
            }
        }
    } catch (ServletException e) {
        throw new RenderException(e.getRootCause() != null ? e.getRootCause() : e);
    } catch (IOException e) {
        throw new RenderException(e);
    } finally {
        request.setAttribute("currentModule", oldModule);
    }
    try {
        if (aggregationSkippedForWebflow) {
            request.removeAttribute(AggregateFilter.SKIP_AGGREGATION);
        }
        return responseWrapper.getString();
    } catch (IOException e) {
        throw new RenderException(e);
    }
}

From source file:it.classhidra.core.controller.bsController.java

public void service(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, UnavailableException {

    boolean isDebug = false;
    try {// w ww  . ja  va 2s  .  c om
        isDebug = System.getProperty("debug").equals("true");
    } catch (Exception e) {
        try {
            isDebug = bsController.getAppInit().get_debug().equals("true");
        } catch (Exception ex) {
        }
    }

    String id_action = request.getParameter(CONST_ID_$ACTION);

    String id_rtype = request.getParameter(CONST_ID_REQUEST_TYPE);
    if (id_rtype == null)
        id_rtype = CONST_REQUEST_TYPE_FORWARD;
    request.setAttribute(CONST_ID_REQUEST_TYPE, id_rtype);

    if (id_action == null)
        id_action = getPropertyMultipart(CONST_ID_$ACTION, request);

    if (id_action != null)
        id_action = id_action.trim();

    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsLog)) {
        try {
            response.getWriter().write(logG.get_log_Content("<br>" + System.getProperty("line.separator")));
        } catch (Exception e) {
        }
        return;
    }
    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsActions)) {
        try {
            String content = "actions.xml<br>ROOT1=" + request.getSession().getServletContext().getRealPath("/")
                    + "<br>ROOT2=" + request.getSession().getServletContext().getRealPath("/") + "<br>";
            try {
                content += "ROOT3=" + util_classes.getPath("config") + "<br>";
            } catch (Exception exp) {
                content += "ROOT3=ERROR:" + exp.toString();
            }
            content += bsController.getAction_config().toString();
            response.getWriter().write(content);
        } catch (Exception e) {
            String content = "actions.xml:ERROR<br>";

            content += e.toString();
            try {
                response.getWriter().write(content);
            } catch (Exception ex) {
            }
        }
        return;
    }

    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsLogS)) {
        try {
            String content = "LOG<br>";
            Vector s_log = (Vector) request.getSession().getAttribute(bsController.CONST_SESSION_LOG);
            if (s_log == null)
                content = "LOG:null";
            else {
                for (int i = 0; i < s_log.size(); i++) {
                    content += s_log.get(i).toString() + "<br>";
                }
            }
            response.getWriter().write(content);
        } catch (Exception e) {

        }
        return;
    }

    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_Controller)) {
        loadOnInit();
        return;
    }

    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsResource)) {
        try {
            String content = "Resource<br>";
            content += "APP_INIT=" + getAppInit().getLoadedFrom() + "<br>";
            content += "AUTH_INIT=" + new auth_init().getLoadedFrom() + "<br>";
            content += "LOG_INIT=" + getLogInit().getLoadedFrom() + "<br>";
            content += "DB_INIT=" + getDbInit().getLoadedFrom() + "<br>";
            content += "ACTIONS_LOAD=" + getAction_config().getLoadedFrom() + "<br>";
            content += "AUTHENTICATION_LOAD=" + getAuth_config().getLoadedFrom() + "<br>";
            content += "ORGANIZATION_LOAD=" + getOrg_config().getLoadedFrom() + "<br>";
            content += "MESSAGES_LOAD=" + getMess_config().getLoadedFrom() + "<br>";
            content += "MENU_LOAD=" + getMenu_config().getLoadedFrom() + "<br>";
            try {
                content += "USERS_LOAD=" + ((load_users) bsController.getUser_config()).getLoadedFrom()
                        + "<br>";
            } catch (Exception e) {
                content += "USERS_LOAD=?";
            }
            response.getWriter().write(content);
        } catch (Exception e) {

        }

        return;
    }

    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsStatistics)) {
        try {
            String content = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n";
            content += "<statistics>\n";
            I_StatisticProvider stack = getStatisticProvider();
            if (stack != null)
                content += stack.getAllEntitiesAsXml();
            content += "</statistics>\n";
            response.getWriter().write(content);
        } catch (Exception e) {

        }
        return;
    }
    if (isDebug && id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsEnvironment)) {
        try {
            response.getWriter().write(prepareEnvironmentState(request, id_action));
        } catch (Exception e) {

        }
        return;
    }

    if (id_action != null && id_action.equals(CONST_DIRECTINDACTION_bsTransformation)) {
        transformation cTransformation = (transformation) request
                .getAttribute(bsConstants.CONST_ID_TRANSFORMATION4CONTROLLER);
        if (cTransformation == null) {
            String idInSession = request.getParameter("id");
            if (idInSession != null) {
                cTransformation = (transformation) request.getSession()
                        .getAttribute(bsConstants.CONST_ID_TRANSFORMATION4CONTROLLER + "_" + idInSession);
                if (cTransformation != null)
                    request.getSession().removeAttribute(
                            bsConstants.CONST_ID_TRANSFORMATION4CONTROLLER + "_" + idInSession);
            }
        }
        if (cTransformation != null) {
            request.removeAttribute(bsConstants.CONST_ID_TRANSFORMATION4CONTROLLER);
            if (cTransformation.getOutputcontent() != null) {

                try {
                    if (cTransformation.getContentType() != null) {
                        if (cTransformation.getContentType().equalsIgnoreCase("text/html")) {
                            response.setContentType(cTransformation.getContentType().toLowerCase());
                            response.setHeader("Content-Type",
                                    cTransformation.getContentType().toLowerCase()
                                            + ((cTransformation.getContentTransferEncoding() != null)
                                                    ? ";charset=" + cTransformation.getContentTransferEncoding()
                                                    : ""));
                        } else {
                            response.setContentType(
                                    "Application/" + cTransformation.getContentType().toLowerCase());
                            response.setHeader("Content-Type",
                                    "Application/" + cTransformation.getContentType().toLowerCase()
                                            + ((cTransformation.getContentTransferEncoding() != null)
                                                    ? ";charset=" + cTransformation.getContentTransferEncoding()
                                                    : ""));
                        }
                    }
                    if (cTransformation.getContentName() != null)
                        response.setHeader("Content-Disposition",
                                "attachment; filename=" + cTransformation.getContentName());
                    if (cTransformation.getContentTransferEncoding() != null)
                        response.setHeader("Content-Transfer-Encoding",
                                cTransformation.getContentTransferEncoding());

                    OutputStream os = response.getOutputStream();
                    os.write(cTransformation.getOutputcontent());
                    os.flush();
                    os.close();

                } catch (Exception e) {
                } catch (Throwable t) {
                }
            }
        }
        return;
    }

    service(id_action, getServletContext(), request, response);

}

From source file:org.sakaiproject.jsf.util.SamigoJsfTool.java

protected void dispatch(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    // NOTE: this is a simple path dispatching, taking the path as the view id = jsp file name for the view,
    //       with default used if no path and a path prefix as configured.

    // build up the target that will be dispatched to
    String target = req.getPathInfo();
    log.debug("***0. dispatch, target =" + target);

    // see if we need to reset the assessmentBean, such as when returning
    // from a helper
    // TODO: there MUST be a cleaner way to do this!! These dependencies
    // shouldn't be here!!
    if (target != null && target.startsWith(RESET_ASSESSMENT_BEAN)) {
        AssessmentBean assessmentBean = (AssessmentBean) ContextUtil
                .lookupBeanFromExternalServlet("assessmentBean", req, res);
        if (assessmentBean != null && assessmentBean.getAssessmentId() != null) {
            AssessmentIfc assessment;//ww w  .j  av  a  2s .c  o  m
            AuthorBean author = (AuthorBean) ContextUtil.lookupBean("author");
            AssessmentService assessmentService;
            if (author.getIsEditPendingAssessmentFlow()) {
                assessmentService = new AssessmentService();
            } else {
                assessmentService = new PublishedAssessmentService();
            }
            assessment = assessmentService.getAssessment(Long.valueOf(assessmentBean.getAssessmentId()));
            assessmentBean.setAssessment(assessment);
        }
        target = target.replaceFirst(RESET_ASSESSMENT_BEAN, "");
    }

    // see if this is a helper trying to return to caller
    if (HELPER_RETURN_NOTIFICATION.equals(target)) {
        ToolSession session = SessionManager.getCurrentToolSession();
        target = (String) session.getAttribute(ToolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
        if (target != null) {
            session.removeAttribute(ToolManager.getCurrentTool().getId() + Tool.HELPER_DONE_URL);
            res.sendRedirect(target);
            return;
        }
    }

    boolean sendToHelper = sendToHelper(req, res);
    boolean isResourceRequest = isResourceRequest(target);
    log.debug("***1. dispatch, send to helper =" + sendToHelper);
    log.debug("***2. dispatch, isResourceRequest =" + isResourceRequest);

    // see if we have a helper request
    if (sendToHelper) {
        return;
    }

    if (isResourceRequest) {
        // get a dispatcher to the path
        RequestDispatcher resourceDispatcher = getServletContext().getRequestDispatcher(target);
        if (resourceDispatcher != null) {
            resourceDispatcher.forward(req, res);
            return;
        }
    }

    if (target == null || "/".equals(target)) {
        target = computeDefaultTarget();

        // make sure it's a valid path
        if (!target.startsWith("/")) {
            target = "/" + target;
        }

        // now that we've messed with the URL, send a redirect to make it official
        res.sendRedirect(Web.returnUrl(req, target));
        return;
    }

    // see if we want to change the specifically requested view
    String newTarget = redirectRequestedTarget(target);

    // make sure it's a valid path
    if (!newTarget.startsWith("/")) {
        newTarget = "/" + newTarget;
    }

    if (!newTarget.equals(target)) {
        // now that we've messed with the URL, send a redirect to make it official
        res.sendRedirect(Web.returnUrl(req, newTarget));
        return;
    }
    target = newTarget;

    // store this
    ToolSession toolSession = SessionManager.getCurrentToolSession();
    if (toolSession != null) {
        toolSession.setAttribute(LAST_VIEW_VISITED, target);
    }
    log.debug("3a. dispatch: toolSession=" + toolSession);
    log.debug("3b. dispatch: target=" + target);
    log.debug("3c. dispatch: lastview?" + m_defaultToLastView);

    // add the configured folder root and extension (if missing)
    target = m_path + target;

    // add the default JSF extension (if we have no extension)
    int lastSlash = target.lastIndexOf("/");
    int lastDot = target.lastIndexOf(".");
    if (lastDot < 0 || lastDot < lastSlash) {
        target += JSF_EXT;
    }

    // set the information that can be removed from return URLs
    req.setAttribute(URL_PATH, m_path);
    req.setAttribute(URL_EXT, ".jsp");

    // set the sakai request object wrappers to provide the native, not Sakai set up, URL information
    // - this assures that the FacesServlet can dispatch to the proper view based on the path info
    req.setAttribute(Tool.NATIVE_URL, Tool.NATIVE_URL);

    // TODO: Should setting the HTTP headers be moved up to the portal level as well?
    res.setContentType("text/html; charset=UTF-8");
    res.addDateHeader("Expires", System.currentTimeMillis() - (1000L * 60L * 60L * 24L * 365L));
    res.addDateHeader("Last-Modified", System.currentTimeMillis());
    res.addHeader("Cache-Control", "no-store, no-cache, must-revalidate, max-age=0, post-check=0, pre-check=0");
    res.addHeader("Pragma", "no-cache");

    // dispatch to the target
    log.debug("***4. dispatch, dispatching path: " + req.getPathInfo() + " to: " + target + " context: "
            + getServletContext().getServletContextName());
    // if this is a return from the file picker and going back to 
    // case 1: item mofification, then set 
    //         itemAuthorbean.attachmentlist = filepicker list
    if (target.indexOf("/jsf/author/item/") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        ItemAuthorBean bean = (ItemAuthorBean) ContextUtil.lookupBeanFromExternalServlet("itemauthor", req,
                res);

        // For EMI Item Attachments   
        AnswerBean emiQAComboItem = bean.getCurrentAnswer();
        if (emiQAComboItem == null) {
            bean.setItemAttachment();
        } else {
            emiQAComboItem.setItemTextAttachment();
        }
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    // case 2: part mofification, then set 
    //         sectionBean.attachmentList = filepicker list
    else if (target.indexOf("/jsf/author/editPart") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        SectionBean bean = (SectionBean) ContextUtil.lookupBeanFromExternalServlet("sectionBean", req, res);
        bean.setPartAttachment();
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    // case 3.1: assessment settings mofification, then set assessmentSettingsBean.attachmentList = filepicker list
    else if (target.indexOf("/jsf/author/authorSettings") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        AssessmentSettingsBean bean = (AssessmentSettingsBean) ContextUtil
                .lookupBeanFromExternalServlet("assessmentSettings", req, res);
        bean.setAssessmentAttachment();
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }
    // case 3.2: published assessment settings mofification, then set assessmentSettingsBean.attachmentList = filepicker list
    else if (target.indexOf("/jsf/author/publishedSettings") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        PublishedAssessmentSettingsBean bean = (PublishedAssessmentSettingsBean) ContextUtil
                .lookupBeanFromExternalServlet("publishedSettings", req, res);
        bean.setAssessmentAttachment();
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    // case 4: create new mail, then set
    // emailBean.attachmentList = filepicker list
    else if (target.indexOf("/jsf/evaluation/createNewEmail") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        EmailBean bean = (EmailBean) ContextUtil.lookupBeanFromExternalServlet("email", req, res);
        bean.prepareAttachment();
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    else if (target.indexOf("/jsf/evaluation/questionScore") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        QuestionScoresBean bean = (QuestionScoresBean) ContextUtil
                .lookupBeanFromExternalServlet("questionScores", req, res);
        bean.setAttachment((Long) toolSession.getAttribute("itemGradingId"));
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    else if (target.indexOf("/jsf/evaluation/gradeStudentResult") > -1
            && ("true").equals(toolSession.getAttribute("SENT_TO_FILEPICKER_HELPER"))) {
        ItemContentsBean bean = (ItemContentsBean) ContextUtil.lookupBeanFromExternalServlet("itemContents",
                req, res);
        bean.setAttachment((Long) toolSession.getAttribute("itemGradingId"));
        toolSession.removeAttribute("SENT_TO_FILEPICKER_HELPER");
    }

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(target);
    dispatcher.forward(req, res);

    // restore the request object
    req.removeAttribute(Tool.NATIVE_URL);
    req.removeAttribute(URL_PATH);
    req.removeAttribute(URL_EXT);

}

From source file:com.ibm.jaggr.core.impl.layer.LayerImpl.java

@SuppressWarnings("unchecked")
@Override/*  w w w .j av  a  2  s . c  o m*/
public InputStream getInputStream(HttpServletRequest request, HttpServletResponse response) throws IOException {

    CacheEntry entry = null;
    String key = null;
    IAggregator aggr = (IAggregator) request.getAttribute(IAggregator.AGGREGATOR_REQATTRNAME);
    List<String> cacheInfoReport = null;
    if (_isReportCacheInfo) {
        cacheInfoReport = (List<String>) request.getAttribute(LAYERCACHEINFO_PROPNAME);
        if (cacheInfoReport != null) {
            cacheInfoReport.clear();
        }
    }
    if (log.isLoggable(Level.FINEST) && cacheInfoReport == null) {
        cacheInfoReport = new LinkedList<String>();
    }
    try {
        IOptions options = aggr.getOptions();
        ICacheManager mgr = aggr.getCacheManager();
        boolean ignoreCached = RequestUtil.isIgnoreCached(request);
        InputStream result;
        long lastModified = getLastModified(request);
        CacheEntry newEntry = new CacheEntry(_id, _cacheKey, lastModified);
        CacheEntry existingEntry = null;

        if (ignoreCached) {
            request.setAttribute(NOCACHE_RESPONSE_REQATTRNAME, Boolean.TRUE);
        }
        if (options.isDevelopmentMode()) {
            synchronized (this) {
                // See if we need to discard previously built LayerBuilds
                if (lastModified > _lastModified) {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("update_lastmod2"); //$NON-NLS-1$
                    }
                    if (lastModified != Long.MAX_VALUE) {
                        // max value means missing requested source
                        _lastModified = lastModified;
                    }
                    _cacheKeyGenerators = null;
                }
            }
        }
        Map<String, ICacheKeyGenerator> cacheKeyGenerators = _cacheKeyGenerators;

        // Creata a cache key.
        key = generateCacheKey(request, cacheKeyGenerators);

        if (!ignoreCached && key != null) {
            int loopGuard = 5;
            do {
                // Try to retrieve an existing layer build using the blocking putIfAbsent.  If the return
                // value is null, then the newEntry was successfully added to the map, otherwise the
                // existing entry is returned in the buildReader and newEntry was not added.
                existingEntry = _layerBuilds.putIfAbsent(key, newEntry, options.isDevelopmentMode());
                if (cacheInfoReport != null) {
                    cacheInfoReport.add(existingEntry != null ? "hit_1" : "added"); //$NON-NLS-1$ //$NON-NLS-2$
                }
                if (existingEntry != null) {
                    if ((result = existingEntry.tryGetInputStream(request)) != null) {
                        setResponseHeaders(request, response, existingEntry.getSize());
                        if (log.isLoggable(Level.FINEST)) {
                            log.finest(cacheInfoReport.toString() + "\n" + //$NON-NLS-1$
                                    "key:" + key + //$NON-NLS-1$
                                    "\n" + existingEntry.toString()); //$NON-NLS-1$
                        }
                        if (_isReportCacheInfo) {
                            request.setAttribute(LAYERBUILDCACHEKEY_PROPNAME, key);
                        }
                        return result;
                    } else if (existingEntry.isDeleted()) {
                        if (_layerBuilds.replace(key, existingEntry, newEntry)) {
                            // entry was replaced, use newEntry
                            if (cacheInfoReport != null) {
                                cacheInfoReport.add("replace_1"); //$NON-NLS-1$
                            }
                            existingEntry = null;
                        } else {
                            // Existing entry was removed from the cache by another thread
                            // between the time we retrieved it and the time we tried to
                            // replace it.  Try to add the new entry again.
                            if (cacheInfoReport != null) {
                                cacheInfoReport.add("retry_add"); //$NON-NLS-1$
                            }
                            if (--loopGuard == 0) {
                                // Should never happen, but just in case
                                throw new IllegalStateException();
                            }
                            continue;
                        }
                    }
                }
                break;
            } while (true);
        }

        // putIfAbsent() succeeded and the new entry was added to the cache
        entry = (existingEntry != null) ? existingEntry : newEntry;

        LayerBuilder layerBuilder = null;

        // List of Future<IModule.ModuleReader> objects that will be used to read the module
        // data from
        List<ICacheKeyGenerator> moduleKeyGens = null;

        // Synchronize on the LayerBuild object for the build.  This will prevent multiple
        // threads from building the same output.  If more than one thread requests the same
        // output (same cache key), then the first one to grab the sync object will win and
        // the rest will wait for the first thread to finish building and then just return
        // the output from the first thread when they wake.
        synchronized (entry) {

            // Check to see if data is available one more time in case a different thread finished
            // building the output while we were blocked on the sync object.
            if (!ignoreCached && key != null && (result = entry.tryGetInputStream(request)) != null) {
                if (cacheInfoReport != null) {
                    cacheInfoReport.add("hit_2"); //$NON-NLS-1$
                }
                setResponseHeaders(request, response, entry.getSize());
                if (log.isLoggable(Level.FINEST)) {
                    log.finest(cacheInfoReport.toString() + "\n" + //$NON-NLS-1$
                            "key:" + key + //$NON-NLS-1$
                            "\n" + entry.toString()); //$NON-NLS-1$
                }
                if (_isReportCacheInfo) {
                    request.setAttribute(LAYERBUILDCACHEKEY_PROPNAME, key);
                }
                return result;
            }

            boolean isGzip = RequestUtil.isGzipEncoding(request);
            ByteArrayOutputStream bos = new ByteArrayOutputStream();

            // See if we already have a cached response that uses a different gzip
            // encoding option.  If we do, then just zip (or unzip) the cached
            // response
            CacheEntry otherEntry = null;
            if (key != null) {
                StringBuffer sb = new StringBuffer();
                Matcher m = GZIPFLAG_KEY_PATTERN.matcher(key);
                m.find();
                m.appendReplacement(sb,
                        new StringBuffer(s_layerCacheKeyGenerators.get(0).toString()).append(":") //$NON-NLS-1$
                                .append("1".equals(m.group(1)) ? "0" : "1") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                                .append(":").toString() //$NON-NLS-1$
                ).appendTail(sb);
                otherEntry = _layerBuilds.get(sb.toString());
            }
            if (otherEntry != null) {
                if (isGzip) {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("zip_unzipped"); //$NON-NLS-1$
                    }
                    // We need gzipped and the cached entry is unzipped
                    // Create the compression stream for the output
                    VariableGZIPOutputStream compress = new VariableGZIPOutputStream(bos, 10240); // is 10k too big?
                    compress.setLevel(Deflater.BEST_COMPRESSION);
                    Writer writer = new OutputStreamWriter(compress, "UTF-8"); //$NON-NLS-1$

                    // Copy the data from the input stream to the output, compressing as we go.
                    CopyUtil.copy(otherEntry.getInputStream(request), writer);
                } else {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("unzip_zipped"); //$NON-NLS-1$
                    }
                    // We need unzipped and the cached entry is zipped.  Just unzip it
                    CopyUtil.copy(new GZIPInputStream(otherEntry.getInputStream(request)), bos);
                }
                // Set the buildReader to the LayerBuild and release the lock by exiting the sync block
                entry.setBytes(bos.toByteArray());
                if (!ignoreCached) {
                    _layerBuilds.replace(key, entry, entry); // updates entry weight in map
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("update_weights_1"); //$NON-NLS-1$
                    }
                    entry.persist(mgr);
                }
            } else {
                moduleKeyGens = new LinkedList<ICacheKeyGenerator>();

                ModuleList moduleList = getModules(request);

                // Remove the module list from the request to safe-guard it now that we don't
                // need it there anymore
                request.removeAttribute(MODULE_FILES_PROPNAME);

                // Create a BuildListReader from the list of Futures.  This reader will obtain a
                // ModuleReader from each of the Futures in the list and read data from each one in
                // succession until all the data has been read, blocking on each Future until the
                // reader becomes available.
                layerBuilder = new LayerBuilder(request, moduleKeyGens, moduleList);
                String layer = layerBuilder.build();

                if (isGzip) {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("zip"); //$NON-NLS-1$
                    }
                    VariableGZIPOutputStream compress = new VariableGZIPOutputStream(bos, 10240); // is 10k too big?
                    compress.setLevel(Deflater.BEST_COMPRESSION);
                    Writer writer = new OutputStreamWriter(compress, "UTF-8"); //$NON-NLS-1$

                    // Copy the data from the input stream to the output, compressing as we go.
                    CopyUtil.copy(new StringReader(layer), writer);
                    // Set the buildReader to the LayerBuild and release the lock by exiting the sync block
                    entry.setBytes(bos.toByteArray());
                } else {
                    entry.setBytes(layer.getBytes());
                }

                // entry will be persisted below after we determine if cache key
                // generator needs to be updated
            }
        }

        // if any of the readers included an error response, then don't cache the layer.
        if (layerBuilder != null && layerBuilder.hasErrors()) {
            request.setAttribute(NOCACHE_RESPONSE_REQATTRNAME, Boolean.TRUE);
            if (cacheInfoReport != null) {
                cacheInfoReport.add(key == null ? "error_noaction" : "error_remove"); //$NON-NLS-1$ //$NON-NLS-2$
            }
            if (key != null) {
                _layerBuilds.remove(key, entry);
            }
        } else if (layerBuilder != null) {
            if (!ignoreCached) {
                // See if we need to create or update the cache key generators
                Map<String, ICacheKeyGenerator> newKeyGens = new HashMap<String, ICacheKeyGenerator>();
                Set<String> requiredModuleListDeps = getModules(request).getDependentFeatures();
                addCacheKeyGenerators(newKeyGens, s_layerCacheKeyGenerators);
                addCacheKeyGenerators(newKeyGens, aggr.getTransport().getCacheKeyGenerators());
                addCacheKeyGenerators(newKeyGens, Arrays.asList(new ICacheKeyGenerator[] {
                        new FeatureSetCacheKeyGenerator(requiredModuleListDeps, false) }));
                addCacheKeyGenerators(newKeyGens, moduleKeyGens);

                boolean cacheKeyGeneratorsUpdated = false;
                if (!newKeyGens.equals(cacheKeyGenerators)) {
                    // If we don't yet have a cache key for this layer, then get one
                    // from the cache key generators, and then update the cache key for this
                    // cache entry.

                    synchronized (this) {
                        if (_cacheKeyGenerators != null) {
                            addCacheKeyGenerators(newKeyGens, _cacheKeyGenerators.values());
                        }
                        _cacheKeyGenerators = Collections.unmodifiableMap(newKeyGens);
                    }
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("update_keygen"); //$NON-NLS-1$
                    }
                    cacheKeyGeneratorsUpdated = true;
                }
                final String originalKey = key;
                if (key == null || cacheKeyGeneratorsUpdated) {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("update_key"); //$NON-NLS-1$
                    }
                    key = generateCacheKey(request, newKeyGens);
                }
                if (originalKey == null || !originalKey.equals(key)) {
                    /*
                     * The cache key has changed from what was originally used to put the
                     * un-built entry into the cache.  Add the LayerBuild to the cache
                     * using the new key.
                     */
                    if (log.isLoggable(Level.FINE)) {
                        log.fine("Key changed!  Adding layer to cache with key: " + key); //$NON-NLS-1$
                    }
                    final CacheEntry originalEntry = entry;
                    CacheEntry updateEntry = (originalKey == null) ? entry : new CacheEntry(entry);
                    CacheEntry previousEntry = _layerBuilds.putIfAbsent(key, updateEntry,
                            options.isDevelopmentMode());
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add(previousEntry == null ? "update_add" : "update_hit"); //$NON-NLS-1$ //$NON-NLS-2$
                    }
                    // Write the file to disk only if the LayerBuild was successfully added to the cache
                    if (previousEntry == null) {
                        // Updated entry was added to the cache.
                        entry = updateEntry;
                        entry.persist(mgr);
                    }
                    // If the key changed, then remove the entry under the old key.  Use a
                    // delay to give other threads a chance to start using the new cache
                    // key generator.  No need to update entry weight in map
                    if (originalKey != null) {
                        aggr.getExecutors().getScheduledExecutor().schedule(new Runnable() {
                            public void run() {
                                _layerBuilds.remove(originalKey, originalEntry);
                            }
                        }, LAYERBUILD_REMOVE_DELAY_SECONDS, TimeUnit.SECONDS);
                    }
                } else {
                    if (cacheInfoReport != null) {
                        cacheInfoReport.add("update_weights_2"); //$NON-NLS-1$
                    }
                    _layerBuilds.replace(key, entry, entry); // updates entry weight in map
                    entry.persist(mgr);
                }
            }
        }
        result = entry.getInputStream(request);
        setResponseHeaders(request, response, entry.getSize());

        // return the input stream to the LayerBuild
        if (log.isLoggable(Level.FINEST)) {
            log.finest(cacheInfoReport.toString() + "\n" + //$NON-NLS-1$
                    "key:" + key + //$NON-NLS-1$
                    "\n" + entry.toString()); //$NON-NLS-1$
        }
        if (_isReportCacheInfo) {
            request.setAttribute(LAYERBUILDCACHEKEY_PROPNAME, key);
        }
        return result;
    } catch (IOException e) {
        _layerBuilds.remove(key, entry);
        throw e;
    } catch (RuntimeException e) {
        _layerBuilds.remove(key, entry);
        throw e;
    } finally {
        if (_layerBuilds.isLayerEvicted()) {
            _layerBuilds.removeLayerFromCache(this);
        }
    }
}

From source file:org.apache.jsp.html.portal.layout_jsp.java

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

    PageContext pageContext = null;//from w  w  w.j av  a  2  s. com
    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 {
        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;

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        //  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 scopeGroupId = null;
        com.liferay.portal.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;
        java.lang.Long portletGroupId = 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");
        scopeGroupId = (java.lang.Long) _jspx_page_context.findAttribute("scopeGroupId");
        permissionChecker = (com.liferay.portal.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");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        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");
        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");
        out.write("\n");
        out.write("\n");
        out.write('\n');
        out.write('\n');

        StringBundler sb = (StringBundler) request.getAttribute(WebKeys.LAYOUT_CONTENT);

        sb.writeTo(out);

        request.removeAttribute(WebKeys.LAYOUT_CONTENT);

    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}

From source file:org.apache.jsp.html.taglib.aui.script.page_jsp.java

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

    PageContext pageContext = null;//from  www .  j av  a2s.  co  m
    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 {
        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;

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        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");
        //  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 scopeGroupId = null;
        com.liferay.portal.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;
        java.lang.Long portletGroupId = 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");
        scopeGroupId = (java.lang.Long) _jspx_page_context.findAttribute("scopeGroupId");
        permissionChecker = (com.liferay.portal.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");
        portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId");
        out.write('\n');
        out.write('\n');

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        PortletRequest portletRequest = (PortletRequest) request
                .getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST);

        PortletResponse portletResponse = (PortletResponse) request
                .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE);

        String namespace = StringPool.BLANK;

        boolean useNamespace = GetterUtil.getBoolean((String) request.getAttribute("aui:form:useNamespace"),
                true);

        if ((portletResponse != null) && useNamespace) {
            namespace = portletResponse.getNamespace();
        }

        String currentURL = PortalUtil.getCurrentURL(request);

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

        /**
         * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
         *
         * This library is free software; you can redistribute it and/or modify it under
         * the terms of the GNU Lesser General Public License as published by the Free
         * Software Foundation; either version 2.1 of the License, or (at your option)
         * any later version.
         *
         * This library is distributed in the hope that it will be useful, but WITHOUT
         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
         * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
         * details.
         */

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

        ScriptData scriptData = (ScriptData) request.getAttribute(ScriptTag.class.getName());

        if (scriptData == null) {
            scriptData = (ScriptData) request.getAttribute(WebKeys.AUI_SCRIPT_DATA);

            if (scriptData != null) {
                request.removeAttribute(WebKeys.AUI_SCRIPT_DATA);
            }
        }

        out.write('\n');
        out.write('\n');
        //  c:if
        org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
        _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context);
        _jspx_th_c_005fif_005f0.setParent(null);
        // /html/taglib/aui/script/page.jsp(34,0) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
        _jspx_th_c_005fif_005f0.setTest(scriptData != null);
        int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag();
        if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            do {
                out.write("\n");
                out.write("\t<script type=\"text/javascript\">\n");
                out.write("\t\t// <![CDATA[\n");
                out.write("\n");
                out.write("\t\t\t");

                StringBundler rawSB = scriptData.getRawSB();

                rawSB.writeTo(out);

                StringBundler callbackSB = scriptData.getCallbackSB();

                out.write("\n");
                out.write("\n");
                out.write("\t\t\t");
                //  c:if
                org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f1 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest
                        .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class);
                _jspx_th_c_005fif_005f1.setPageContext(_jspx_page_context);
                _jspx_th_c_005fif_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_c_005fif_005f0);
                // /html/taglib/aui/script/page.jsp(46,3) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
                _jspx_th_c_005fif_005f1.setTest(callbackSB.index() > 0);
                int _jspx_eval_c_005fif_005f1 = _jspx_th_c_005fif_005f1.doStartTag();
                if (_jspx_eval_c_005fif_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
                    do {
                        out.write("\n");
                        out.write("\n");
                        out.write("\t\t\t\t");

                        Set<String> useSet = scriptData.getUseSet();

                        StringBundler useSB = new StringBundler(useSet.size() * 4);

                        for (String use : useSet) {
                            useSB.append(StringPool.APOSTROPHE);
                            useSB.append(use);
                            useSB.append(StringPool.APOSTROPHE);
                            useSB.append(StringPool.COMMA_AND_SPACE);
                        }

                        out.write("\n");
                        out.write("\n");
                        out.write("\t\t\t\tAUI().use(\n");
                        out.write("\n");
                        out.write("\t\t\t\t\t");

                        useSB.writeTo(out);

                        out.write("\n");
                        out.write("\n");
                        out.write("\t\t\t\t\tfunction(A) {\n");
                        out.write("\n");
                        out.write("\t\t\t\t\t\t");

                        callbackSB.writeTo(out);

                        out.write("\n");
                        out.write("\n");
                        out.write("\t\t\t\t\t}\n");
                        out.write("\t\t\t\t);\n");
                        out.write("\t\t\t");
                        int evalDoAfterBody = _jspx_th_c_005fif_005f1.doAfterBody();
                        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                            break;
                    } while (true);
                }
                if (_jspx_th_c_005fif_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
                    _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
                    return;
                }
                _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f1);
                out.write("\n");
                out.write("\t\t// ]]>\n");
                out.write("\t</script>\n");
                int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody();
                if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
                    break;
            } while (true);
        }
        if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
            _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
            return;
        }
        _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0);
    } catch (Throwable t) {
        if (!(t instanceof SkipPageException)) {
            out = _jspx_out;
            if (out != null && out.getBufferSize() != 0)
                try {
                    out.clearBuffer();
                } catch (java.io.IOException e) {
                }
            if (_jspx_page_context != null)
                _jspx_page_context.handlePageException(t);
        }
    } finally {
        _jspxFactory.releasePageContext(_jspx_page_context);
    }
}