当前位置: 首页>>代码示例>>Java>>正文


Java TextLineCodecFactory.setDecoderMaxLineLength方法代码示例

本文整理汇总了Java中org.apache.mina.filter.codec.textline.TextLineCodecFactory.setDecoderMaxLineLength方法的典型用法代码示例。如果您正苦于以下问题:Java TextLineCodecFactory.setDecoderMaxLineLength方法的具体用法?Java TextLineCodecFactory.setDecoderMaxLineLength怎么用?Java TextLineCodecFactory.setDecoderMaxLineLength使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.mina.filter.codec.textline.TextLineCodecFactory的用法示例。


在下文中一共展示了TextLineCodecFactory.setDecoderMaxLineLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: MinaCubeClient

import org.apache.mina.filter.codec.textline.TextLineCodecFactory; //导入方法依赖的package包/类
public MinaCubeClient(String hostname, int port) {
    this.hostname = hostname;
    this.port = port;
    connector = new NioSocketConnector(1);
    connector.setConnectTimeoutMillis(2000);

    connector.getFilterChain().addLast("logger", new LoggingFilter());
    TextLineCodecFactory codecFactory = new TextLineCodecFactory(UTF_8, LineDelimiter.CRLF, LineDelimiter.AUTO);
    codecFactory.setDecoderMaxLineLength(4096);
    codecFactory.setEncoderMaxLineLength(4096);
    connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(codecFactory));

    handler = new ConnectHandler();
    connector.setHandler(handler);
}
 
开发者ID:spinscale,项目名称:maxcube-java,代码行数:16,代码来源:MinaCubeClient.java

示例2: emit

import org.apache.mina.filter.codec.textline.TextLineCodecFactory; //导入方法依赖的package包/类
@Override
public void emit() {
	// TODO Auto-generated method stub
	try {
		// ssl 认证
		if (sslEnable) {
			SslFilter sslFilter = new SslFilter(getSslContext());
			acceptor.getFilterChain().addLast("sslFilter", sslFilter);
			logger.warn("ssl authenticate is open");
		}
		LoggingFilter loggingFilter = new LoggingFilter();
		acceptor.getFilterChain().addLast("logger", loggingFilter);
		TextLineCodecFactory textLineCodecFactory = new TextLineCodecFactory(
				Charset.forName(encodiing));
		textLineCodecFactory.setDecoderMaxLineLength(maxLineLength);
		textLineCodecFactory.setEncoderMaxLineLength(maxLineLength);
		acceptor.getFilterChain().addLast("codec",
				new ProtocolCodecFilter(textLineCodecFactory));
		acceptor.setHandler(minaBizHandler);
		acceptor.getSessionConfig().setReadBufferSize(bufSize);
		acceptor.getSessionConfig().setWriteTimeout(10);
		// acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE,
		// 10);//空闲状态
		acceptor.bind(new InetSocketAddress(InetAddress.getByName(host),
				port));
	} catch (Exception e) {
		// TODO Auto-generated catch block
		logger.error(e.getMessage());
		System.exit(1);
	}
}
 
开发者ID:DTStack,项目名称:jlogstash-input-plugin,代码行数:32,代码来源:Tcp.java

示例3: getTextLineCodecFactory

import org.apache.mina.filter.codec.textline.TextLineCodecFactory; //导入方法依赖的package包/类
@NonNull
static TextLineCodecFactory getTextLineCodecFactory() {
    TextLineCodecFactory codec = new TextLineCodecFactory();
    codec.setDecoderMaxLineLength(MAX_LINE_LENGTH);
    codec.setEncoderMaxLineLength(MAX_LINE_LENGTH);
    return codec;
}
 
开发者ID:EthanCo,项目名称:Halo-Turbo,代码行数:8,代码来源:MinaUtil.java

示例4: startListening

import org.apache.mina.filter.codec.textline.TextLineCodecFactory; //导入方法依赖的package包/类
protected void startListening(boolean activateSSL)
{
	try
	{
		this.acceptor = new NioSocketAcceptor();
        ((NioSocketAcceptor)this.acceptor).setReuseAddress(true);
       
        if(activateSSL)
        {
        	//Makes the tcp connection protected with SSL
        	SslFilter sslFilter = new SslFilter(this.getSSLContext());	        
        	this.acceptor.getFilterChain().addLast("ssl", sslFilter);
        }
        
        //
        //TextLineCodecFactory textLine = new TextLineCodecFactory(Charset.forName("UTF-8"));	
        TextLineCodecFactory textLine = new TextLineCodecFactory(Charset.forName("UTF-8"),
    	        LineDelimiter.UNIX.getValue(),
    	        "EOF");
        textLine.setDecoderMaxLineLength(Integer.MAX_VALUE);
        textLine.setEncoderMaxLineLength(Integer.MAX_VALUE);
        ProtocolCodecFilter codecFilter = new ProtocolCodecFilter(textLine);
        this.acceptor.getFilterChain().addLast( "codec", codecFilter);
        
        //
        this.acceptor.getFilterChain().addLast("threadPool", new ExecutorFilter());
        
      //Add Custom filters here
        if(this.payloadFilter != null)
        {
        	this.acceptor.getFilterChain().addLast("payloadFilter", this.payloadFilter);
        }
        
        if(this.requestFilter != null)
        {
        	this.acceptor.getFilterChain().addLast("requestFilter", this.requestFilter);
        }
        
        if(this.transactionFilter != null)
        {
        	this.acceptor.getFilterChain().addLast("transactionFilter", this.transactionFilter);	   
        }
        
        if(this.authenticationFilter != null)
        {
        	this.acceptor.getFilterChain().addLast("authenticationFilter", this.authenticationFilter);
        }
        
        //session specific configuration
        this.acceptor.getSessionConfig().setBothIdleTime(10);
        
        this.acceptor.setHandler(this.handler);
        this.acceptor.bind(new InetSocketAddress(this.port));
        
        log.info("--------------------------------------------");
        log.info("Mobile Data Server successfully loaded on port ("+this.port+").....");
        log.info("--------------------------------------------");
	}
	catch(Exception e)
	{
		log.error(this, e);
		this.stop();
		throw new RuntimeException(e);
	}
}
 
开发者ID:ZalemSoftware,项目名称:OpenMobster,代码行数:66,代码来源:Server.java


注:本文中的org.apache.mina.filter.codec.textline.TextLineCodecFactory.setDecoderMaxLineLength方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。