List of usage examples for javax.servlet.http HttpServletRequest removeAttribute
public void removeAttribute(String name);
From source file:org.springframework.web.servlet.LogDispatcherServlet.java
/** * Restore the request attributes after an include. * @param request current HTTP request/* w w w. ja va 2 s .co m*/ * @param attributesSnapshot the snapshot of the request attributes before the include */ @SuppressWarnings("unchecked") private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?, ?> attributesSnapshot) { // Need to copy into separate Collection here, to avoid side effects // on the Enumeration when removing attributes. Set<String> attrsToCheck = new HashSet<String>(); Enumeration<?> attrNames = request.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = (String) attrNames.nextElement(); if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) { attrsToCheck.add(attrName); } } // Add attributes that may have been removed attrsToCheck.addAll((Set<String>) attributesSnapshot.keySet()); // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); if (attrValue == null) { request.removeAttribute(attrName); } else if (attrValue != request.getAttribute(attrName)) { request.setAttribute(attrName, attrValue); } } }
From source file:org.springframework.web.servlet.DispatcherServlet.java
/** * Restore the request attributes after an include. * @param request current HTTP request//from w ww. java2 s .c o m * @param attributesSnapshot the snapshot of the request attributes before the include */ @SuppressWarnings("unchecked") private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?, ?> attributesSnapshot) { // Need to copy into separate Collection here, to avoid side effects // on the Enumeration when removing attributes. Set<String> attrsToCheck = new HashSet<>(); Enumeration<?> attrNames = request.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = (String) attrNames.nextElement(); if (this.cleanupAfterInclude || attrName.startsWith(DEFAULT_STRATEGIES_PREFIX)) { attrsToCheck.add(attrName); } } // Add attributes that may have been removed attrsToCheck.addAll((Set<String>) attributesSnapshot.keySet()); // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); if (attrValue == null) { request.removeAttribute(attrName); } else if (attrValue != request.getAttribute(attrName)) { request.setAttribute(attrName, attrValue); } } }
From source file:org.springframework.web.servlet.MyDispatcherServlet.java
/** * Restore the request attributes after an include. * @param request current HTTP request// www. j av a 2 s . c o m * @param attributesSnapshot the snapshot of the request attributes before the include */ private void restoreAttributesAfterInclude(HttpServletRequest request, Map<?, ?> attributesSnapshot) { logger.debug("Restoring snapshot of request attributes after include"); // Need to copy into separate Collection here, to avoid side effects // on the Enumeration when removing attributes. Set<String> attrsToCheck = new HashSet<String>(); Enumeration<?> attrNames = request.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = (String) attrNames.nextElement(); if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) { attrsToCheck.add(attrName); } } // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); if (attrValue == null) { if (logger.isDebugEnabled()) { logger.debug("Removing attribute [" + attrName + "] after include"); } request.removeAttribute(attrName); } else if (attrValue != request.getAttribute(attrName)) { if (logger.isDebugEnabled()) { logger.debug("Restoring original value of attribute [" + attrName + "] after include"); } request.setAttribute(attrName, attrValue); } } }
From source file:com.tecapro.inventory.common.action.BaseAction.java
/** * get download value/*w w w . java2 s . com*/ * @param request * @return * @throws Exception */ private Boolean checkDownloadRequest(BaseForm zform, HttpServletRequest request, HttpServletResponse response) throws Exception { Boolean result = false; String downloadValue = ""; HttpSession session = request.getSession(false); InfoValue info = zform.getValue().getInfo(); // get download key from request String downloadKey = (String) request.getParameter(Constants.DOWNLOAD_KEY); if (downloadKey != null && !"".equals(downloadKey)) { // decode download key downloadValue = (String) commonUtil.deserialize(downloadKey.getBytes()); } // check download value if (downloadValue != null && !"".equals(downloadValue) && downloadValue.contains(session.getId())) { String fileName = downloadValue .substring(downloadValue.lastIndexOf(DIVIDER_KEY) + DIVIDER_KEY.length()); // init download file info.getFile().get(0).setTempFileName(fileName, fileName); info.getFile().get(0).setDownloadFileName(fileName); // start download file downloadFile(zform, response); result = true; } request.removeAttribute(Constants.DOWNLOAD_KEY); info.getFile().set(0, new FileInfoValue()); return result; }
From source file:org.springframework.web.servlet.SimpleDispatcherServlet.java
/** * Restore the request attributes after an include. * @param request current HTTP request// ww w. jav a 2s. co m * @param attributesSnapshot the snapshot of the request attributes before the include */ private void restoreAttributesAfterInclude(HttpServletRequest request, Map attributesSnapshot) { logger.debug("Restoring snapshot of request attributes after include"); // Need to copy into separate Collection here, to avoid side effects // on the Enumeration when removing attributes. Set<String> attrsToCheck = new HashSet<String>(); Enumeration attrNames = request.getAttributeNames(); while (attrNames.hasMoreElements()) { String attrName = (String) attrNames.nextElement(); if (this.cleanupAfterInclude || attrName.startsWith("org.springframework.web.servlet")) { attrsToCheck.add(attrName); } } // Iterate over the attributes to check, restoring the original value // or removing the attribute, respectively, if appropriate. for (String attrName : attrsToCheck) { Object attrValue = attributesSnapshot.get(attrName); if (attrValue != null) { if (logger.isDebugEnabled()) { logger.debug("Restoring original value of attribute [" + attrName + "] after include"); } request.setAttribute(attrName, attrValue); } else { if (logger.isDebugEnabled()) { logger.debug("Removing attribute [" + attrName + "] after include"); } request.removeAttribute(attrName); } } }
From source file:net.hedtech.banner.filters.ZKPageFilter2.java
@Override public void doFilter(ServletRequest rq, ServletResponse rs, FilterChain chain) throws IOException, ServletException { HttpServletRequest request = (HttpServletRequest) rq; HttpServletResponse response = (HttpServletResponse) rs; ServletContext servletContext = filterConfig.getServletContext(); SiteMeshWebAppContext webAppContext = new SiteMeshWebAppContext(request, response, servletContext); if (filterAlreadyAppliedForRequest(request)) { // Prior to Servlet 2.4 spec, it was unspecified whether the filter should be called again upon an include(). chain.doFilter(request, response); return;//from w w w . j a v a 2 s .c om } if (isRoot(request)) { //request.getRequestDispatcher("/").forward(request,response); String redirectURL = (String) Holders.getFlatConfig() .get("bannerxe.admin.login.rootContextRedirectURL"); if (null != redirectURL && !"".equals(redirectURL)) { response.sendRedirect(redirectURL); } else { response.sendRedirect("banner.zul?page=mainPage"); } return; } if (isZUL(request)) { applyFormContext(request); // // TODO if disable live // Content content = obtainContent(contentProcessor, webAppContext, request, response, chain); if (content == null || response.isCommitted()) { return; } //applyLive(request, content); new GrailsNoDecorator().render(content, webAppContext); return; } if (isZK(request)) { applyFormContext(request); chain.doFilter(request, response); return; } if (!contentProcessor.handles(webAppContext)) { // Optimization: If the content doesn't need to be processed, bypass SiteMesh. chain.doFilter(request, response); return; } // clear the page in case it is already present request.removeAttribute(RequestConstants.PAGE); if (containerTweaks.shouldAutoCreateSession()) { request.getSession(true); } boolean dispatched = false; try { persistenceInterceptor.init(); Content content = obtainContent(contentProcessor, webAppContext, request, response, chain); if (content == null || response.isCommitted()) { return; } // applyLive(request, content); detectContentTypeFromPage(content, response); com.opensymphony.module.sitemesh.Decorator decorator = decoratorMapper.getDecorator(request, GSPSitemeshPage.content2htmlPage(content)); if (decorator instanceof Decorator) { ((Decorator) decorator).render(content, webAppContext); } else { new OldDecorator2NewDecorator(decorator).render(content, webAppContext); } dispatched = true; } catch (IllegalStateException e) { // Some containers (such as WebLogic) throw an IllegalStateException when an error page is served. // It may be ok to ignore this. However, for safety it is propegated if possible. if (!containerTweaks.shouldIgnoreIllegalStateExceptionOnErrorPage()) { throw e; } } finally { if (!dispatched) { // an error occured request.setAttribute(ALREADY_APPLIED_KEY, null); } if (persistenceInterceptor.isOpen()) { persistenceInterceptor.flush(); persistenceInterceptor.destroy(); } } }
From source file:org.ajax4jsf.webapp.BaseXMLFilter.java
/** * Perform filter chain with xml parsing and transformation. Subclasses must * implement concrete HTML to XML parsing, nesseasary transformations and * serialization./*from w ww .jav a 2 s . c o m*/ * * @param chain * @param httpServletRequest * @param httpServletResponse * @throws ServletException * @throws IOException */ protected void doXmlFilter(FilterChain chain, HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { if (log.isDebugEnabled()) { log.debug("XML filter service start processing request"); } FilterServletResponseWrapper servletResponseWrapper = getWrapper(response); // HACK - to avoid MyFaces <f:view> incompabilites and bypass // intermediaty filters // in chain, self-rendered region write directly to wrapper stored in // request-scope attribute. try { request.setAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE, servletResponseWrapper); chain.doFilter(request, servletResponseWrapper); } catch (ServletException e) { if (handleViewExpiredOnClient && (isViewExpired(e) || isViewExpired(e.getRootCause())) && isAjaxRequest(request)) { log.debug("ViewExpiredException in the filter chain - will be handled on the client", e); Writer output = resetResponse(response, servletResponseWrapper, "true"); String message = Messages.getMessage(Messages.AJAX_VIEW_EXPIRED); response.setHeader(AJAX_EXPIRED, message); output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>" + "<meta name=\"" + AjaxContainerRenderer.AJAX_FLAG_HEADER + "\" content=\"true\" />" + "<meta name=\"" + AJAX_EXPIRED + "\" content=\"" + message + "\" />" + "</head></html>"); output.flush(); response.flushBuffer(); return; } else { log.error("Exception in the filter chain", e); throw e; } } finally { request.removeAttribute(BaseFilter.RESPONSE_WRAPPER_ATTRIBUTE); } String viewId = (String) request.getAttribute(AjaxViewHandler.VIEW_ID_KEY); Node[] headEvents = (Node[]) request.getAttribute(AjaxContext.HEAD_EVENTS_PARAMETER); HtmlParser parser = null; // setup response // Redirect in AJAX request - convert to special response recognized by // client. String redirectLocation = servletResponseWrapper.getRedirectLocation(); String characterEncoding = servletResponseWrapper.getCharacterEncoding(); Writer output; if (null != redirectLocation) { if (isAjaxRequest(request)) { // Special handling of redirect - client-side script must // Check for response and perform redirect by window.location if (log.isDebugEnabled()) { log.debug("Create AJAX redirect response to url: " + redirectLocation); } output = resetResponse(response, servletResponseWrapper, "redirect"); response.setHeader(AjaxContainerRenderer.AJAX_LOCATION_HEADER, redirectLocation); // For buggy XmlHttpRequest realisations repeat headers in // <meta> output.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head>" + "<meta name=\"" + AjaxContainerRenderer.AJAX_FLAG_HEADER + "\" content=\"redirect\" />" + "<meta name=\"" + AjaxContainerRenderer.AJAX_LOCATION_HEADER + "\" content=\"" + redirectLocation + "\" />" + "</head></html>"); output.flush(); response.flushBuffer(); } else { response.sendRedirect(redirectLocation); } return; } else { if ("true".equals(servletResponseWrapper.getHeaders().get(AjaxContainerRenderer.AJAX_FLAG_HEADER))) { if (log.isDebugEnabled()) { log.debug("Process response to well-formed XML for AJAX XMLHttpRequest parser"); } // Not caching AJAX request response.setHeader("Cache-Control", "no-cache, must-revalidate, max_age=0, no-store"); response.setHeader("Expires", "0"); response.setHeader("Pragma", "no-cache"); // response.setCharacterEncoding(servletResponseWrapper // .getCharacterEncoding()); // // JSContentHandler.DEFAULT_ENCODING); // Set the content-type. For AJAX responses default encoding - // UTF8. // TODO - for null encoding, setup only Output encoding for // filter ? String outputEncoding = "UTF-8"; String contentType = getMimetype() + ";charset=" + outputEncoding; response.setContentType(contentType); parser = getParser(getMimetype(), true, viewId); if (null == parser) { throw new ServletException( Messages.getMessage(Messages.PARSER_NOT_INSTANTIATED_ERROR, contentType)); } output = createOutputWriter(response, outputEncoding); parser.setDoctype(getPublicid()); parser.setInputEncoding(characterEncoding); parser.setOutputEncoding(outputEncoding); parser.setViewState((String) request.getAttribute(AjaxViewHandler.SERIALIZED_STATE_KEY)); } else { // setup conversion reules for output contentType, send directly // if content not // supported by tidy. String contentType = servletResponseWrapper.getContentType(); String contentTypeCharset = contentType; if (log.isDebugEnabled()) { log.debug("create HTML/XML parser for content type: " + contentType); } // if(contentType == null){ // contentType = request.getContentType(); // } boolean forcenotrf = isForcenotrf(); if (forcenotrf || !servletResponseWrapper.isError()) { if (forcenotrf || (headEvents != null && headEvents.length != 0)) { if (contentTypeCharset != null) { if (contentTypeCharset.indexOf("charset") < 0 && null != characterEncoding) { contentTypeCharset += ";charset=" + characterEncoding; } parser = getParser(contentTypeCharset, false, viewId); if (null == parser) { if (log.isDebugEnabled()) { log.debug( "Parser not have support for the such content type, send response as-is"); } } } } else { if (log.isDebugEnabled()) { log.debug("No resource inclusions detected, send response as-is"); } } } else { if (log.isDebugEnabled()) { log.debug("Servlet error occured, send response as-is"); } } // null or unsupported content type if (null == parser) { try { if (servletResponseWrapper.isUseWriter()) { if (contentTypeCharset != null) { response.setContentType(contentTypeCharset); } output = createOutputWriter(response, characterEncoding); servletResponseWrapper.sendContent(output); } else if (servletResponseWrapper.isUseStream()) { if (contentType != null) { response.setContentType(contentType); } ServletOutputStream out = response.getOutputStream(); servletResponseWrapper.sendContent(out); } } finally { // reuseWrapper(servletResponseWrapper); } return; } if (contentTypeCharset != null) { response.setContentType(contentTypeCharset); } output = createOutputWriter(response, characterEncoding); parser.setInputEncoding(characterEncoding); parser.setOutputEncoding(characterEncoding); } } try { // Setup scripts and styles parser.setHeadNodes(headEvents); // Process parsing. long startTimeMills = System.currentTimeMillis(); servletResponseWrapper.parseContent(output, parser); if (log.isDebugEnabled()) { startTimeMills = System.currentTimeMillis() - startTimeMills; log.debug(Messages.getMessage(Messages.PARSING_TIME_INFO, "" + startTimeMills)); } } catch (Exception e) { throw new ServletException(Messages.getMessage(Messages.JTIDY_PARSING_ERROR), e); } finally { reuseParser(parser); } }
From source file:org.squale.squaleweb.applicationlayer.action.results.audit.AuditAction.java
/** * Permet la slection d'audits afficher. * // w w w . j a v a 2 s. c om * @param pMapping le mapping. * @param pForm le formulaire lire. * @param pRequest la requte HTTP. * @param pResponse la rponse de la servlet. * @return l'action raliser. */ public ActionForward select(ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse) { ActionErrors errors = new ActionErrors(); ActionForward forward = new ActionForward(); try { List auditsSelected = getAuditsSelected(pForm, pRequest); // Vrification de la slection if (auditsSelected.size() < 1 || auditsSelected.size() > 2) { ActionError error = new ActionError("error.invalid_audits_selection"); errors.add("invalid.selection", error); } else { Long applicationId = new Long(((AuditForm) auditsSelected.get(0)).getApplicationId()); pRequest.setAttribute("currentAuditId", "" + ((AuditForm) auditsSelected.get(0)).getId()); if (auditsSelected.size() == 1) { // S'il n'y en a qu'un de slectionn, on choisit aussi le prcdent de la liste // s'il existe AuditForm audit = getPreviousAudit((AuditForm) auditsSelected.get(0)); if (null != audit) { auditsSelected.add(audit); } } // On trie les audits dans l'ordre inverse chronologique AuditComparator ac = new AuditComparator(); Collections.sort(auditsSelected, ac); Collections.reverse(auditsSelected); // On remplit le formulaire qui sera mis en session AuditListForm listForm = new AuditListForm(); listForm.setAudits(auditsSelected); // on a russi rcuprer l'audit prcdent et il n'est pas nul if (auditsSelected.size() == 2) { pRequest.setAttribute("previousAuditId", "" + ((AuditForm) auditsSelected.get(1)).getId()); } pRequest.removeAttribute("id"); pRequest.setAttribute("applicationId", applicationId.toString()); // on dfinit l'audit en cours pour vrification (audit le plus rcent) pRequest.setAttribute("audit", auditsSelected.get(0)); // Forward diffrent selon le type de l'audit if (pRequest.getParameter("kind") != null && pRequest.getParameter("kind").equals("failed")) { String oldAuditId = pRequest.getParameter("oldAudit"); String oldPreviousAuditId = pRequest.getParameter("oldPreviousAudit"); if (null != oldAuditId) { // On le rajoute dans le requte pour pouvoir rcuprer l'action du bouton retour pRequest.setAttribute("oldAuditId", oldAuditId); pRequest.setAttribute("oldPreviousAuditId", oldPreviousAuditId); } else { // On met une valeur par dfaut pRequest.setAttribute("oldAuditId", "none"); pRequest.setAttribute("oldPreviousAuditId", "none"); } forward = pMapping.findForward("applicationErrors"); } else { forward = pMapping.findForward("application"); } // In all cases, add user access for the application addUserAccess(pRequest, applicationId.longValue()); } } catch (Exception e) { // Traitement factoris des exceptions handleException(e, errors, pRequest); } if (!errors.isEmpty()) { // Enregistrement du message et retour sur la page pour afficher l'erreur saveErrors(pRequest, errors); forward = pMapping.findForward("failure"); } // pas de tracker ici return forward; }
From source file:uk.ac.cam.caret.sakai.rwiki.tool.command.HelperCommand.java
public void execute(Dispatcher dispatcher, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // FIXME!!/*from w w w . j a v a 2 s .co m*/ String requestPath = request.getRequestURI() .substring(request.getContextPath().length() + request.getServletPath().length()); String[] parts = requestPath.split("/"); String helperId = null; // SAK-13408 - Tomcat and WAS have different URL structures; Attempting to add a // link or image would lead to site unavailable errors in websphere if the tomcat // URL structure is used. if ("websphere".equals(ServerConfigurationService.getString("servlet.container"))) { if (parts.length < 5) { throw new IllegalArgumentException("You must provide a helper name to request."); } helperId = parts[4]; } else { if (parts.length < 3) { throw new IllegalArgumentException("You must provide a helper name to request."); } helperId = parts[2]; } ActiveTool helperTool = activeToolManager.getActiveTool(helperId); // put state info in toolSession to communicate with helper StringBuffer context = new StringBuffer(request.getContextPath()).append(request.getServletPath()); StringBuffer toolPath = new StringBuffer(); // SAK-13408 - Tomcat and WAS have different URL structures; Attempting to add a // link or image would lead to site unavailable errors in websphere if the tomcat // URL structure is used. if ("websphere".equals(ServerConfigurationService.getString("servlet.container"))) { String tid = org.sakaiproject.tool.cover.ToolManager.getCurrentPlacement().getId(); context.append("/tool/"); context.append(tid); for (int i = 3; i < 5; i++) { context.append('/'); context.append(parts[i]); } for (int i = 5; i < parts.length; i++) { toolPath.append('/'); toolPath.append(parts[i]); } } else { for (int i = 1; i < 3; i++) { context.append('/'); context.append(parts[i]); } for (int i = 3; i < parts.length; i++) { toolPath.append('/'); toolPath.append(parts[i]); } } request.removeAttribute(Tool.NATIVE_URL); // this is the forward call helperTool.help(request, response, context.toString(), toolPath.toString()); }
From source file:org.fenixedu.academic.ui.struts.action.publico.ChooseExamsMapContextDANew.java
public ActionForward choose(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { final ActionErrors errors = new ActionErrors(); final DynaActionForm chooseExamContextoForm = (DynaActionForm) form; Boolean inEnglish = getFromRequestBoolean("inEnglish", request); if (inEnglish == null) { inEnglish = getLocale(request).getLanguage().equals(Locale.ENGLISH.getLanguage()); }//from w w w . j a va2s. c o m request.setAttribute("inEnglish", inEnglish); // index String indexValue = getFromRequest("index", request); request.setAttribute("index", indexValue); // degreeID String degreeId = (String) chooseExamContextoForm.get("degreeID"); request.setAttribute("degreeID", degreeId); final Degree degree = FenixFramework.getDomainObject(degreeId); request.setAttribute("degree", degree); // curricularYearList final Boolean selectAllCurricularYears = (Boolean) chooseExamContextoForm.get("selectAllCurricularYears"); final List<Integer> curricularYears = buildCurricularYearList(selectAllCurricularYears, degree, chooseExamContextoForm); request.setAttribute("curricularYearList", curricularYears); // degreeCurricularPlanID String degreeCurricularPlanId = getFromRequest("degreeCurricularPlanID", request); final DegreeCurricularPlan degreeCurricularPlan; if (StringUtils.isEmpty(degreeCurricularPlanId)) { degreeCurricularPlan = degree.getMostRecentDegreeCurricularPlan(); } else { degreeCurricularPlan = FenixFramework.getDomainObject(degreeCurricularPlanId); } if (degreeCurricularPlan != null) { request.setAttribute("degreeCurricularPlanID", degreeCurricularPlan.getExternalId()); if (!degreeCurricularPlan.getDegree().getExternalId().equals(degreeId)) { throw new FenixActionException(); } // lista List<LabelValueBean> executionPeriodsLabelValueList = buildExecutionPeriodsLabelValueList( degreeCurricularPlan.getExternalId()); if (executionPeriodsLabelValueList.size() > 1) { request.setAttribute("lista", executionPeriodsLabelValueList); } else { request.removeAttribute("lista"); } // infoDegreeCurricularPlan InfoDegreeCurricularPlan infoDegreeCurricularPlan = InfoDegreeCurricularPlan .newInfoFromDomain(degreeCurricularPlan); request.setAttribute("infoDegreeCurricularPlan", infoDegreeCurricularPlan); } InfoExecutionPeriod infoExecutionPeriod = (InfoExecutionPeriod) request .getAttribute(PresentationConstants.EXECUTION_PERIOD); String executionPeriodID = (String) chooseExamContextoForm.get("indice"); if (executionPeriodID != null && !executionPeriodID.equals("")) { infoExecutionPeriod = ReadExecutionPeriodByOID.run(executionPeriodID); } request.setAttribute("indice", infoExecutionPeriod.getExternalId()); chooseExamContextoForm.set("indice", infoExecutionPeriod.getExternalId()); RequestUtils.setExecutionPeriodToRequest(request, infoExecutionPeriod); request.setAttribute(PresentationConstants.EXECUTION_PERIOD, infoExecutionPeriod); request.setAttribute(PresentationConstants.EXECUTION_PERIOD_OID, infoExecutionPeriod.getExternalId().toString()); final ExecutionSemester executionSemester = FenixFramework .getDomainObject(infoExecutionPeriod.getExternalId()); ExecutionDegree executionDegree = null; if (degreeCurricularPlan != null) { executionDegree = degreeCurricularPlan.getExecutionDegreeByYear(executionSemester.getExecutionYear()); if (executionDegree == null) { executionDegree = degreeCurricularPlan.getMostRecentExecutionDegree(); if (executionDegree != null) { infoExecutionPeriod = InfoExecutionPeriod .newInfoFromDomain(executionDegree.getExecutionYear().getExecutionSemesterFor(1)); request.setAttribute("indice", infoExecutionPeriod.getExternalId()); chooseExamContextoForm.set("indice", infoExecutionPeriod.getExternalId()); RequestUtils.setExecutionPeriodToRequest(request, infoExecutionPeriod); request.setAttribute(PresentationConstants.EXECUTION_PERIOD, infoExecutionPeriod); request.setAttribute(PresentationConstants.EXECUTION_PERIOD_OID, infoExecutionPeriod.getExternalId().toString()); } } } if (executionDegree != null) { InfoExecutionDegree infoExecutionDegree = InfoExecutionDegree.newInfoFromDomain(executionDegree); request.setAttribute(PresentationConstants.EXECUTION_DEGREE, infoExecutionDegree); request.setAttribute("executionDegreeID", infoExecutionDegree.getExternalId().toString()); RequestUtils.setExecutionDegreeToRequest(request, infoExecutionDegree); } else { return mapping.findForward("viewExamsMap"); } return mapping.findForward("showExamsMap"); }