Example usage for javax.servlet.http HttpServletRequest setAttribute

List of usage examples for javax.servlet.http HttpServletRequest setAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpServletRequest setAttribute.

Prototype

public void setAttribute(String name, Object o);

Source Link

Document

Stores an attribute in this request.

Usage

From source file:com.netcracker.financeapp.controller.spending.SpendingServlet.java

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    ArrayList<String> spendingTypeList = typeService.getSpendingTypeNames();
    request.setAttribute("spendingTypeList", spendingTypeList);

    ArrayList<String> bankCardNumbers = bankCardService.getBankCardNumbers();
    request.setAttribute("fromList", bankCardNumbers);

    ArrayList<String> agentNames = agentService.getAgentNames();
    request.setAttribute("toList", agentNames);

    request.getRequestDispatcher("spending/spendingPage.jsp").forward(request, response);

}

From source file:net.sourceforge.fenixedu.presentationTier.Action.administrativeOffice.gradeSubmission.MarkSheetDispatchAction.java

public ActionForward prepareSearchMarkSheetInvalid(ActionMapping mapping, ActionForm actionForm,
        HttpServletRequest request, HttpServletResponse response) {

    request.setAttribute("edit", RenderUtils.getViewState().getMetaObject().getObject());
    return mapping.getInputForward();
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.teacher.professorship.CreateProfessorshipDispatchAction.java

private void prepareConstants(DynaActionForm personExecutionCourseForm, HttpServletRequest request)
        throws FenixServiceException {

    request.setAttribute("infoPerson", InfoPerson.newInfoFromDomain(getPerson(personExecutionCourseForm)));
}

From source file:com.porvak.bracket.socialize.signin.AccountExposingHandlerInterceptor.java

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null && auth.getPrincipal() instanceof Account) {
        request.setAttribute("account", auth.getPrincipal());
    }/* w w  w . jav  a2 s.  c o m*/
    return true;
}

From source file:grails.plugin.springsecurity.web.filter.DebugFilter.java

protected void invokeWithWrappedRequest(HttpServletRequest request, HttpServletResponse response,
        FilterChain filterChain) throws IOException, ServletException {

    request.setAttribute(ALREADY_FILTERED_ATTR_NAME, true);

    request = new HttpServletRequestWrapper(request) {

        @Override// w  ww.j a v a 2 s  . c o m
        public HttpSession getSession() {
            boolean sessionExists = super.getSession(false) != null;
            HttpSession session = super.getSession();

            if (!sessionExists) {
                log(true, "New HTTP session created: {}", session.getId());
            }

            return session;
        }

        @Override
        public HttpSession getSession(boolean create) {
            return create ? getSession() : super.getSession(false);
        }
    };

    try {
        filterChainProxy.doFilter(request, response, filterChain);
    } finally {
        request.removeAttribute(ALREADY_FILTERED_ATTR_NAME);
    }
}

From source file:org.jtalks.common.web.util.UserDataInterceptor.java

/**
 * Can expose additional objects to the view.
 * Called after HandlerAdapter actually invoked the handler, but before the
 * DispatcherServlet renders the view./*from www.  j a  va 2s .c  om*/
 *
 * @param request      current HTTP request
 * @param response     current HTTP response
 * @param handler      chosen handler to execute, for type and/or instance examination
 * @param modelAndView the {@code ModelAndView} that the handler returned
 *                     (can also be {@code null})
 */
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
        ModelAndView modelAndView) {
    User user = securityService.getCurrentUser();

    String encodedUserName = user != null ? user.getEncodedUsername() : null;
    request.setAttribute("encodedUserName", encodedUserName);
}

From source file:com.concursive.connect.web.modules.login.auth.session.SessionValidator.java

public String sessionError(HttpServletRequest request, HttpServletResponse response, String message) {
    LoginBean failedSession = new LoginBean();
    failedSession.setMessage(message);// w ww .j a  v a2s  .c  om
    request.setAttribute("LoginBean", failedSession);
    LOG.debug(message);
    return "SecurityCheck";
}

From source file:com.indusborn.ui.signin.AccountExposingHandlerInterceptor.java

public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
        throws Exception {
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (auth != null && auth.getPrincipal() instanceof UserVO) {
        request.setAttribute("userVO", auth.getPrincipal());
    }//from  w  w  w  .j a va  2  s .  c o  m
    return true;
}

From source file:com.nominanuda.web.http.ServletHelper.java

public void storeHandlerOutput(HttpServletRequest servletRequest, Object handlerOutput) {
    servletRequest.setAttribute("__handlerOutput__", handlerOutput);
}

From source file:com.nominanuda.web.http.ServletHelper.java

public void storeResponse(HttpServletRequest servletRequest, HttpResponse response) {
    servletRequest.setAttribute("__HttpResponse__", response);
}