Example usage for javax.servlet.http HttpSession getAttribute

List of usage examples for javax.servlet.http HttpSession getAttribute

Introduction

In this page you can find the example usage for javax.servlet.http HttpSession getAttribute.

Prototype

public Object getAttribute(String name);

Source Link

Document

Returns the object bound with the specified name in this session, or null if no object is bound under the name.

Usage

From source file:com.linecorp.sample.login.application.controller.APIController.java

private AccessToken getAccessToken(HttpSession httpSession) {
    return (AccessToken) httpSession.getAttribute(WebController.ACCESS_TOKEN);
}

From source file:mx.com.quadrum.contratos.controller.busquedas.ContratoBusquedaClienteController.java

@RequestMapping(value = "buscarTodosContratosCliente", method = RequestMethod.GET)
public ModelAndView buscarTodosContratosCliente(ModelMap model, HttpSession session) {
    if (session.getAttribute(USUARIO) == null && session.getAttribute(CLIENTE) == null) {
        return new ModelAndView("templates/index");
    }//from w  w w .j  a  v  a 2s. c o  m

    Contacto contacto = (Contacto) session.getAttribute(CLIENTE);

    List<Contrato> contratos = busquedasContratos.buscarPorContacto(contacto.getId());
    model.put("contratos", contratos);
    return new ModelAndView("cliente/contratoAux", model);
}

From source file:mx.com.quadrum.contratos.controller.crud.GradoController.java

@ResponseBody
@RequestMapping(value = "agregarGrado", method = RequestMethod.POST)
public String agregarGrado(@Valid @ModelAttribute("grado") Grado grado, BindingResult bindingResult,
        HttpSession session) {
    if (session.getAttribute("usuario") == null) {
        return SESION_CADUCA;
    }// www.j ava2  s .  co  m
    if (bindingResult.hasErrors()) {
        return ERROR_DATOS;
    }
    return gradoService.agregar(grado);
}

From source file:mx.com.quadrum.contratos.controller.crud.GradoController.java

@ResponseBody
@RequestMapping(value = "editarGrado", method = RequestMethod.POST)
public String editarGrado(@Valid @ModelAttribute("grado") Grado grado, BindingResult bindingResult,
        HttpSession session) {
    if (session.getAttribute("usuario") == null) {
        return SESION_CADUCA;
    }/*from   w w  w  .  j ava2s.c  om*/
    if (bindingResult.hasErrors()) {
        return ERROR_DATOS;
    }
    return gradoService.editar(grado);
}

From source file:mx.com.quadrum.contratos.controller.busquedas.ContratoBusquedaClienteController.java

@RequestMapping(value = "buscarPorEstadoCliente/{idEstado}", method = RequestMethod.GET)
public ModelAndView buscarPorEstadoCliente(@PathVariable("idEstado") Integer idEstado, ModelMap model,
        HttpSession session) {
    if (session.getAttribute(USUARIO) == null && session.getAttribute(CLIENTE) == null) {
        return new ModelAndView("templates/index");
    }/*from   w ww .  j a  va2s .c om*/

    Contacto contacto = (Contacto) session.getAttribute(CLIENTE);

    List<Contrato> contratos = busquedasContratos.buscarPorEstadoCliente((idEstado), contacto.getId());
    model.put("contratos", contratos);
    return new ModelAndView("cliente/contratoAux", model);
}

From source file:com.abdin.noorsingles.service.AdminService.java

public boolean isAuthenticated(HttpSession session) {
    Boolean authenticated = (Boolean) session.getAttribute("authenticated");
    if (authenticated != null && authenticated.booleanValue()) {
        return true;
    }/*from   w  w  w  .j a  v a 2s  .  c  o m*/
    return false;
}

From source file:com.wx.spring.controller.UserController.java

/** 
 * ?@OAuthRequired //from   w ww.  j  av  a2s  .co  m
 * @param model 
 * @return 
 */
@RequestMapping(value = { "/userInfo.do" })
@OAuthRequired
public String load(HttpServletRequest request, Model model) {
    System.out.println("Load a User!");
    HttpSession session = request.getSession();
    model.addAttribute("Userid", session.getAttribute("Userid"));
    return "user";
}

From source file:mx.com.quadrum.contratos.controller.busquedas.ContratoBusquedaClienteController.java

@RequestMapping(value = "buscarPorTipoDeContratoCliente/{idTipoContrato}", method = RequestMethod.GET)
public ModelAndView buscarPorTipoDeContratoCliente(@PathVariable("idTipoContrato") Integer idTipoContrato,
        ModelMap model, HttpSession session) {
    if (session.getAttribute(USUARIO) == null && session.getAttribute(CLIENTE) == null) {
        return new ModelAndView("templates/index");
    }//from   w w w  . ja v a 2 s .c o  m

    Contacto contacto = (Contacto) session.getAttribute(CLIENTE);

    List<Contrato> contratos = busquedasContratos.buscarPorTipoDeContratoCliente((idTipoContrato),
            contacto.getId());
    model.put("contratos", contratos);
    return new ModelAndView("cliente/contratoAux", model);
}

From source file:mx.com.quadrum.contratos.controller.crud.PermisoController.java

@ResponseBody
@RequestMapping(value = "eliminarPermiso", method = RequestMethod.POST)
public String eliminarPermiso(Permiso permiso, BindingResult bindingResult, HttpSession session) {
    if (session.getAttribute("usuario") == null) {
        return SESION_CADUCA;
    }/*w  w  w  .  ja va2s.com*/
    return permisoService.eliminar(permiso);
}

From source file:org.openmrs.web.servlet.DisplayChartServlet.java

protected JFreeChart createChart(HttpServletRequest request, HttpServletResponse response) {

    String key = request.getParameter(CHART_KEY);

    HttpSession session = request.getSession();
    Object o = session.getAttribute(key);

    if (o == null) {
        log.error("Unable to find chart in session with key: " + key);
    }// w w w  .j ava2  s  .  c  om

    return (JFreeChart) o;

}