/** * Generates a new ID to be applied to the specified {@code session} instance. This method is usually called * from within a subclass's {@link #doCreate} implementation where they assign the returned id to the session * instance and then create a record with this ID in the EIS data store. * <p/> * Subclass implementations backed by EIS data stores that auto-generate IDs during record creation, such as * relational databases, don't need to use this method or the {@link #getSessionIdGenerator() sessionIdGenerator} * attribute - they can simply return the data store's generated ID from the {@link #doCreate} implementation * if desired. * <p/> * This implementation uses the {@link #setSessionIdGenerator configured} {@link SessionIdGenerator} to create * the ID. * * @param session the new session instance for which an ID will be generated and then assigned * @return the generated ID to assign */ protected Serializable generateSessionId(Session session) { if (this.sessionIdGenerator == null) { String msg = "sessionIdGenerator attribute has not been configured."; throw new IllegalStateException(msg); } return this.sessionIdGenerator.generateId(session); }
/** * Generates a new ID to be applied to the specified {@code session} instance. This method is usually called * from within a subclass's {@link #doCreate} implementation where they assign the returned id to the session * instance and then create a record with this ID in the EIS data store. * <p/> * Subclass implementations backed by EIS data stores that auto-generate IDs during record creation, such as * relational databases, don't need to use this method or the {@link #getSessionIdGenerator() sessionIdGenerator} * attribute - they can simply return the data store's generated ID from the {@link #doCreate} implementation * if desired. * <p/> * This implementation uses the {@link #setSessionIdGenerator configured} {@link SessionIdGenerator} to create * the ID. * * @param session the new session instance for which an ID will be generated and then assigned * @return the generated ID to assign */ protected Serializable generateSessionId(Session session) { if (this.sessionIdGenerator == null) { String msg = "sessionIdGenerator attribute has not been configured."; throw new IllegalStateException(msg); } return this.sessionIdGenerator.generateId(session); }
/** * Generates a new ID to be applied to the specified {@code session} instance. This method is usually called * from within a subclass's {@link #doCreate} implementation where they assign the returned id to the session * instance and then create a record with this ID in the EIS data store. * <p/> * Subclass implementations backed by EIS data stores that auto-generate IDs during record creation, such as * relational databases, don't need to use this method or the {@link #getSessionIdGenerator() sessionIdGenerator} * attribute - they can simply return the data store's generated ID from the {@link #doCreate} implementation * if desired. * <p/> * This implementation uses the {@link #setSessionIdGenerator configured} {@link SessionIdGenerator} to create * the ID. * * @param session the new session instance for which an ID will be generated and then assigned * @return the generated ID to assign */ protected Serializable generateSessionId(Session session) { if (this.sessionIdGenerator == null) { String msg = "sessionIdGenerator attribute has not been configured."; throw new IllegalStateException(msg); } return this.sessionIdGenerator.generateId(session); }
( (SimpleSession) session ).setId( fakeSessionIdGenerator.generateId( session ) ); log.debug( "Stateless client session {} is not persisted.", session.getId() ); session.setAttribute( DO_NOT_STORE_SESSION_KEY, Boolean.TRUE );