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:dijalmasilva.controllers.LugarController.java

@RequestMapping("/filtrar/data")
public String filtrarPorData(Date dataFiltro, HttpServletRequest req) {
    List<Lugar> todasOcorrencias = service.buscarPorData(dataFiltro.toLocalDate());
    req.getServletContext().setAttribute("todasOcorrencias", todasOcorrencias);
    req.setAttribute("result", "Ocorrncias ocorridas no dia "
            + dataFiltro.toLocalDate().format(DateTimeFormatter.ofPattern("dd/MM/yyyy")));
    req.getServletContext().setAttribute("existeFiltro", true);
    return "home";
}

From source file:com.example.cognitive.personality.DemoServlet.java

@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    req.setAttribute("content", getDefaultText());
    req.getRequestDispatcher("/pi/index.jsp").forward(req, resp);
}

From source file:jetbrains.buildServer.clouds.azure.arm.web.SettingsController.java

@Nullable
@Override/*  w  w w.  ja v  a 2 s.  c o m*/
protected ModelAndView doHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response)
        throws Exception {
    request.setAttribute("org.apache.catalina.ASYNC_SUPPORTED", true);

    try {
        if (isPost(request)) {
            doPost(request, response);
            return null;
        }

        return doGet();
    } catch (Throwable e) {
        LOG.error("Failed to handle request: " + e.getMessage(), e);
        throw e;
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.phd.candidacy.publicProgram.PublicPhdProgramCandidacyProcessDA.java

protected void canEditCandidacy(final HttpServletRequest request,
        final PhdProgramPublicCandidacyHashCode hashCode) {
    request.setAttribute("canEditCandidacy", !isValidatedByCandidate(hashCode));
}

From source file:com.ribas.andrei.web.DBDataServlet.java

private void logAndCreateException(HttpServletRequest req, Exception e) {

    LOGGER.error("An exception occurred.", e);

    String exceptionStackTrace = ExceptionUtils.getStackTrace(e);

    req.setAttribute("exceptionStackTrace", exceptionStackTrace);

}

From source file:net.sourceforge.fenixedu.presentationTier.Action.gep.TeachingStaffDispatchAction.java

public ActionForward prepare(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request,
        HttpServletResponse response) throws FenixServiceException {

    request.setAttribute("executionYears", ReadNotClosedExecutionYears.run());

    return mapping.findForward("chooseExecutionYearAndDegreeCurricularPlan");
}

From source file:com.ync365.px.web.account.LoginController.java

@RequestMapping(method = RequestMethod.POST)
public String fail(HttpServletRequest request, HttpServletResponse response) {
    String msg = (String) request.getAttribute("shiroLoginFailure");
    if (StringUtils.length(msg) >= 15) {//?????
        request.setAttribute("errorMsg", "???");
    } else {/*  ww w .  j  a  v a 2 s  .  c o  m*/
        request.setAttribute("errorMsg", msg);
    }
    if (!SecurityUtils.getSubject().isAuthenticated()) {
        response.setStatus(901);
        return "account/login_soft";
    }
    return "redirect:/tohomepage";
}

From source file:org.jboss.arquillian.warp.impl.server.execution.WarpFilter.java

/**
 * <p>// w w w  . ja  v  a 2s .  co m
 * Checks whether the request processing can be delegated to one of registered {@link RequestDelegationService}s.
 * </p>
 *
 * <p>
 * If not, delegates processing to {@link #doFilterWarp(HttpServletRequest, HttpServletResponse, FilterChain)}.
 * </p>
 */
private void doFilterHttp(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
        throws IOException, ServletException {

    request.setAttribute(ARQUILLIAN_MANAGER_ATTRIBUTE, manager);

    boolean isDelegated = delegator.tryDelegateRequest(request, response, filterChain);

    if (!isDelegated) {
        doFilterWarp(request, response, filterChain);
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.gesdis.TeachingReportAction.java

private void setInfoCoursesHistoric(HttpServletRequest request, List list, ActionMapping mapping)
        throws Exception {
    if (list != null) {
        request.setAttribute("infoCoursesHistoric", list);
    }//from  w w  w.j  a va  2s . com
}

From source file:com.cabguru.servlet.AddDriverServlet.java

private void dispatch(HttpServletRequest request, HttpServletResponse response, String callerPage, String msg) {

    try {//w  w w.  j  a  v a 2 s.c  om
        request.setAttribute("msg", msg);
        RequestDispatcher rd = request.getRequestDispatcher(callerPage);
        rd.forward(request, response);
    } catch (ServletException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

}