List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:org.jutge.joc.porra.controller.desktop.DesktopHomeController.java
@ExceptionHandler(PorraException.class) public String exceptionHandler(PorraException exception, HttpServletRequest request) { this.logger.info("DesktopHomeController.exceptionHandler"); request.setAttribute("errorMessages", exception.getErrorMessages()); return "/desktop/error"; }
From source file:de.jwic.renderer.jsp.JspRenderer.java
public void renderControl(Control control, RenderContext context) { if (log.isDebugEnabled()) { log.debug("Rendering control '" + control.getControlID() + "' with template '" + control.getTemplateName() + "'"); }// w w w .j a va2 s . c o m String ctrlDivID = "ctrl_" + control.getControlID();//.replace('.', '_'); PrintWriter writer = context.getWriter(); if (!control.isVisible()) { writer.print("<span id=\"" + ctrlDivID + "\">"); writer.print("</span>"); return; } HttpServletRequest request = context.getRequest(); request.setAttribute("control", control); request.setAttribute("jwic", new JWicTools(control.getSessionContext().getLocale(), control.getSessionContext().getTimeZone())); if (control instanceof IControlContainer) { request.setAttribute("insert", new ChildRenderer((IControlContainer) control, context)); } RequestDispatcher dispatcher = context.getRequest() .getRequestDispatcher("/WEB-INF/jwic/jsp/" + control.getTemplateName() + ".jsp"); try { HttpServletResponseFacade res = new HttpServletResponseFacade(context.getResponse(), context.getWriter()); writer.print("<span><span id=\"" + ctrlDivID + "\">"); dispatcher.include(context.getRequest(), res); writer.print("</span></span>"); } catch (Exception e) { log.error("Error including jsp page", e); context.getWriter().write("Error rendering Control (" + e + ")"); } }
From source file:edu.cornell.mannlib.vitro.webapp.filters.JSessionStripFilter.java
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse hResponse = (HttpServletResponse) response; HttpServletRequest hRequest = (HttpServletRequest) request; hRequest.setAttribute(USING_JSESSION_STRIP, "true"); if (hResponse.isCommitted()) { log.error("response is comitted cannot forward " + " (check you haven't done anything to the response (ie, written to it) before here)"); return;/*from ww w . jav a 2s . c o m*/ } chain.doFilter(hRequest, new StripSessionIdWrapper(hResponse)); }
From source file:com.technologicaloddity.saha.util.AjaxPageRendererImpl.java
public String renderWithNestedModel(ModelAndView modelAndView, HttpServletRequest request, HttpServletResponse response, String nestedModelAttributeName) { request.setAttribute(FormTag.MODEL_ATTRIBUTE_VARIABLE_NAME, nestedModelAttributeName); request.setAttribute(NestedPathTag.NESTED_PATH_VARIABLE_NAME, nestedModelAttributeName + PropertyAccessor.NESTED_PROPERTY_SEPARATOR); return render(modelAndView, request, response); }
From source file:furkan.app.tictactoewebsocket.TicTacToeServlet.java
@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { request.setAttribute("pendingGames", TicTacToeGame.getPendingGames()); this.view("list", request, response); }
From source file:cn.vlabs.umt.ui.actions.ActivationSecurityAction.java
/** * ?// ww w. jav a 2s. c om * */ public ActionForward doLoginSecurity(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { request.setAttribute("token", form); request.setAttribute("_securityEmail", request.getParameter("securityEmail")); request.setAttribute("_primaryEmail", request.getParameter("loginName")); return mapping.findForward("security.email.login"); }
From source file:spring.travel.site.request.RequestInfoInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { request.setAttribute(requestAttributeName, new Request(Optional.empty(), getSessionCookie(request), request.getRemoteAddr())); return true;/* ww w.ja v a 2 s. c om*/ }
From source file:net.sourceforge.fenixedu.presentationTier.Action.pedagogicalCouncil.inquiries.ViewQUCResultsPedagogicalCouncilDA.java
@Override public ActionForward showTeacherResultsAndComments(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { request.setAttribute("showAllComments", "true"); return super.showTeacherResultsAndComments(actionMapping, actionForm, request, response); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.resourceAllocationManager.ManageShiftDA.java
static List getExecutionCourses(HttpServletRequest request) throws Exception { List infoCourseList = new ArrayList(); // Ler Disciplinas em Execucao InfoCurricularYear infoCurricularYear = (InfoCurricularYear) request .getAttribute(PresentationConstants.CURRICULAR_YEAR); InfoExecutionDegree infoExecutionDegree = (InfoExecutionDegree) request .getAttribute(PresentationConstants.EXECUTION_DEGREE); AcademicInterval academicInterval = AcademicInterval.getAcademicIntervalFromResumedString( (String) request.getAttribute(PresentationConstants.ACADEMIC_INTERVAL)); infoCourseList = LerDisciplinasExecucaoDeLicenciaturaExecucaoEAnoCurricular.run(infoExecutionDegree, academicInterval, infoCurricularYear.getYear()); request.setAttribute(PresentationConstants.EXECUTION_COURSE_LIST_KEY, infoCourseList); return infoCourseList; }
From source file:com.adnature.framework.util.Struts2Utils.java
/** * ??Request/*from w w w . ja v a 2 s. c om*/ * @param prefix ?? */ public static void fillSearchParams(String prefix) { if (StringUtils.isBlank(prefix)) { return; } HttpServletRequest request = getRequest(); Map<String, Object> parmMap = new HashMap<String, Object>(); // request??????,?????Map Map<String, Object> filterParamMap = WebUtils.getParametersStartingWith(request, prefix + "#filter_"); if (filterParamMap != null && !filterParamMap.isEmpty()) { for (Entry<String, Object> entry : filterParamMap.entrySet()) { String filterName = entry.getKey(); String value = ((String) entry.getValue()).trim().replaceAll("\"", """); value = value.replaceAll("<", "<"); value = value.replaceAll(">", ">"); // value,filter. boolean omit = StringUtils.isBlank(value); if (!omit) { request.setAttribute("filter_" + filterName, value); parmMap.put("filter_" + filterName, value); } } request.setAttribute(SEARCH_KEY, parmMap); request.setAttribute(prefix, parmMap); } }