flex.messaging.endpoints
Class BaseStreamingHTTPEndpoint

java.lang.Object
  extended by flex.management.ManageableComponent
      extended by flex.messaging.endpoints.AbstractEndpoint
          extended by flex.messaging.endpoints.BaseHTTPEndpoint
              extended by flex.messaging.endpoints.BaseStreamingHTTPEndpoint
All Implemented Interfaces:
Manageable, Endpoint, Endpoint2, FlexComponent, FlexConfigurable
Direct Known Subclasses:
StreamingAMFEndpoint, StreamingHTTPEndpoint

public abstract class BaseStreamingHTTPEndpoint
extends BaseHTTPEndpoint

Base for HTTP-based endpoints that support streaming HTTP connections to connected clients. Each streaming connection managed by this endpoint consumes one of the request handler threads provided by the servlet container, so it is not highly scalable but offers performance advantages over client polling for clients receiving a steady, rapid stream of pushed messages. This endpoint does not support polling clients and will fault any poll requests that are received. To support polling clients use subclasses of BaseHTTPEndpoint instead.


Field Summary
static String POLL_NOT_SUPPORTED_CODE
          Errors.
static int POLL_NOT_SUPPORTED_MESSAGE
           
 
Fields inherited from class flex.messaging.endpoints.AbstractEndpoint
LOG_CATEGORY
 
Constructor Summary
BaseStreamingHTTPEndpoint()
          Constructs an unmanaged BaseStreamingHTTPEndpoint.
BaseStreamingHTTPEndpoint(boolean enableManagement)
          Constructs an BaseStreamingHTTPEndpoint with the indicated management.
 
Method Summary
 int getIdleTimeoutMinutes()
          Returns the number of minutes a client can remain idle before the server times the connection out.
 int getMaxStreamingClients()
          Returns the maximum number of clients that will be allowed to establish a streaming HTTP connection with the endpoint.
 long getServerToClientHeartbeatMillis()
          Returns the number of milliseconds the server will wait before writing a single null byte to the streaming connection to make sure the client is still available.
 int getStreamingClientsCount()
          Returns the the number of clients that are currently in the streaming state.
 void initialize(String id, ConfigMap properties)
          Initializes the Endpoint with the properties.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handles HTTP requests targetting this endpoint.
 void setIdleTimeoutMinutes(int idleTimeoutMinutes)
          Sets the number of minutes a client can remain idle before the server times the connection out.
 void setMaxStreamingClients(int maxStreamingClients)
          Sets the maximum number of clients that will be allowed to establish a streaming HTTP connection with the server.
 void setServerToClientHeartbeatMillis(long serverToClientHeartbeatMillis)
          Returns the number of milliseconds the server will wait before writing a single null byte to the streaming connection to make sure the client is still available when there are no new messages for the client.
 void start()
          Starts the Endpoint by creating a filter chain and setting up serializers and deserializers.
 void stop()
          Stops the endpoint if it's running.
 
Methods inherited from class flex.messaging.endpoints.BaseHTTPEndpoint
getRedirectURL, isAddNoCacheHeaders, isInvalidateSessionOnDisconnect, setAddNoCacheHeaders, setInvalidateSessionOnDisconnect, setRedirectURL, setupFlexClient
 
Methods inherited from class flex.messaging.endpoints.AbstractEndpoint
describeEndpoint, getClientType, getFlexClientOutboundQueueProcessorClass, getFlexClientOutboundQueueProcessorConfig, getMessageBroker, getMessagingVersion, getPort, getSecurityConstraint, getSerializationContext, getServer, getTypeMarshaller, getUrl, isSecure, serviceMessage, setClientType, setFlexClientOutboundQueueProcessorClass, setFlexClientOutboundQueueProcessorConfig, setId, setMessageBroker, setSecurityConstraint, setSerializationContext, setServer, setTypeMarshaller, setupFlexClient, setUrl
 
Methods inherited from class flex.management.ManageableComponent
getControl, getId, getParent, isManaged, isStarted, isValid, setControl, setManaged, setParent
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface flex.messaging.endpoints.Endpoint
getId, isStarted
 
Methods inherited from interface flex.management.Manageable
getControl, isManaged, setControl, setManaged
 

Field Detail

POLL_NOT_SUPPORTED_CODE

public static final String POLL_NOT_SUPPORTED_CODE
Errors.

See Also:
Constant Field Values

POLL_NOT_SUPPORTED_MESSAGE

public static final int POLL_NOT_SUPPORTED_MESSAGE
See Also:
Constant Field Values
Constructor Detail

BaseStreamingHTTPEndpoint

public BaseStreamingHTTPEndpoint()
Constructs an unmanaged BaseStreamingHTTPEndpoint.


BaseStreamingHTTPEndpoint

public BaseStreamingHTTPEndpoint(boolean enableManagement)
Constructs an BaseStreamingHTTPEndpoint with the indicated management.

Parameters:
enableManagement - true if the BaseStreamingHTTPEndpoint is manageable; otherwise false.
Method Detail

initialize

public void initialize(String id,
                       ConfigMap properties)
Initializes the Endpoint with the properties. If subclasses override, they must call super.initialize().

Specified by:
initialize in interface Endpoint
Specified by:
initialize in interface FlexConfigurable
Overrides:
initialize in class BaseHTTPEndpoint
Parameters:
id - Id of the Endpoint.
properties - Properties for the Endpoint.

start

public void start()
Description copied from class: BaseHTTPEndpoint
Starts the Endpoint by creating a filter chain and setting up serializers and deserializers.

Specified by:
start in interface Endpoint
Specified by:
start in interface FlexComponent
Overrides:
start in class BaseHTTPEndpoint

stop

public void stop()
Description copied from class: AbstractEndpoint
Stops the endpoint if it's running. If subclasses override, they must call super.stop().

Specified by:
stop in interface Endpoint
Specified by:
stop in interface FlexComponent
Overrides:
stop in class AbstractEndpoint
See Also:
AbstractEndpoint.stop()

getServerToClientHeartbeatMillis

public long getServerToClientHeartbeatMillis()
Returns the number of milliseconds the server will wait before writing a single null byte to the streaming connection to make sure the client is still available.


setServerToClientHeartbeatMillis

public void setServerToClientHeartbeatMillis(long serverToClientHeartbeatMillis)
Returns the number of milliseconds the server will wait before writing a single null byte to the streaming connection to make sure the client is still available when there are no new messages for the client. A non-positive value means server will wait forever for new messages and it will not write the null byte to determine if the client is available.


getIdleTimeoutMinutes

public int getIdleTimeoutMinutes()
Returns the number of minutes a client can remain idle before the server times the connection out.

Returns:
The number of minutes a client can remain idle before the server times the connection out.

setIdleTimeoutMinutes

public void setIdleTimeoutMinutes(int idleTimeoutMinutes)
Sets the number of minutes a client can remain idle before the server times the connection out. A value of 0 or below indicates that connections will not be timed out.

Parameters:
idleTimeoutMinutes - The number of minutes a client can remain idle before the server times the connection out.

getMaxStreamingClients

public int getMaxStreamingClients()
Returns the maximum number of clients that will be allowed to establish a streaming HTTP connection with the endpoint.

Returns:
The maximum number of clients that will be allowed to establish a streaming HTTP connection with the endpoint.

setMaxStreamingClients

public void setMaxStreamingClients(int maxStreamingClients)
Sets the maximum number of clients that will be allowed to establish a streaming HTTP connection with the server.

Parameters:
maxStreamingClients - The maximum number of clients that will be allowed to establish a streaming HTTP connection with the server.

getStreamingClientsCount

public int getStreamingClientsCount()
Returns the the number of clients that are currently in the streaming state.

Returns:
The number of clients that are currently in the streaming state.

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
Handles HTTP requests targetting this endpoint. Two types or requests are supported. If the request is a regular request-response AMF/AMFX message it is handled by the base logic in BaseHTTPEndpoint.service. However, if it is a request to open a streaming HTTP connection to the client this endpoint performs some validation checks and then holds the connection open to stream data back to the client over.

Specified by:
service in interface Endpoint
Overrides:
service in class BaseHTTPEndpoint
Parameters:
req - The original servlet request
res - The active servlet response


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/endpoints/BaseStreamingHTTPEndpoint.html