1 package org.springframework.web.socket.sockjs.client; 2 3 import java.net.URI; 4 import java.security.Principal; 5 6 import org.springframework.http.HttpHeaders; 7 import org.springframework.web.socket.sockjs.frame.SockJsMessageCodec; 8 9 /** 10 * Represents a request to connect to a SockJS service using a specific 11 * Transport. A single SockJS request however may require falling back 12 * and therefore multiple TransportRequest instances. 13 * 14 * @author Rossen Stoyanchev 15 * @since 4.1 16 */ 17 public interface TransportRequest { 18 19 /** 20 * Return information about the SockJS URL including server and session id.. 21 */ 22 SockJsUrlInfo getSockJsUrlInfo(); 23 24 /** 25 * Return the headers to send with the connect request. 26 */ 27 HttpHeaders getHandshakeHeaders(); 28 29 /** 30 * Return the transport URL for the given transport. 31 * For an {@link XhrTransport} this is the URL for receiving messages. 32 */ 33 URI getTransportUrl(); 34 35 /** 36 * Return the user associated with the request, if any. 37 */ 38 Principal getUser(); 39 40 /** 41 * Return the message codec to use for encoding SockJS messages. 42 */ 43 SockJsMessageCodec getMessageCodec(); 44 45 /** 46 * Register a timeout cleanup task to invoke if the SockJS session is not 47 * fully established within the calculated retransmission timeout period. 48 */ 49 void addTimeoutTask(Runnable runnable); 50 51 }