Polish WebSocketSession

Update methods available on WebSocketSession interface.
Introduce DelegatingWebSocketSession interface.
This commit is contained in:
Rossen Stoyanchev
2013-08-09 09:38:13 -04:00
parent 14ac023e01
commit 01feae0ad5
36 changed files with 735 additions and 590 deletions

View File

@@ -16,6 +16,7 @@
package org.springframework.http.server;
import java.net.InetSocketAddress;
import java.security.Principal;
import java.util.Map;
@@ -51,14 +52,14 @@ public interface ServerHttpRequest extends HttpRequest, HttpInputMessage {
Principal getPrincipal();
/**
* Return the host name of the endpoint on the other end.
* Return the address on which the request was received.
*/
String getRemoteHostName();
InetSocketAddress getLocalAddress();
/**
* Return the IP address of the endpoint on the other end.
* Return the address of the remote client.
*/
String getRemoteAddress();
InetSocketAddress getRemoteAddress();
/**
* Return a control that allows putting the request in asynchronous mode so the

View File

@@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.InetSocketAddress;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
@@ -147,13 +148,13 @@ public class ServletServerHttpRequest implements ServerHttpRequest {
}
@Override
public String getRemoteHostName() {
return this.servletRequest.getRemoteHost();
public InetSocketAddress getLocalAddress() {
return new InetSocketAddress(this.servletRequest.getLocalName(), this.servletRequest.getLocalPort());
}
@Override
public String getRemoteAddress() {
return this.servletRequest.getRemoteAddr();
public InetSocketAddress getRemoteAddress() {
return new InetSocketAddress(this.servletRequest.getRemoteHost(), this.servletRequest.getRemotePort());
}
@Override