Minor internal refinements (backported from master)

This commit is contained in:
Juergen Hoeller
2019-11-13 18:11:44 +01:00
parent 9cad93093a
commit e1f950764e
8 changed files with 49 additions and 47 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -26,11 +26,10 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat;
import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
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 +49,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
@Override
public boolean checkSessionType(SockJsSession session) {
return session instanceof EventSourceStreamingSockJsSession;
return (session instanceof EventSourceStreamingSockJsSession);
}
@Override
@@ -66,7 +65,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 +75,7 @@ public class EventSourceTransportHandler extends AbstractHttpSendingTransportHan
@Override
protected byte[] getPrelude(ServerHttpRequest request) {
return new byte[] { '\r', '\n' };
return new byte[] {'\r', '\n'};
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -35,14 +35,15 @@ import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
import org.springframework.web.util.JavaScriptUtils;
/**
* An HTTP {@link TransportHandler} that uses a famous browser document.domain technique:
* <a href="https://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do">
* https://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do</a>
* An HTTP {@link TransportHandler} that uses a famous browser
* {@code document.domain technique}. See <a href=
* "https://stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do">
* stackoverflow.com/questions/1481251/what-does-document-domain-document-domain-do</a>
* for details.
*
* @author Rossen Stoyanchev
* @since 4.0
@@ -91,7 +92,7 @@ public class HtmlFileTransportHandler extends AbstractHttpSendingTransportHandle
@Override
public boolean checkSessionType(SockJsSession session) {
return session instanceof HtmlFileStreamingSockJsSession;
return (session instanceof HtmlFileStreamingSockJsSession);
}
@Override

View File

@@ -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.
@@ -106,7 +106,7 @@ public class WebSocketTransportHandler extends AbstractTransportHandler
@Override
public boolean checkSessionType(SockJsSession session) {
return session instanceof WebSocketServerSockJsSession;
return (session instanceof WebSocketServerSockJsSession);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -26,7 +26,6 @@ import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
/**
@@ -54,7 +53,7 @@ public class XhrPollingTransportHandler extends AbstractHttpSendingTransportHand
@Override
public boolean checkSessionType(SockJsSession session) {
return session instanceof PollingSockJsSession;
return (session instanceof PollingSockJsSession);
}
@Override

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 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.
@@ -27,7 +27,6 @@ import org.springframework.web.socket.sockjs.transport.SockJsServiceConfig;
import org.springframework.web.socket.sockjs.transport.SockJsSession;
import org.springframework.web.socket.sockjs.transport.TransportHandler;
import org.springframework.web.socket.sockjs.transport.TransportType;
import org.springframework.web.socket.sockjs.transport.session.PollingSockJsSession;
import org.springframework.web.socket.sockjs.transport.session.StreamingSockJsSession;
/**
@@ -60,7 +59,7 @@ public class XhrStreamingTransportHandler extends AbstractHttpSendingTransportHa
@Override
public boolean checkSessionType(SockJsSession session) {
return session instanceof XhrStreamingSockJsSession;
return (session instanceof XhrStreamingSockJsSession);
}
@Override