Minor internal refinements (backported from master)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -30,7 +30,7 @@ import org.springframework.web.socket.sockjs.transport.TransportType;
|
||||
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
|
||||
|
||||
/**
|
||||
* A TransportHandler for sending messages via Server-Sent events:
|
||||
* A TransportHandler for sending messages via Server-Sent Events:
|
||||
* <a href="https://dev.w3.org/html5/eventsource/">https://dev.w3.org/html5/eventsource/</a>.
|
||||
*
|
||||
* @author Rossen Stoyanchev
|
||||
@@ -50,7 +50,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof EventSourceStreamingSockJsSession;
|
||||
return (session instanceof EventSourceStreamingSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
|
||||
}
|
||||
|
||||
|
||||
private class EventSourceStreamingSockJsSession extends StreamingSockJsSession {
|
||||
private static class EventSourceStreamingSockJsSession extends StreamingSockJsSession {
|
||||
|
||||
public EventSourceStreamingSockJsSession(String sessionId, SockJsServiceConfig config,
|
||||
WebSocketHandler wsHandler, Map<String, Object> attributes) {
|
||||
@@ -76,7 +76,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
|
||||
|
||||
@Override
|
||||
protected byte[] getPrelude(ServerHttpRequest request) {
|
||||
return new byte[] { '\r', '\n' };
|
||||
return new byte[] {'\r', '\n'};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -93,7 +93,7 @@ public class HtmlFileTransportHandler extends AbstractHttpSendingTransportHandle
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof HtmlFileStreamingSockJsSession;
|
||||
return (session instanceof HtmlFileStreamingSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -107,7 +107,7 @@ public class WebSocketTransportHandler extends AbstractTransportHandler
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof WebSocketServerSockJsSession;
|
||||
return (session instanceof WebSocketServerSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -54,7 +54,7 @@ public class XhrPollingTransportHandler extends AbstractHttpSendingTransportHand
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof PollingSockJsSession;
|
||||
return (session instanceof PollingSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 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.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.web.socket.sockjs.transport.handler;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -41,9 +42,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
|
||||
private static final byte[] PRELUDE = new byte[2049];
|
||||
|
||||
static {
|
||||
for (int i = 0; i < 2048; i++) {
|
||||
PRELUDE[i] = 'h';
|
||||
}
|
||||
Arrays.fill(PRELUDE, (byte) 'h');
|
||||
PRELUDE[2048] = '\n';
|
||||
}
|
||||
|
||||
@@ -60,7 +59,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
|
||||
|
||||
@Override
|
||||
public boolean checkSessionType(SockJsSession session) {
|
||||
return session instanceof XhrStreamingSockJsSession;
|
||||
return (session instanceof XhrStreamingSockJsSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user