com.sun.grizzly.http.portunif
Class HttpProtocolHandler

java.lang.Object
  extended by com.sun.grizzly.http.portunif.HttpProtocolHandler
All Implemented Interfaces:
ProtocolHandler

public class HttpProtocolHandler
extends Object
implements ProtocolHandler

Redirect the request to the proper protocol, which can be http or https.

Author:
Jeanfrancois Arcand, Alexey Stashok

Nested Class Summary
static class HttpProtocolHandler.Mode
           
 
Field Summary
protected  String[][] protocols
          The protocols supported by this handler.
 
Constructor Summary
HttpProtocolHandler()
           
HttpProtocolHandler(HttpProtocolHandler.Mode mode)
           
 
Method Summary
 boolean expireKey(SelectionKey key)
          Invoked when the SelectorThread is about to expire a SelectionKey.
 ByteBuffer getByteBuffer()
          Returns ByteBuffer, where PUReadFilter will read data
 String[] getProtocols()
          Returns an array of supported protocols.
 boolean handle(Context context, PUProtocolRequest protocolRequest)
          Redirect the request to the protocol defined in the protocolInfo.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

protocols

protected String[][] protocols
The protocols supported by this handler.

Constructor Detail

HttpProtocolHandler

public HttpProtocolHandler()

HttpProtocolHandler

public HttpProtocolHandler(HttpProtocolHandler.Mode mode)
Method Detail

handle

public boolean handle(Context context,
                      PUProtocolRequest protocolRequest)
               throws IOException
Redirect the request to the protocol defined in the protocolInfo. Protocols supported are http and https.

Specified by:
handle in interface ProtocolHandler
Parameters:
protocolInfo - The protocol that needs to be redirected.
Returns:
true, if connection should be kept alive, false - otherwise
Throws:
IOException

getProtocols

public String[] getProtocols()
Returns an array of supported protocols.

Specified by:
getProtocols in interface ProtocolHandler
Returns:
an array of supported protocols.

expireKey

public boolean expireKey(SelectionKey key)
Invoked when the SelectorThread is about to expire a SelectionKey.

Specified by:
expireKey in interface ProtocolHandler
Returns:
true if the SelectorThread should expire the SelectionKey, false if not.

getByteBuffer

public ByteBuffer getByteBuffer()
Description copied from interface: ProtocolHandler
Returns ByteBuffer, where PUReadFilter will read data

Specified by:
getByteBuffer in interface ProtocolHandler
Returns:
ByteBuffer


Copyright © 2011 SUN Microsystems. All Rights Reserved.