View Javadoc
1   /*
2    * Copyright 2002-2013 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.web.socket.sockjs.transport.session;
18  
19  import org.springframework.scheduling.TaskScheduler;
20  import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
21  import org.springframework.web.socket.sockjs.frame.Jackson2SockJsMessageCodec;
22  import org.springframework.web.socket.sockjs.frame.SockJsMessageCodec;
23  import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
24  
25  /**
26   * @author Rossen Stoyanchev
27   */
28  public class StubSockJsServiceConfig implements SockJsServiceConfig {
29  
30  	private int streamBytesLimit = 128 * 1024;
31  
32  	private long heartbeatTime = 25 * 1000;
33  
34  	private TaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
35  
36  	private SockJsMessageCodec messageCodec = new Jackson2SockJsMessageCodec();
37  
38  	private int httpMessageCacheSize = 100;
39  
40  
41  	@Override
42  	public int getStreamBytesLimit() {
43  		return this.streamBytesLimit;
44  	}
45  
46  	public void setStreamBytesLimit(int streamBytesLimit) {
47  		this.streamBytesLimit = streamBytesLimit;
48  	}
49  
50  	@Override
51  	public long getHeartbeatTime() {
52  		return this.heartbeatTime;
53  	}
54  
55  	public void setHeartbeatTime(long heartbeatTime) {
56  		this.heartbeatTime = heartbeatTime;
57  	}
58  
59  	@Override
60  	public TaskScheduler getTaskScheduler() {
61  		return this.taskScheduler;
62  	}
63  
64  	public void setTaskScheduler(TaskScheduler taskScheduler) {
65  		this.taskScheduler = taskScheduler;
66  	}
67  
68  	@Override
69  	public SockJsMessageCodec getMessageCodec() {
70  		return this.messageCodec;
71  	}
72  
73  	public void setMessageCodec(SockJsMessageCodec messageCodec) {
74  		this.messageCodec = messageCodec;
75  	}
76  
77  	public int getHttpMessageCacheSize() {
78  		return this.httpMessageCacheSize;
79  	}
80  
81  	public void setHttpMessageCacheSize(int httpMessageCacheSize) {
82  		this.httpMessageCacheSize = httpMessageCacheSize;
83  	}
84  
85  }