Example usage for org.springframework.web.context.request WebRequest getSessionId

List of usage examples for org.springframework.web.context.request WebRequest getSessionId

Introduction

In this page you can find the example usage for org.springframework.web.context.request WebRequest getSessionId.

Prototype

String getSessionId();

Source Link

Document

Return an id for the current underlying session.

Usage

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.SessionController.java

/**
 * Tells the user their sessionId, and whether or not they are authenticated.
 * /* ww w . j a va2  s  . com*/
 * @param request
 * @return
 * @should return the session id if the user is authenticated
 * @should return the session id if the user is not authenticated
 */
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Object get(WebRequest request) {
    return new SimpleObject().add("sessionId", request.getSessionId()).add("authenticated",
            Context.isAuthenticated());
}

From source file:org.openmrs.module.hl7query.web.controller.Hl7QuerySessionController.java

/**
 * Tells the user their sessionId, and whether or not they are authenticated.
 * /*from  w  w w  .  j  a va2s. c  o m*/
 * @param request
 * @return
 * @should return the session id if the user is authenticated
 * @should return the session id if the user is not authenticated
 */
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Object get(WebRequest request) {
    return new AuthenticationErrorObject().add("sessionId", request.getSessionId()).add("authenticated",
            Context.isAuthenticated());
}

From source file:it.jugpadova.controllers.JuggerRegistrationController.java

@RequestMapping(method = RequestMethod.GET)
public String form(WebRequest req, Model model) {
    NewJugger jc = Utilities.newJuggerCaptcha();
    jc.setCaptchaId(req.getSessionId());
    jc.setCaptchaService(captchaService);
    jc.setRequireReliability(new RequireReliability());
    model.addAttribute(JUGGER_ATTRIBUTE, jc);
    return FORM_VIEW;
}

From source file:org.openmrs.module.webservices.rest.web.v1_0.controller.openmrs1_8.SessionController1_8.java

/**
 * Tells the user their sessionId, and whether or not they are authenticated.
 * //  w w w .ja v a  2s .c  om
 * @param request
 * @return
 * @should return the session id if the user is authenticated
 * @should return the session id if the user is not authenticated
 */
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Object get(WebRequest request) {
    boolean authenticated = Context.isAuthenticated();
    SimpleObject session = new SimpleObject();
    session.add("sessionId", request.getSessionId()).add("authenticated", authenticated);
    if (authenticated) {
        String repParam = request.getParameter(RestConstants.REQUEST_PROPERTY_FOR_REPRESENTATION);
        Representation rep = (repParam != null) ? restService.getRepresentation(repParam)
                : Representation.DEFAULT;
        session.add("user", ConversionUtil.convertToRepresentation(Context.getAuthenticatedUser(), rep));
        session.add("locale", Context.getLocale());
        session.add("allowedLocales", Context.getAdministrationService().getAllowedLocales());
    }
    return session;
}