本文整理汇总了Java中org.apache.mina.core.filterchain.IoFilterChain.getSession方法的典型用法代码示例。如果您正苦于以下问题:Java IoFilterChain.getSession方法的具体用法?Java IoFilterChain.getSession怎么用?Java IoFilterChain.getSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.filterchain.IoFilterChain
的用法示例。
在下文中一共展示了IoFilterChain.getSession方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPostRemove
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
super.onPostRemove(parent, name, nextFilter);
IoSession session = parent.getSession();
if (session == null) {
return;
}
Zlib inflater = (Zlib) session.getAttribute(INFLATER);
Zlib deflater = (Zlib) session.getAttribute(DEFLATER);
if (deflater != null) {
deflater.cleanUp();
}
if (inflater != null) {
inflater.cleanUp();
}
}
示例2: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* Executed just before the filter is added into the chain, we do :
* <ul>
* <li>check that we don't have a SSL filter already present
* <li>we update the next filter
* <li>we create the SSL handler helper class
* <li>and we store it into the session's Attributes
* </ul>
*/
@Override
public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException {
// Check that we don't have a SSL filter already present in the chain
if (parent.contains(SslFilter.class)) {
String msg = "Only one SSL filter is permitted in a chain.";
LOGGER.error(msg);
throw new IllegalStateException(msg);
}
LOGGER.debug("Adding the SSL Filter {} to the chain", name);
IoSession session = parent.getSession();
session.setAttribute(NEXT_FILTER, nextFilter);
// Create a SSL handler and start handshake.
SslHandler handler = new SslHandler(this, session);
handler.init();
session.setAttribute(SSL_HANDLER, handler);
}
示例3: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* Executed just before the filter is added into the chain, we do :
* <ul>
* <li>check that we don't have a SSL filter already present
* <li>we update the next filter
* <li>we create the SSL handler helper class
* <li>and we store it into the session's Attributes
* </ul>
*/
@Override
public void onPreAdd(IoFilterChain chain, String name, NextFilter nextFilter) throws SSLException {
// Check that we don't have a SSL filter already present in the chain
if (chain.getEntry(SslFilter.class) != null) {
throw new IllegalStateException("Only one SSL filter is permitted in a chain.");
}
IoSession session = chain.getSession();
// Create a SSL handler and start handshake.
SslHandler sslHandler = new SslHandler(this, session);
// Adding the supported ciphers in the SSLHandler
if (enabledCipherSuites == null || enabledCipherSuites.length == 0) {
enabledCipherSuites = sslContext.getServerSocketFactory().getSupportedCipherSuites();
}
sslHandler.init();
session.setAttribute(SSL_HANDLER, sslHandler);
}
示例4: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
if (parent.contains(CompressionFilter.class)) {
throw new IllegalStateException("Only one " + CompressionFilter.class + " is permitted.");
}
Zlib deflater = new Zlib(compressionLevel, Zlib.MODE_DEFLATER);
Zlib inflater = new Zlib(compressionLevel, Zlib.MODE_INFLATER);
IoSession session = parent.getSession();
session.setAttribute(DEFLATER, deflater);
session.setAttribute(INFLATER, inflater);
}
示例5: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
if (parent.contains(this)) {
throw new IllegalArgumentException(
"You can't add the same filter instance more than once. Create another instance and add it.");
}
IoSession session = parent.getSession();
session.setAttribute(RESPONSE_INSPECTOR, responseInspectorFactory.getResponseInspector());
session.setAttribute(REQUEST_STORE, createRequestStore(session));
session.setAttribute(UNRESPONDED_REQUEST_STORE, createUnrespondedRequestStore(session));
}
示例6: onPostRemove
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPostRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
IoSession session = parent.getSession();
destroyUnrespondedRequestStore(getUnrespondedRequestStore(session));
destroyRequestStore(getRequestStore(session));
session.removeAttribute(UNRESPONDED_REQUEST_STORE);
session.removeAttribute(REQUEST_STORE);
session.removeAttribute(RESPONSE_INSPECTOR);
}
示例7: onPreRemove
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPreRemove(IoFilterChain parent, String name, NextFilter nextFilter) throws SSLException {
IoSession session = parent.getSession();
stopSsl(session);
session.removeAttribute(NEXT_FILTER);
session.removeAttribute(SSL_HANDLER);
}
示例8: onPreRemove
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPreRemove(IoFilterChain chain, String name, NextFilter nextFilter) throws SSLException {
IoSession session = chain.getSession();
stopSsl(session);
session.removeAttribute(SSL_HANDLER);
}
示例9: onPreRemove
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* Called when the filter is removed from the filter chain.
* Cleans the {@link ProxyIoSession} instance from the session.
*
* @param chain the filter chain
* @param name the name assigned to this filter
* @param nextFilter the next filter
*/
@Override
public void onPreRemove(final IoFilterChain chain, final String name, final NextFilter nextFilter) {
IoSession session = chain.getSession();
session.removeAttribute(ProxyIoSession.PROXY_SESSION);
}