## org.red5.server.net.rtmpt
Class RTMPTServlet

    java.lang.Object
      javax.servlet.GenericServlet
          javax.servlet.http.HttpServlet
              org.red5.server.net.rtmpt.RTMPTServlet

All Implemented Interfaces:
  Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class RTMPTServlet

extends javax.servlet.http.HttpServlet

Servlet that handles all RTMPT requests.

Author:
  The Red5 Project (red5@osflash.org), Joachim Bauch (jojo@struktur.de)
See Also:
  Serialized Form

Field Summary
`protected WebApplicationContext` `appCtx` Web app context
`protected static Logger` `log` Logger

Constructor Summary
`RTMPTServlet()`

Method Summary
`protected RTMPTConnection` `createConnection()`
`void` `destroy()`
`protected RTMPTConnection` `getClientConnection(javax.servlet.http.HttpServletRequest req)` Get the RTMPT client for a session.
`protected Integer` `getClientId(javax.servlet.http.HttpServletRequest req)` Return the client id from a url like /send/123456/12 -> 123456
`protected RTMPTConnection` `getConnection(int clientId)`
`protected void` `handleBadRequest(String message, javax.servlet.http.HttpServletResponse resp)` Return an error message to the client.
`protected void` `handleClose(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Close a RTMPT session.
`protected void` `handleIdle(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Poll RTMPT session for updates.
`protected void` `handleOpen(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Start a new RTMPT session.
`protected void` `handleSend(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Add data for an established session.
`void` `init()`
`protected void` `notifyClosed(RTMPTConnection conn)` A connection has been closed that was created by this servlet.
`protected void` `removeConnection(int clientId)`
`protected void` `returnMessage(byte message, javax.servlet.http.HttpServletResponse resp)` Return a single byte to the client.
`protected void` `returnMessage(RTMPTConnection client, IoBuffer buffer, javax.servlet.http.HttpServletResponse resp)` Return raw data to the client.
`protected void` `returnMessage(String message, javax.servlet.http.HttpServletResponse resp)` Return a message to the client.
`protected void` `returnPendingMessages(RTMPTConnection client, javax.servlet.http.HttpServletResponse resp)` Send pending messages to client.
`protected void` `service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Main entry point for the servlet.
`void` `setHandler(RTMPTHandler handler)` Set the RTMPTHandler to use in this servlet.
`void` `setRtmpConnManager(IRTMPConnManager rtmpConnManager)`
`protected void` `skipData(javax.servlet.http.HttpServletRequest req)` Skip data sent by the client.

Methods inherited from class javax.servlet.http.HttpServlet
`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

Methods inherited from class javax.servlet.GenericServlet
`getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected static Logger log

  Logger

### appCtx

    protected transient WebApplicationContext appCtx

  Web app context

Constructor Detail

### RTMPTServlet

    public RTMPTServlet()

Method Detail

### setRtmpConnManager

    public void setRtmpConnManager(IRTMPConnManager rtmpConnManager)

### setHandler

    public void setHandler(RTMPTHandler handler)

  Set the RTMPTHandler to use in this servlet.

  Parameters:
    `handler` - handler

### handleBadRequest

    protected void handleBadRequest(String message,
                                    javax.servlet.http.HttpServletResponse resp)
                             throws IOException

  Return an error message to the client.

  Parameters:
    `message` - Message
    `resp` - Servlet response
  Throws:
    `IOException` - I/O exception

### returnMessage

    protected void returnMessage(byte message,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws IOException

  Return a single byte to the client.

  Parameters:
    `message` - Message
    `resp` - Servlet response
  Throws:
    `IOException` - I/O exception

### returnMessage

    protected void returnMessage(String message,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws IOException

  Return a message to the client.

  Parameters:
    `message` - Message
    `resp` - Servlet response
  Throws:
    `IOException` - I/O exception

### returnMessage

    protected void returnMessage(RTMPTConnection client,
                                 IoBuffer buffer,
                                 javax.servlet.http.HttpServletResponse resp)
                          throws IOException

  Return raw data to the client.

  Parameters:
    `client` - RTMP connection
    `buffer` - Raw data as byte buffer
    `resp` - Servlet response
  Throws:
    `IOException` - I/O exception

### getClientId

    protected Integer getClientId(javax.servlet.http.HttpServletRequest req)

  Return the client id from a url like /send/123456/12 -> 123456

  Parameters:
    `req` - Servlet request
  Returns:
    Client id

### getClientConnection

    protected RTMPTConnection getClientConnection(javax.servlet.http.HttpServletRequest req)

  Get the RTMPT client for a session.

  Parameters:
    `req` - Servlet request
  Returns:
    RTMP client connection

### skipData

    protected void skipData(javax.servlet.http.HttpServletRequest req)
                     throws IOException

  Skip data sent by the client.

  Parameters:
    `req` - Servlet request
  Throws:
    `IOException` - I/O exception

### returnPendingMessages

    protected void returnPendingMessages(RTMPTConnection client,
                                         javax.servlet.http.HttpServletResponse resp)
                                  throws IOException

  Send pending messages to client.

  Parameters:
    `client` - RTMP connection
    `resp` - Servlet response
  Throws:
    `IOException` - I/O exception

### handleOpen

    protected void handleOpen(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException

  Start a new RTMPT session.

  Parameters:
    `req` - Servlet request
    `resp` - Servlet response
  Throws:
    `javax.servlet.ServletException` - Servlet exception
    `IOException` - I/O exception

### handleClose

    protected void handleClose(javax.servlet.http.HttpServletRequest req,
                               javax.servlet.http.HttpServletResponse resp)
                        throws javax.servlet.ServletException,
                               IOException

  Close a RTMPT session.

  Parameters:
    `req` - Servlet request
    `resp` - Servlet response
  Throws:
    `javax.servlet.ServletException` - Servlet exception
    `IOException` - I/O exception

### handleSend

    protected void handleSend(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException

  Add data for an established session.

  Parameters:
    `req` - Servlet request
    `resp` - Servlet response
  Throws:
    `javax.servlet.ServletException` - Servlet exception
    `IOException` - I/O exception

### handleIdle

    protected void handleIdle(javax.servlet.http.HttpServletRequest req,
                              javax.servlet.http.HttpServletResponse resp)
                       throws javax.servlet.ServletException,
                              IOException

  Poll RTMPT session for updates.

  Parameters:
    `req` - Servlet request
    `resp` - Servlet response
  Throws:
    `javax.servlet.ServletException` - Servlet exception
    `IOException` - I/O exception

### service

    protected void service(javax.servlet.http.HttpServletRequest req,
                           javax.servlet.http.HttpServletResponse resp)
                    throws javax.servlet.ServletException,
                           IOException

  Main entry point for the servlet.

  Overrides:
    `service` in class `javax.servlet.http.HttpServlet`
  Parameters:
    `req` - Request object
    `resp` - Response object
  Throws:
    `javax.servlet.ServletException`
    `IOException`

### init

    public void init()
              throws javax.servlet.ServletException

  Overrides:
    `init` in class `javax.servlet.GenericServlet`
  Throws:
    `javax.servlet.ServletException`

### destroy

    public void destroy()

  Specified by:
    `destroy` in interface `javax.servlet.Servlet`
  Overrides:
    `destroy` in class `javax.servlet.GenericServlet`

### notifyClosed

    protected void notifyClosed(RTMPTConnection conn)

  A connection has been closed that was created by this servlet.

  Parameters:
    `conn` -

### getConnection

    protected RTMPTConnection getConnection(int clientId)

### createConnection

    protected RTMPTConnection createConnection()

### removeConnection

    protected void removeConnection(int clientId)

Copyright © 2006-2010 The Red5 Project