org.red5.server.net.servlet

## Class AMFGatewayServlet

- java.lang.Object
- - javax.servlet.GenericServlet
  - - javax.servlet.http.HttpServlet
    - - org.red5.server.net.servlet.AMFGatewayServlet

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

    public class AMFGatewayServlet
    extends javax.servlet.http.HttpServlet

Servlet that handles remoting requests.

Author:
  The Red5 Project (red5@osflash.org), Luke Hubbard (luke@codegent.com), Paul Gregoire (mondain@gmail.com)
See Also:
  Serialized Form

### Field Summary

Fields
`static String` `APPLICATION_AMF` AMF MIME type
`protected RemotingCodecFactory` `codecFactory` Remoting codec factory
`protected org.slf4j.Logger` `log` Logger
`protected IServer` `server` Red5 server instance
`protected org.springframework.web.context.WebApplicationContext` `webAppCtx` Web app context

### Constructor Summary

Constructors
Constructor and Description
`AMFGatewayServlet()`

### Method Summary

Methods
`protected RemotingPacket` `decodeRequest(javax.servlet.http.HttpServletRequest req)` Decode request
`protected IGlobalScope` `getGlobalScope(javax.servlet.http.HttpServletRequest req)` Return the global scope to use for the given request.
`protected boolean` `handleRemotingPacket(javax.servlet.http.HttpServletRequest req, IContext context, IScope scope, RemotingPacket message)` Handles AMF request by making calls
`void` `init()`
`protected void` `sendResponse(javax.servlet.http.HttpServletResponse resp, RemotingPacket packet)` Sends response to client
`void` `service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)`
`protected void` `serviceAMF(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp)` Works out AMF request

### Methods inherited from class javax.servlet.http.HttpServlet

`doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service`

### Methods inherited from class javax.servlet.GenericServlet

`destroy, 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 org.slf4j.Logger log

Logger

#### APPLICATION_AMF

    public static final String APPLICATION_AMF

AMF MIME type

See Also:
  Constant Field Values

#### webAppCtx

    protected transient org.springframework.web.context.WebApplicationContext webAppCtx

Web app context

#### server

    protected transient IServer server

Red5 server instance

#### codecFactory

    protected transient RemotingCodecFactory codecFactory

Remoting codec factory

### Constructor Detail

#### AMFGatewayServlet

    public AMFGatewayServlet()

### Method Detail

#### init

    public void init()
              throws javax.servlet.ServletException

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

#### service

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

Overrides:
  `service` in class `javax.servlet.http.HttpServlet`
Throws:
  `javax.servlet.ServletException`
  `IOException`

#### getGlobalScope

    protected IGlobalScope getGlobalScope(javax.servlet.http.HttpServletRequest req)

Return the global scope to use for the given request.

Parameters:
  `req` -
Returns:
  scope

#### serviceAMF

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

Works out AMF request

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

#### decodeRequest

    protected RemotingPacket decodeRequest(javax.servlet.http.HttpServletRequest req)
                                    throws Exception

Decode request

Parameters:
  `req` - Request
Returns:
  Remoting packet
Throws:
  `Exception` - General exception

#### handleRemotingPacket

    protected boolean handleRemotingPacket(javax.servlet.http.HttpServletRequest req,
                               IContext context,
                               IScope scope,
                               RemotingPacket message)

Handles AMF request by making calls

Parameters:
  `req` - Request
  `message` - Remoting packet
Returns:
  `true` on success

#### sendResponse

    protected void sendResponse(javax.servlet.http.HttpServletResponse resp,
                    RemotingPacket packet)
                         throws Exception

Sends response to client

Parameters:
  `resp` - Response
  `packet` - Remoting packet
Throws:
  `Exception` - General exception