Java Code Examples for org.apache.mina.core.filterchain.IoFilterChain#getSession()
The following examples show how to use
org.apache.mina.core.filterchain.IoFilterChain#getSession() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompressionFilter.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@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(); } }
Example 2
Source File: SslFilter.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * 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); }
Example 3
Source File: SslFilter.java From jane with GNU Lesser General Public License v3.0 | 6 votes |
/** * 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"); // Adding the supported ciphers in the SSLHandler if (enabledCipherSuites == null || enabledCipherSuites.length == 0) enabledCipherSuites = sslContext.getServerSocketFactory().getSupportedCipherSuites(); IoSession session = chain.getSession(); // Create a SSL handler and start handshake. SslHandler sslHandler = new SslHandler(this, session); sslHandler.init(); session.setAttribute(SSL_HANDLER, sslHandler); }
Example 4
Source File: CompressionFilter.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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); }
Example 5
Source File: RequestResponseFilter.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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)); }
Example 6
Source File: RequestResponseFilter.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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); }
Example 7
Source File: SslFilter.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@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); }
Example 8
Source File: SslFilter.java From jane with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onPreRemove(IoFilterChain chain, String name, NextFilter nextFilter) throws Exception { IoSession session = chain.getSession(); stopSsl(session, false); session.removeAttribute(SSL_HANDLER); }
Example 9
Source File: ProxyFilter.java From neoscada with Eclipse Public License 1.0 | 2 votes |
/** * 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); }