Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package io.undertow.websockets.spi;
  
  import org.xnio.IoFuture;
  import org.xnio.Pool;
  
  import java.io.Closeable;
 import java.util.List;
 import java.util.Map;


An abstraction for a Http exchange. Undertow uses 3 different types of exchanges:

- async - blocking - servlet

This class provides a way to operate on the underling exchange while providing the correct semantics regardless of the underlying exchange type.

The main use case for this is web sockets. Web sockets should be able to perform a handshake regardless of the nature of the underlying request, while still respecting servlet filters, security etc.

Author(s):
Stuart Douglas
 
 public interface WebSocketHttpExchange extends Closeable {
 
     <T> void putAttachment(final AttachmentKey<T> key, T value);
 
     <T> T getAttachment(final AttachmentKey<T> key);

    
gets the first request header with the specified name

Parameters:
headerName The header name
Returns:
The header value, or null
 
     String getRequestHeader(final String headerName);

    

Returns:
An unmodifiable map of request headers
 
     Map<StringList<String>> getRequestHeaders();

    
get a response header

Parameters:
headerName The header name
Returns:
The header value, or null
 
     String getResponseHeader(final String headerName);

    

Returns:
An unmodifiable map of response headers
 
     Map<StringList<String>> getResponseHeaders();


    
Sets the response headers
 
     void setResponseHeaders(final Map<StringList<String>> headers);

    
Set a response header

Parameters:
headerName The header name
headerValue The header value
 
     void setResponseHeader(final String headerNamefinal String headerValue);

    
Upgrade the underlying channel

Parameters:
upgradeCallback
 
     void upgradeChannel(final HttpUpgradeListener upgradeCallback);

    
Send some data

Parameters:
data The data
 
     IoFuture<VoidsendData(final ByteBuffer data);

    
Gets the body of the request.
 
     IoFuture<byte[]> readRequestData();

    
End the exchange normally. If this is a blocking exchange this may be a noop, and the exchange will actually end when the call stack returns
 
    void endExchange();

    
Forcibly close the exchange.
    void close();

    
Get the request scheme, usually http or https

Returns:
The request scheme
    String getRequestScheme();

    

Returns:
The request URI, including the query string
    String getRequestURI();

    

Returns:
The buffer pool
    Pool<ByteBuffergetBufferPool();

    

Returns:
The query string
    String getQueryString();

    
Gets the session, if any

Returns:
The session object, or null
    Object getSession();
    boolean isUserInRole(String role);
New to GrepCode? Check out our FAQ X