Package org.apache.mina.filter

Examples of org.apache.mina.filter.LoggingFilter


  }

  public synchronized void run() throws IOException {
    if (acceptor == null && localPort != 0) {
      SocketAcceptorConfig cfg = new SocketAcceptorConfig();
      cfg.getFilterChain().addLast("logger", new LoggingFilter());
      cfg.getFilterChain().addLast(
          "serialization",
          new ProtocolCodecFilter(
              new ObjectSerializationCodecFactory()));
      acceptor = new SocketAcceptor(2, Executors.newCachedThreadPool());
View Full Code Here


  private void initConnector() {
    connector = new SocketConnector();
    connectorConfig = new SocketConnectorConfig();
    // connectorConfig.setThreadModel(ThreadModel.MANUAL);
    connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
    connectorConfig.getFilterChain().addLast("serialization",
        new ProtocolCodecFilter(new ObjectSerializationCodecFactory()));
  }
View Full Code Here

        IoConnector connector = new VmPipeConnector();

        // connector config
        configureCodecFactory("MinaProducer", connector.getDefaultConfig(), configuration);
        if (minaLogger) {
            connector.getFilterChain().addLast("logger", new LoggingFilter());
        }

        // acceptor connectorConfig
        configureCodecFactory("MinaConsumer", acceptor.getDefaultConfig(), configuration);
        if (minaLogger) {
            acceptor.getFilterChain().addLast("logger", new LoggingFilter());
        }

        MinaEndpoint endpoint = new MinaEndpoint(uri, this);
        endpoint.setAddress(address);
        endpoint.setAcceptor(acceptor);
View Full Code Here

        // must use manual thread model according to Mina documentation
        connectorConfig.setThreadModel(ThreadModel.MANUAL);
        configureCodecFactory("MinaProducer", connectorConfig, configuration);
        connectorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
        if (minaLogger) {
            connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        // set connect timeout to mina in seconds
        connectorConfig.setConnectTimeout((int) (timeout / 1000));

        // acceptor connectorConfig
        SocketAcceptorConfig acceptorConfig = new SocketAcceptorConfig();
        // must use manual thread model according to Mina documentation
        acceptorConfig.setThreadModel(ThreadModel.MANUAL);
        configureCodecFactory("MinaConsumer", acceptorConfig, configuration);
        acceptorConfig.setReuseAddress(true);
        acceptorConfig.setDisconnectOnUnbind(true);
        acceptorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
        if (minaLogger) {
            acceptorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }

        MinaEndpoint endpoint = new MinaEndpoint(uri, this);
        endpoint.setAddress(address);
        endpoint.setAcceptor(acceptor);
View Full Code Here

        DatagramConnectorConfig connectorConfig = new DatagramConnectorConfig();
        configureDataGramCodecFactory("MinaProducer", connectorConfig, configuration);
        connectorConfig.getFilterChain().addLast("threadPool", new ExecutorFilter(Executors.newCachedThreadPool()));
        if (minaLogger) {
            connectorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }
        // set connect timeout to mina in seconds
        connectorConfig.setConnectTimeout((int) (timeout / 1000));

        DatagramAcceptorConfig acceptorConfig = new DatagramAcceptorConfig();
        configureDataGramCodecFactory("MinaConsumer", acceptorConfig, configuration);
        acceptorConfig.setDisconnectOnUnbind(true);
        // reuse address is default true for datagram
        if (minaLogger) {
            acceptorConfig.getFilterChain().addLast("logger", new LoggingFilter());
        }

        MinaEndpoint endpoint = new MinaEndpoint(uri, this);
        endpoint.setAddress(address);
        endpoint.setAcceptor(acceptor);
View Full Code Here

    /**
     * @see archean.util.mina.IoSessionManagerMBean#addLastLoggingFilter()
     */
    public void addLastLoggingFilter() {
        LoggingFilter f = new LoggingFilter();
        session.getFilterChain().addLast("LoggerLast", f);
    }
View Full Code Here

    /**
     * @see archean.util.mina.IoSessionManagerMBean#addFirstLoggingFilter()
     */
    public void addFirstLoggingFilter() {
        LoggingFilter f = new LoggingFilter();
        session.getFilterChain().addFirst("LoggerFirst", f);
    }
View Full Code Here

        }

        session.getFilterChain().addLast(
                "protocolFilter", new ProtocolCodecFilter( codec ) );
        session.getFilterChain().addLast(
                "logger", new LoggingFilter() );
    }
View Full Code Here

        if( !socketBound || !datagramBound )
        {
            throw new IOException( "Cannot bind any test port." );
        }

        registry.getAcceptor( TransportType.SOCKET ).getFilterChain().addLast( "logger", new LoggingFilter() );
        registry.getAcceptor( TransportType.DATAGRAM ).getFilterChain().addLast( "logger", new LoggingFilter() );

        System.out.println( "Using port " + port + " for testing." );
    }
View Full Code Here

       
        // Send closeNotify to test TLS closure if it is TLS connection.
        SSLFilter sslf = ( SSLFilter ) connector.getFilterChain().get( "SSL" );
        if( sslf != null )
        {
            connector.getFilterChain().addFirst( "log", new LoggingFilter() );
            sslf.stopSSL( session ).join();
           
            System.out.println( "-------------------------------------------------------------------------------" );
            // Test again after we finished TLS session.
            testConnector0( session );
View Full Code Here

TOP

Related Classes of org.apache.mina.filter.LoggingFilter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.