spring StubSockJsServiceConfig 源码

  • 2022-08-08
  • 浏览 (566)

spring StubSockJsServiceConfig 代码

文件路径:/spring-websocket/src/test/java/org/springframework/web/socket/sockjs/transport/session/StubSockJsServiceConfig.java

/*
 * Copyright 2002-2013 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.web.socket.sockjs.transport.session;

import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.socket.sockjs.frame.Jackson2SockJsMessageCodec;
import org.springframework.web.socket.sockjs.frame.SockJsMessageCodec;
import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;

/**
 * @author Rossen Stoyanchev
 */
public class StubSockJsServiceConfig implements SockJsServiceConfig {

	private int streamBytesLimit = 128 * 1024;

	private long heartbeatTime = 25 * 1000;

	private TaskScheduler taskScheduler = new ThreadPoolTaskScheduler();

	private SockJsMessageCodec messageCodec = new Jackson2SockJsMessageCodec();

	private int httpMessageCacheSize = 100;


	@Override
	public int getStreamBytesLimit() {
		return this.streamBytesLimit;
	}

	public void setStreamBytesLimit(int streamBytesLimit) {
		this.streamBytesLimit = streamBytesLimit;
	}

	@Override
	public long getHeartbeatTime() {
		return this.heartbeatTime;
	}

	public void setHeartbeatTime(long heartbeatTime) {
		this.heartbeatTime = heartbeatTime;
	}

	@Override
	public TaskScheduler getTaskScheduler() {
		return this.taskScheduler;
	}

	public void setTaskScheduler(TaskScheduler taskScheduler) {
		this.taskScheduler = taskScheduler;
	}

	@Override
	public SockJsMessageCodec getMessageCodec() {
		return this.messageCodec;
	}

	public void setMessageCodec(SockJsMessageCodec messageCodec) {
		this.messageCodec = messageCodec;
	}

	@Override
	public int getHttpMessageCacheSize() {
		return this.httpMessageCacheSize;
	}

	public void setHttpMessageCacheSize(int httpMessageCacheSize) {
		this.httpMessageCacheSize = httpMessageCacheSize;
	}

}

相关信息

spring 源码目录

相关文章

spring AbstractSockJsSessionTests 源码

spring HttpSockJsSessionTests 源码

spring SockJsSessionTests 源码

spring TestHttpSockJsSession 源码

spring TestSockJsSession 源码

spring WebSocketServerSockJsSessionTests 源码

0  赞