本文整理汇总了Java中org.apache.mina.core.filterchain.IoFilterChain.contains方法的典型用法代码示例。如果您正苦于以下问题:Java IoFilterChain.contains方法的具体用法?Java IoFilterChain.contains怎么用?Java IoFilterChain.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.mina.core.filterchain.IoFilterChain
的用法示例。
在下文中一共展示了IoFilterChain.contains方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void onPreAdd(IoFilterChain parent, String name, NextFilter nextFilter) throws Exception {
Class<? extends IoFilterAdapter> clazz = getClass();
if (parent.contains(clazz)) {
throw new IllegalStateException("Only one " + clazz.getName() + " is permitted.");
}
}
示例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(this)) {
throw new IllegalArgumentException("You can't add the same filter instance more than once. "
+ "Create another instance and add it.");
}
}
示例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: 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.");
}
}
示例7: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@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.");
}
}
示例8: addCompression
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
@Override
public void addCompression() {
IoFilterChain chain = ioSession.getFilterChain();
String baseFilter = EXECUTOR_FILTER_NAME;
if (chain.contains(TLS_FILTER_NAME)) {
baseFilter = TLS_FILTER_NAME;
}
chain.addAfter(baseFilter, COMPRESSION_FILTER_NAME, new CompressionFilter(true, false, CompressionFilter.COMPRESSION_MAX));
}
示例9: 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.");
}
parent.getSession().setAttribute(STATE, new State());
adjustReadBufferSize(parent.getSession());
}
示例10: onPreAdd
import org.apache.mina.core.filterchain.IoFilterChain; //导入方法依赖的package包/类
/**
* Called before the filter is added into the filter chain.
* Checks if chain already holds an {@link ProxyFilter} instance.
*
* @param chain the filter chain
* @param name the name assigned to this filter
* @param nextFilter the next filter
* @throws IllegalStateException if chain already contains an instance of
* {@link ProxyFilter}
*/
@Override
public void onPreAdd(final IoFilterChain chain, final String name, final NextFilter nextFilter) {
if (chain.contains(ProxyFilter.class)) {
throw new IllegalStateException("A filter chain cannot contain more than one ProxyFilter.");
}
}