List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:com.redhat.rhn.frontend.action.satellite.CatalinaAction.java
/** {@inheritDoc} */ public ActionForward execute(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) {/* w ww . j av a2 s .co m*/ String catalinaBase = System.getProperty("catalina.base"); String contents = FileUtils.getTailOfFile(catalinaBase + "/logs/catalina.out", 1000); contents = StringEscapeUtils.escapeHtml(contents); request.setAttribute("contents", contents); return mapping.findForward(RhnHelper.DEFAULT_FORWARD); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.phd.PhdProcessDA.java
protected void setIsEmployeeAttributeAndMessage(HttpServletRequest request, Person person) { if (person != null && person.hasRole(RoleType.EMPLOYEE)) { request.setAttribute("isEmployee", true); addWarningMessage(request, "message.employee.data.must.be.updated.in.human.resources.section"); } else {/*from w w w . j a v a 2 s .c om*/ request.setAttribute("isEmployee", false); } }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.ShowClassesDispatchAction.java
public Degree getDegree(HttpServletRequest request) throws FenixActionException { final Degree degree = ShowDegreeSiteAction.getDegree(request); if (degree != null) { request.setAttribute("degreeID", degree.getExternalId()); request.setAttribute("degree", degree); }/* ww w . j a va 2 s .co m*/ return degree; }
From source file:com.acc.storefront.interceptors.BeforeControllerHandlerInterceptor.java
@Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { if (request.getAttribute(INTERCEPTOR_ONCE_KEY) == null) { // Set the flag so that we are not executed multiple times request.setAttribute(INTERCEPTOR_ONCE_KEY, Boolean.TRUE); final HandlerMethod handlerMethod = (HandlerMethod) handler; // Call the pre handler once for the request for (final BeforeControllerHandler beforeControllerHandler : getBeforeControllerHandlers()) { if (!beforeControllerHandler.beforeController(request, response, handlerMethod)) { // Return false immediately if a handler returns false return false; }//from w w w . ja v a2 s . c om } } return true; }
From source file:com.liferay.blogs.portlet.test.PortletLayoutFinderTest.java
protected HttpServletRequest getHttpServletRequest() throws Exception { HttpServletRequest request = new MockHttpServletRequest(); ThemeDisplay themeDisplay = getThemeDisplay(); request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay); return request; }
From source file:com.sivalabs.jcart.admin.security.PostAuthorizationFilter.java
@Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws ServletException, IOException { String uri = request.getRequestURI(); if (!isIgnorableURI(uri)) { String menu = MenuConfiguration.getMatchingMenu(uri); request.setAttribute("CURRENT_MENU", menu); }/*from w ww .j av a 2s. c om*/ chain.doFilter(request, response); }
From source file:com.teamexception.reseravationmaven.controller.EquipmentController.java
@RequestMapping(value = "deleteEquipment", method = RequestMethod.GET) public String deleteEquipment(HttpServletRequest request) throws SQLException, ClassNotFoundException { String msg = ""; if (equipmentdao.deleteEquipment(request.getParameter("equipmentId"))) { msg = "Deleted Sucessfully"; request.setAttribute("msg", msg); } else {//from ww w. ja va 2 s . c o m msg = "Failed To Delete"; request.setAttribute("msg", msg); } return "success"; }
From source file:com.lc.storefront.interceptors.BeforeControllerHandlerInterceptor.java
@Override public boolean preHandle(final HttpServletRequest request, final HttpServletResponse response, final Object handler) throws Exception { if (request.getAttribute(INTERCEPTOR_ONCE_KEY) == null) {//from w w w .j a va 2 s . c o m // Set the flag so that we are not executed multiple times request.setAttribute(INTERCEPTOR_ONCE_KEY, Boolean.TRUE); final HandlerMethod handlerMethod = (HandlerMethod) handler; // Call the pre handler once for the request for (final BeforeControllerHandler beforeControllerHandler : getBeforeControllerHandlers()) { if (!beforeControllerHandler.beforeController(request, response, handlerMethod)) { // Return false immediately if a handler returns false return false; } } } return true; }
From source file:net.hillsdon.reviki.web.dispatching.impl.DispatcherImpl.java
public void handle(final HttpServletRequest request, final HttpServletResponse response) throws IOException, ServletException { request.setCharacterEncoding("UTF-8"); request.setAttribute(ApplicationUrls.KEY, _applicationUrls); // We should be able to use request.getPathInfo() as it's documented as // having been correctly decoded by the container, // however Tomcat at least fails with UTF-8. final String requestPath = getStrippedPath(URI.create(request.getRequestURI())); final String contextPath = request.getContextPath(); ConsumedPath path = new ConsumedPath(requestPath, contextPath); try {//from w ww. java2 s . c o m _requestLifecycleAwareManager.requestStarted(request); View view = handle(path, request, response); if (view != null) { view.render(request, response); } } catch (NotFoundException ex) { handleException(request, response, ex, false, "Could not find the file you were looking for.", 404); } catch (Exception ex) { handleException(request, response, ex, true, null, 500); } finally { _requestCompletedHandler.requestComplete(); } }
From source file:com.cloudbees.demo.beesshop.web.WebConfig.java
@Override public void addInterceptors(InterceptorRegistry registry) { super.addInterceptors(registry); HandlerInterceptor addShoppingCartInRequestHandlerInterceptor = new HandlerInterceptorAdapter() { @Override/* w w w . ja va 2 s . c o m*/ public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { ShoppingCart shoppingCart = shoppingCartRepository.getCurrentShoppingCart(request); request.setAttribute("shoppingCart", shoppingCart); } }; registry.addInterceptor(addShoppingCartInRequestHandlerInterceptor); }