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:edu.temple.cis3238.wiki.ui.servlets.UploaderServlet.java

private void setStatus(HttpServletRequest request, boolean success, String msg) {
    request.setAttribute("success", success + "");
    this.setSuccess(success);
    if (msg != null) {
        setMessage(StringUtils.stripInvalidChars(msg));
        request.setAttribute("message", getMessage());
    }/*from   w  ww  .java2 s.c o m*/
}

From source file:com.squid.kraken.v4.auth.LostServlet.java

/**
 * Display the input screen.//from  ww  w .j av  a  2  s .  co  m
 *
 * @param request
 * @param response
 * @throws ServletException
 * @throws IOException
 */
private void show(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {

    RequestDispatcher rd;
    request.setAttribute(CUSTOMER_ID, request.getParameter(CUSTOMER_ID));
    request.setAttribute(CLIENT_ID, KrakenClientConfig.get("signin.default.clientid", "admin_console"));
    rd = getServletContext().getRequestDispatcher(LOST_JSP);
    rd.forward(request, response);
}

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

public String updateServiceVehilceType(HttpServletRequest request) throws ClassNotFoundException, SQLException {
    settingUpValues(request);/*from www. j a  v a2  s. c o  m*/
    if (serviceTypeDAO.updateService(type)) {
        String msg = "Updated Sucessfully";
        request.setAttribute("msg", msg);
    } else {
        String msg = "Failed To Update";
        request.setAttribute("msg", msg);
    }
    return "success";
}

From source file:Controller.VmProfUpdateServlet.java

public void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    try {/* w  ww.  ja v a2s.c  om*/
        Iaas ias = new Iaas();
        HttpSession session = request.getSession();

        request.setAttribute("RequestUpdate", false);
        Container c = ias.getContainer(Integer.parseInt(request.getParameter("actionChange")));
        c.setVmid(request.getParameter("actionChange"));
        //System.out.println("id====="+ request.getParameter("VMid"));

        long disk = Long.parseLong(c.getDisk()) / (1024 * 1024 * 1024);
        c.setDisk(Long.toString(disk));
        long ram = Long.parseLong(c.getMemory()) / (1024 * 1024);
        c.setMemory(Long.toString(ram));
        //session.setAttribute(ATTR_INFO_CONTAINER, c);
        c.setConsole(ias.getConsole(Integer.parseInt(request.getParameter("actionChange"))));
        System.out.println("*********** AFFICHE LA CONSOLE DANS VUE VM PROF MODIFY :  " + c.getConsole());
        request.setAttribute(ATTR_INFO_CONTAINER, c);
        System.out.println("test=" + c.toString());
        this.getServletContext().getRequestDispatcher(VUE_VM_PROF_MODIFY).forward(request, response);
    } catch (JSONException ex) {
        Logger.getLogger(VmProfUpdateServlet.class.getName()).log(Level.SEVERE, null, ex);
    } catch (LoginException ex) {
        Logger.getLogger(VmProfUpdateServlet.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:org.zht.framework.web.controller.BaseController.java

@ExceptionHandler
@ResponseBody/*from w  w w  .j  a  v  a 2  s  .c  o  m*/
public Object processGlobalExceptions(HttpServletRequest request, Exception e) throws Exception {
    request.setAttribute("exceptionMessage", e);
    if (e instanceof ServiceLogicalException) {
        return ajaxDoneError(e.getMessage());
    } else if (e instanceof ParameterException) {
        return ajaxDoneError(defaultValidateError + e.getMessage());
    } else if (e instanceof UnauthorizedException) {//?
        String accept = request.getHeader("accept");
        if (accept != null && accept.contains("application/json")) {
            return ajaxAuthError(defaultAuthError + e.getMessage());
        } else {
            return returnMeaasgeMV("error/UnauthorizedException", "??" + e.getMessage());
        }
    } else if (e instanceof UnauthenticatedException) {//?
        return ajaxAuthError(defaultAuthError + e.getMessage());
    }
    //      else if (e instanceof UnknownAccountException) {
    //         return ajaxAuthError(defaultAuthError + e.getMessage());
    //      } 
    else if (e instanceof Exception) {
        LogUtil.genErrorLog(request, "Exception:" + e.getMessage(), e);
        e.printStackTrace();

        return ajaxServerError("?" + e.getMessage());
    } else {
        throw e;
    }
}

From source file:cn.vlabs.duckling.vwb.ui.servlet.OauthLogoutServlet.java

private VWBContext getAdminLogoutContext(HttpServletRequest request) {
    VWBContext context = VWBContext.getContext(request);
    VWBContext adminSiteContext = VWBContext.createContext(1, request, VWBCommand.LOGOUT, null);
    request.setAttribute("vwb.context", context);
    return adminSiteContext;
}

From source file:org.shredzone.cilla.web.comment.CommentFormHandlerImpl.java

/**
 * Sets a message to be shown when the {@link Page} is rendered again.
 *
 * @param req/*from   w w  w  .  jav a  2  s. c o m*/
 *            {@link HttpServletRequest} with the form data
 * @param message
 *            the error message to be shown
 */
private void setMessage(HttpServletRequest req, String message) {
    req.setAttribute("commentMessageKey", message);
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.manager.enrolments.BolonhaEnrolmentsManagementDA.java

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

    request.setAttribute("registration", getDomainObject(request, "registrationId"));
    return mapping.findForward("showRegistrationStatesLog");
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.InternationalRegistrationDA.java

public ActionForward showInternationalRegistration(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {

    Person person = readPersonByCandidacyHashCode(request.getParameter("hash"));

    if (person != null) {
        request.setAttribute("person", person);
        return mapping.findForward("international-registration");
    } else {/*w  w  w . ja  v  a 2 s  . c om*/
        return setError(request, mapping, "internationalRegistration.error.invalidLink",
                "international-registration", null);
    }

}

From source file:cn.vlabs.umt.ui.actions.ActivationPrimaryAction.java

public ActionForward doLoginPrimaryOnlyActive(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    request.setAttribute("_primaryEmail", request.getParameter("primaryEmail"));
    request.setAttribute("_requestAct", request.getParameter("requestAct"));
    request.setAttribute("token", form);
    return mapping.findForward("set.primaryEmail.show.active.login");
}