예제 #1
0
  protected void checkState() throws IllegalStateException {
    if (_state == null) throw new IllegalStateException("invalid session");
    else {

      // this is a hack to get new interceptor stack to work... - TODO
      //          StateInterceptor si=(StateInterceptor)_state;
      //          si.setManager(_manager);
      //          si.setSession(this);
      StateInterceptor si = null;
      if (_state instanceof StateInterceptor) {
        si = (StateInterceptor) _state;
        si.setManager(_manager);
        si.setSession(this);
      } else {
        si = new StateInterceptor();
        si.setManager(_manager);
        si.setSession(this);
        si.setState(_state);
        _state = si;
      }
    }
  }
예제 #2
0
  // hmmmm...
  // why does Greg call this?
  // could it be compressed into a subsequent call ?
  public boolean isValid() {
    if (_state == null) return false;

    StateInterceptor si = (StateInterceptor) _state;
    si.setManager(_manager);
    si.setSession(this);

    try {
      _state.getLastAccessedTime(); // this should cause an interceptor/the session to check
      return true;
    } catch (IllegalStateException ignore) {
      return false;
    } catch (Exception e) {
      Log.warn("problem contacting HttpSession", e);
      return false;
    }
  }