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:controller.ControlPembayaran.java

public void tampil(HttpServletRequest request, HttpServletResponse response, String information)
        throws ServletException, IOException {
    RequestDispatcher dispatcher;/*from  w w w.j a  v  a 2  s .  c  om*/
    request.setAttribute("info", information);
    dispatcher = request.getRequestDispatcher("info.jsp");
    dispatcher.forward(request, response);
}

From source file:com.liferay.social.activity.test.util.BaseSocialActivityInterpreterTestCase.java

@Before
public void setUp() throws Exception {
    group = GroupTestUtil.addGroup();//from   w  w  w  . j  av a  2s  . co  m

    trashHelper = _serviceTracker.getService();

    HttpServletRequest request = new MockHttpServletRequest();

    request.setAttribute(WebKeys.COMPANY_ID, TestPropsValues.getCompanyId());
    request.setAttribute(WebKeys.CURRENT_URL, "http://localhost:80/web/guest/home");
    request.setAttribute(WebKeys.USER, TestPropsValues.getUser());

    ServicePreAction servicePreAction = new ServicePreAction();

    ThemeDisplay themeDisplay = servicePreAction.initThemeDisplay(request, new MockHttpServletResponse());

    request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay);

    serviceContext = ServiceContextFactory.getInstance(request);
}

From source file:com.teamexception.reseravationmaven.controller.PredefinedServicesController.java

@RequestMapping(value = "edit", method = RequestMethod.GET)
public String getAllServices(HttpServletRequest request) throws ClassNotFoundException, SQLException {
    ArrayList<PredefinedServices> servicesList = servicesDAO.getAllServices("F0000000001");
    request.setAttribute("serviceList", servicesList);
    return "facilitator/predefinedServices/editServices";
}

From source file:com.parallax.server.blocklyprop.servlets.ConfirmServlet.java

public void confirmToken(HttpServletRequest req, HttpServletResponse resp)
        throws ServletException, IOException {
    String token = req.getParameter("token");
    String email = req.getParameter("email");
    req.setAttribute("token", token == null ? "" : token);
    req.setAttribute("email", email == null ? "" : email);
    if (Strings.isNullOrEmpty(token) || Strings.isNullOrEmpty(email)) {
        req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
    } else {//from  ww w.  j a v a2 s. c o  m
        try {
            if (cloudSessionLocalUserService.doConfirm(email, token)) {
                // req.getRequestDispatcher("WEB-INF/servlet/confirm/confirmed.jsp").forward(req, resp);

                showTextilePage(req, resp, ConfirmPage.CONFIRMED);
            } else {
                req.setAttribute("invalidToken", "Invalid token");
                req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
            }
        } catch (UnknownUserException ex) {
            req.setAttribute("invalidToken", "Unknown email");
            req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
        } catch (ServerException se) {
            req.setAttribute("server-error", "Server exception");
            req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
        } catch (WrongAuthenticationSourceException ex) {
            log.warn("Trying to confirm email of non local user!");
            req.setAttribute("server-error", "Server exception");
            req.getRequestDispatcher("WEB-INF/servlet/confirm/confirm.jsp").forward(req, resp);
        }
    }
}

From source file:jp.co.opentone.bsol.framework.web.filter.GZipFilter.java

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse res = (HttpServletResponse) response;

    if (isFiltered(req)) {
        chain.doFilter(req, res);/*from ww  w.j  a v  a 2s. co  m*/
        return;
    }
    req.setAttribute(FILTERED, "true");

    if (!isCompressionSupported(req)) {
        chain.doFilter(req, res);
        return;
    }

    GZipResponseWrapper wrapper = new GZipResponseWrapper(res);
    try {
        chain.doFilter(req, wrapper);
    } finally {
        wrapper.finish();
    }
}

From source file:com.thumbsup.coolname.AccountController.java

@RequestMapping(value = "account/signup", method = RequestMethod.GET)
public String getSignup(HttpServletRequest request) {
    request.setAttribute("s", true);
    return "signup";
}

From source file:com.thumbsup.coolname.AccountController.java

@RequestMapping(value = "/account/login", method = RequestMethod.GET)
public String getLogin(HttpServletRequest request) {
    request.setAttribute("l", true);
    return "login";
}

From source file:org.shredzone.flufftron.view.FluffView.java

/**
 * Lists all the latest fluffs.//from  w  w w  . j a  va2  s .  c  o  m
 */
@View(pattern = "/index.html")
public String helloWorldView(HttpServletRequest req) throws ViewException, TwitterException {
    List<Fluff> fluffs = fluffDao.findAll(0, MAX_FLUFFS);
    Map<ObjectId, Person> persons = fluffService.getPersonMap(fluffs);

    req.setAttribute("fluffs", fluffs);
    req.setAttribute("persons", persons);
    req.setAttribute("pageName", "index");
    return "view/index.jsp";
}

From source file:org.xinta.eazycode.components.shiro.web.interceptor.CurrentUserInterceptor.java

@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o,
        ModelAndView modelAndView) {//from w ww  .  j a  v  a  2 s  . co  m
    // Add the current user into the request
    User currentUser = userService.getCurrentUser();
    if (currentUser != null) {
        httpServletRequest.setAttribute("currentUser", currentUser);
    }
}

From source file:gallery.web.controller.pages.types.EMailSendType.java

@Override
public UrlBean execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
    SendEmail command = new SendEmail();
    BindingResult res = validator.bindAndValidate(command, request);
    if (res.hasErrors()) {
        request.setAttribute(res.MODEL_KEY_PREFIX + config.getContentDataAttribute(), res);
        common.CommonAttributes.addErrorMessage("form_errors", request);
    } else {//from  www .j  a  v  a  2 s .  c om
        command.setEmail_to(email_adresses);
        mail_service.postMail(gallery.web.Config.SITE_NAME + ": " + command.getEmail_from(), command);
        common.CommonAttributes.addHelpMessage("operation_succeed", request);
    }
    request.setAttribute(config.getContentDataAttribute(), command);

    UrlBean url = new UrlBean();
    url.setContent(contentUrl);
    return url;
}