Example usage for org.apache.shiro.session UnknownSessionException UnknownSessionException

List of usage examples for org.apache.shiro.session UnknownSessionException UnknownSessionException

Introduction

In this page you can find the example usage for org.apache.shiro.session UnknownSessionException UnknownSessionException.

Prototype

public UnknownSessionException() 

Source Link

Document

Creates a new UnknownSessionException.

Usage

From source file:com.aerospike.shiro.AerospikeSessionDAO.java

License:Apache License

@Override
public Session doReadSession(Serializable sessionId) throws UnknownSessionException {
    Session session = null;//from   w  ww  .  j av  a 2 s.  c o  m
    Key key = new Key(this.namespace, this.setname, (String) sessionId);
    Record rec = this.client.get(null, key);
    if (rec != null) {
        session = (Session) rec.getValue(this.binname);
        this.client.touch(this.writePolicy, key);
    } else {
        throw new UnknownSessionException();
    }

    return session;
}

From source file:com.aerospike.shiro.AerospikeSessionDAO.java

License:Apache License

@Override
public void doUpdate(Session session) throws UnknownSessionException {
    Key key = new Key(this.namespace, this.setname, (String) session.getId());
    Record rec = this.client.get(null, key);
    if (rec != null) {
        this.storeSession((String) session.getId(), session);
    } else {/*from  ww w. j  a va2s . c  o  m*/
        throw new UnknownSessionException();
    }
}

From source file:com.parallax.server.blocklyprop.security.BlocklyPropSessionDao.java

/**
 * Retrieves the session from the EIS uniquely identified by the specified sessionId.
 *
 * @param sessionId/*from   www. j ava  2 s.  c  o m*/
 * the system-wide unique identifier of the Session object to retrieve from the EIS.
 *
 * @return
 * the persisted session in the EIS identified by sessionId.
 *
 * @throws UnknownSessionException
 * if there is no EIS record for any session with the specified sessionId
 */
@Override
public Session readSession(Serializable sessionId) throws UnknownSessionException {

    LOG.trace("Reading session: {}", sessionId);

    // Check parameter for sanity
    if (sessionId == null) {
        LOG.warn("Attempt to retrieve session with a null UUID parameter");
        throw new UnknownSessionException();
    }

    try {
        // Obtain an existing session object
        SessionRecord sessionRecord = SessionServiceImpl.getSessionService().readSession(sessionId.toString());

        if (sessionRecord != null) {
            return convert(sessionRecord);
        } else {
            LOG.warn("Unable to find session: {}", sessionId);
            throw new UnknownSessionException();
        }
    } catch (NullPointerException npe) {
        LOG.error("Unable to obtain session details. {}", npe.getMessage());
        throw new UnknownSessionException();
    }
}