List of usage examples for javax.servlet.http HttpServletRequest setAttribute
public void setAttribute(String name, Object o);
From source file:com.bitranger.parknshop.buyer.controller.ShowMakeComment.java
@RequestMapping("/comment") public String showMakeComment(HttpServletRequest req, Integer psItemId) { PsItem psItem = psItemDao.findById(psItemId); req.setAttribute("psItem", psItem); return "buyer/buyer_comment"; }
From source file:com.googlesource.gerrit.plugins.gitblit.auth.GerritAuthenticationFilter.java
public boolean filterSessionAuth(final DynamicItem<WebSession> webSession, HttpServletRequest request) { request.setAttribute("gerrit-username", webSession.get().getCurrentUser().getUserName()); request.setAttribute("gerrit-token", webSession.get().getSessionId()); return true;//from www.ja v a2 s . c om }
From source file:org.itracker.web.util.LoginUtilities.java
public static boolean checkAutoLogin(HttpServletRequest request, boolean allowSaveLogin) { boolean foundLogin = false; if (request != null) { int authType = getRequestAuthType(request); // Check for auto login in request if (authType == AuthenticationConstants.AUTH_TYPE_REQUEST) { String redirectURL = request.getRequestURI().substring(request.getContextPath().length()) + (request.getQueryString() != null ? "?" + request.getQueryString() : ""); request.setAttribute(Constants.AUTH_TYPE_KEY, AuthenticationConstants.AUTH_TYPE_REQUEST); request.setAttribute(Constants.AUTH_REDIRECT_KEY, redirectURL); request.setAttribute("processLogin", "true"); foundLogin = true;//from w ww. j a va2s . c o m } // Add in check for client certs // Check for auto login with cookies, this will only happen if users // are allowed to save // their logins to cookies if (allowSaveLogin && !foundLogin) { Cookie[] cookies = request.getCookies(); if (cookies != null) { for (Cookie cookie : cookies) { if (Constants.COOKIE_NAME.equals(cookie.getName())) { int seperator = cookie.getValue().indexOf('~'); final String login; if (seperator > 0) { login = cookie.getValue().substring(0, seperator); if (logger.isDebugEnabled()) { logger.debug("Attempting autologin for user " + login + "."); } String redirectURL = request.getRequestURI() .substring(request.getContextPath().length()) + (request.getQueryString() != null ? "?" + request.getQueryString() : ""); request.setAttribute(Constants.AUTH_LOGIN_KEY, cookie.getValue().substring(0, seperator)); request.setAttribute(Constants.AUTH_TYPE_KEY, AuthenticationConstants.AUTH_TYPE_PASSWORD_ENC); request.setAttribute(Constants.AUTH_VALUE_KEY, cookie.getValue().substring(seperator + 1)); request.setAttribute(Constants.AUTH_REDIRECT_KEY, redirectURL); request.setAttribute("processLogin", "true"); foundLogin = true; } } } } } } return foundLogin; }
From source file:edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.SimpleHttpServletRequestWrapper.java
SimpleHttpServletRequestWrapper(HttpServletRequest request) { super(request); request.setAttribute(FILE_ITEM_MAP, Collections.EMPTY_MAP); }
From source file:com.zuoxiaolong.niubi.job.console.exception.DefaultHandlerExceptionResolver.java
protected void handleException(HttpServletRequest httpServletRequest, Exception exception) { httpServletRequest.setAttribute("message", "<div class=\"alert alert-error alert-block\">" + " <a class=\"close\" data-dismiss=\"alert\" href=\"#\"></a>" + "<h4 class=\"alert-heading\">Error!</h4>" + exception.getClass().getName() + ":" + exception.getMessage() + "</div>"); }
From source file:org.shredzone.cilla.view.interceptor.GenericViewInterceptor.java
@Override public void onRequest(HttpServletRequest req, HttpServletResponse resp) { Date now = new Date(); req.setAttribute("now", now); resp.setDateHeader("Date", now.getTime()); }
From source file:ru.org.linux.auth.SecurityFilter.java
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); HttpServletRequest request = (HttpServletRequest) req; request.setAttribute("configuration", ctx.getBean(Configuration.class)); request.setAttribute("template", new Template(ctx)); request.setCharacterEncoding("utf-8"); // ?? tomcat CSRFManipulation(request, (HttpServletResponse) res); forWikiManipulation(request, (HttpServletResponse) res); chain.doFilter(req, res);/*w ww . ja va 2 s . co m*/ }
From source file:com.qatickets.web.service.BuildVersionFilter.java
@Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; req.setAttribute("BUILD_VERSION", buildVersion); req.setAttribute("BUILD_TIMESTAMP", buildTimestamp); chain.doFilter(req, response);/*from w w w . j a va 2 s . co m*/ }
From source file:com.googlesource.gerrit.plugins.gitblit.auth.GerritAuthFilter.java
public boolean filterSessionAuth(final Provider<WebSession> webSession, HttpServletRequest request) { request.setAttribute("gerrit-username", webSession.get().getCurrentUser().getUserName()); request.setAttribute("gerrit-token", webSession.get().getSessionId()); return true;/*from www . j a v a 2s . c om*/ }
From source file:jp.co.ctc_g.jse.core.framework.AbstractJseExceptionHandler.java
/** * ?????//from ww w . j a va 2 s .c o m * @param ex * @param request */ protected void storeException(Exception ex, HttpServletRequest request) { request.setAttribute(Controllers.EXCEPTION_KEY, ex); }