List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:org.shredzone.flufftron.view.PersonView.java
/** * Lists all persons registered with flufftron. *//*from www . j ava 2 s . co m*/ @View(pattern = "/for/index.html") public String personListView(HttpServletRequest req) throws ViewException, TwitterException { List<Person> persons = personDao.findAll(); req.setAttribute("persons", persons); req.setAttribute("pageName", "person"); return "view/personList.jsp"; }
From source file:org.fuzzydb.samples.social.ConnectedToHandlerInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (request.getUserPrincipal() != null) { request.setAttribute("connectedToTwitter", connectionRepository.findConnections("twitter").size() > 0); request.setAttribute("connectedToFacebook", connectionRepository.findConnections("facebook").size() > 0); }/*from w w w . java 2s. c o m*/ return true; }
From source file:com.iflytek.edu.cloud.frame.spring.rest.ServiceMethodInfoHandlerMapping.java
/** * Expose URI template variables, matrix variables, and producible media types in the request. * @see HandlerMapping#URI_TEMPLATE_VARIABLES_ATTRIBUTE * @see HandlerMapping#MATRIX_VARIABLES_ATTRIBUTE * @see HandlerMapping#PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE *//*from ww w .java 2 s .com*/ @Override protected void handleMatch(ServiceMethodInfo info, String lookupPath, HttpServletRequest request) { super.handleMatch(info, lookupPath, request); request.setAttribute(BEST_MATCHING_PATTERN_ATTRIBUTE, lookupPath); request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, Collections.emptyMap()); }
From source file:com.skymobi.monitor.security.UserInterceptor.java
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { if (request.getUserPrincipal() != null) { request.setAttribute(SimpleAuthz.USER_PRINCIPAL, request.getUserPrincipal()); request.setAttribute("userName", request.getUserPrincipal().getName()); }//from w w w .jav a 2 s .co m logger.debug("receive a page request "); return true; }
From source file:com.web.mavenproject6.other.GlobalExceptionHandler.java
@ExceptionHandler(ArithmeticException.class) public ModelAndView handleIOException2(HttpServletRequest request, Exception ex, Map<String, Object> model) { logger.error("IOException handler executed"); model.put("message", ex.toString()); request.setAttribute("message", ex.toString()); return new ModelAndView("thy/error/Exception"); }
From source file:net.thewaffleshop.nimbus.security.ForwardingAuthenticationHandler.java
@Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { request.setAttribute("authenticationException", exception); request.getRequestDispatcher("/authenticationFailure").forward(request, response); }
From source file:gov.nih.nci.cabig.caaers.web.admin.ASAELImporter.java
@Override public void save(ImportCommand command, HttpServletRequest request) { importer.setFile(command.getXmlFile()); try {//from ww w. j a va2 s. c o m Map<String, Object> map = importer.importFile(); request.setAttribute("results", map); } catch (Exception e) { logger.error("Error while importing ASAEL.", e); } }
From source file:io.github.benas.todolist.web.servlet.todo.DeleteTodoServlet.java
private void redirectToErrorPage(HttpServletRequest request, HttpServletResponse response, String todoId) throws ServletException, IOException { request.setAttribute("error", MessageFormat.format(resourceBundle.getString("no.such.todo"), todoId)); request.getRequestDispatcher(ERROR_PAGE).forward(request, response); }
From source file:org.ucll.ip.spring_ip_project.controller.TankController.java
@RequestMapping(method = RequestMethod.POST, value = "/save") public String saveTank(@ModelAttribute("tank") Tank tank, BindingResult result, HttpServletRequest req) { if (result.hasErrors()) { String name = req.getParameter("player"); req.setAttribute("player", name); return "tankForm"; }//w w w. j ava 2 s . c o m String name = req.getParameter("player"); system.addTank(tank); system.getPlayer(name).addTankToPlayer(tank); return "redirect:/player.htm"; }
From source file:net.sourceforge.fenixedu.presentationTier.Action.personnelSection.ManagePeople.java
public ActionForward viewPerson(final Person person, final ActionMapping mapping, final HttpServletRequest request) throws Exception { request.setAttribute("person", person); return mapping.findForward("viewPerson"); }