org.apache.shiro.session.ProxiedSession Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.shiro.session;
import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
/**
* Simple Session
implementation that immediately delegates all corresponding calls to an
* underlying proxied session instance.
*
* This class is mostly useful for framework subclassing to intercept certain Session
calls
* and perform additional logic.
*
* @since 0.9
*/
public class ProxiedSession implements Session {
/**
* The proxied instance
*/
protected final Session delegate;
/**
* Constructs an instance that proxies the specified target
. Subclasses may access this
* target via the protected final 'delegate'
attribute, i.e. this.delegate
.
*
* @param target the specified target Session
to proxy.
*/
public ProxiedSession(Session target) {
if (target == null) {
throw new IllegalArgumentException("Target session to proxy cannot be null.");
}
delegate = target;
}
/**
* Immediately delegates to the underlying proxied session.
*/
public Serializable getId() {
return delegate.getId();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public Date getStartTimestamp() {
return delegate.getStartTimestamp();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public Date getLastAccessTime() {
return delegate.getLastAccessTime();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public long getTimeout() throws InvalidSessionException {
return delegate.getTimeout();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public void setTimeout(long maxIdleTimeInMillis) throws InvalidSessionException {
delegate.setTimeout(maxIdleTimeInMillis);
}
/**
* Immediately delegates to the underlying proxied session.
*/
public String getHost() {
return delegate.getHost();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public void touch() throws InvalidSessionException {
delegate.touch();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public void stop() throws InvalidSessionException {
delegate.stop();
}
/**
* Immediately delegates to the underlying proxied session.
*/
public Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy