[Red5commits] [2263] Still have some Application context issues to resolve

pgregoire luke at codegent.com
Wed Aug 29 16:20:27 PDT 2007


Still have some Application context issues to resolve


Timestamp: 08/29/07 18:01:40 EST (less than one hour ago) 
Change: 2263 
Author: pgregoire

Files (see diff or trac for details): 
java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
java/server/trunk/src/org/red5/server/net/rtmpt/RTMPTServlet.java
java/server/trunk/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
java/server/trunk/src/org/red5/server/net/servlet/AMFGatewayServlet.java
java/server/trunk/src/org/red5/server/service/ServiceInvoker.java
java/server/trunk/src/org/red5/server/stream/ProviderService.java
java/server/trunk/src/org/red5/server/war/RootContextLoaderServlet.java


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2263

Index: /java/server/trunk/src/org/red5/server/stream/ProviderService.java
===================================================================
--- /java/server/trunk/src/org/red5/server/stream/ProviderService.java (revision 2144)
+++ /java/server/trunk/src/org/red5/server/stream/ProviderService.java (revision 2263)
@@ -45,11 +45,11 @@
 public class ProviderService implements IProviderService {
 
-    /**
-     * Logger
-     */
-    private static final Logger log = Logger.getLogger(ProviderService.class);
-	
+	/**
+	 * Logger
+	 */
+	private static final Logger log = Logger.getLogger(ProviderService.class);
+
 	/** {@inheritDoc} */
-    public IMessageInput getProviderInput(IScope scope, String name) {
+	public IMessageInput getProviderInput(IScope scope, String name) {
 		IMessageInput msgIn = getLiveProviderInput(scope, name, false);
 		if (msgIn == null) {
@@ -60,15 +60,14 @@
 
 	/** {@inheritDoc} */
-    public IMessageInput getLiveProviderInput(IScope scope, String name,
+	public IMessageInput getLiveProviderInput(IScope scope, String name,
 			boolean needCreate) {
-    	IBasicScope basicScope;
-		basicScope = scope.getBasicScope(IBroadcastScope.TYPE,
-				name);
+		IBasicScope basicScope;
+		basicScope = scope.getBasicScope(IBroadcastScope.TYPE, name);
 		if (basicScope == null) {
 			if (needCreate) {
 				synchronized (scope) {
 					// Re-check if another thread already created the scope
-					basicScope = scope.getBasicScope(IBroadcastScope.TYPE,
-							name);
+					basicScope = scope
+							.getBasicScope(IBroadcastScope.TYPE, name);
 					if (basicScope == null) {
 						basicScope = new BroadcastScope(scope, name);
@@ -87,5 +86,5 @@
 
 	/** {@inheritDoc} */
-    public IMessageInput getVODProviderInput(IScope scope, String name) {
+	public IMessageInput getVODProviderInput(IScope scope, String name) {
 		File file = getVODProviderFile(scope, name);
 		if (file == null) {
@@ -98,5 +97,5 @@
 
 	/** {@inheritDoc} */
-    public File getVODProviderFile(IScope scope, String name) {
+	public File getVODProviderFile(IScope scope, String name) {
 		File file = null;
 		try {
@@ -112,5 +111,5 @@
 
 	/** {@inheritDoc} */
-    public boolean registerBroadcastStream(IScope scope, String name,
+	public boolean registerBroadcastStream(IScope scope, String name,
 			IBroadcastStream bs) {
 		boolean status = false;
@@ -123,5 +122,6 @@
 			}
 			if (basicScope instanceof IBroadcastScope) {
-				((IBroadcastScope) basicScope).subscribe(bs.getProvider(), null);
+				((IBroadcastScope) basicScope)
+						.subscribe(bs.getProvider(), null);
 				status = true;
 			}
@@ -131,10 +131,9 @@
 
 	/** {@inheritDoc} */
-    public List<String> getBroadcastStreamNames(IScope scope) {
+	public List<String> getBroadcastStreamNames(IScope scope) {
 		// TODO: return result of "getBasicScopeNames" when the api has
 		// changed to not return iterators
 		List<String> result = new ArrayList<String>();
-		Iterator<String> it = scope
-				.getBasicScopeNames(IBroadcastScope.TYPE);
+		Iterator<String> it = scope.getBasicScopeNames(IBroadcastScope.TYPE);
 		while (it.hasNext()) {
 			result.add(it.next());
@@ -144,5 +143,5 @@
 
 	/** {@inheritDoc} */
-    public boolean unregisterBroadcastStream(IScope scope, String name) {
+	public boolean unregisterBroadcastStream(IScope scope, String name) {
 		boolean status = false;
 		synchronized (scope) {
@@ -161,5 +160,4 @@
 				.getScopeService(scope, IStreamableFileFactory.class);
 		if (name.indexOf(':') == -1 && name.indexOf('.') == -1) {
-		//if (!name.contains(':') && !name.contains('.')) {
 			// Default to .flv files if no prefix and no extension is given.
 			name = "flv:" + name;
@@ -173,8 +171,10 @@
 		}
 
-		IStreamFilenameGenerator filenameGenerator = (IStreamFilenameGenerator)
-			ScopeUtils.getScopeService(scope, IStreamFilenameGenerator.class, DefaultStreamFilenameGenerator.class);
-		
-		String filename = filenameGenerator.generateFilename(scope, name, GenerationType.PLAYBACK);
+		IStreamFilenameGenerator filenameGenerator = (IStreamFilenameGenerator) ScopeUtils
+				.getScopeService(scope, IStreamFilenameGenerator.class,
+						DefaultStreamFilenameGenerator.class);
+
+		String filename = filenameGenerator.generateFilename(scope, name,
+				GenerationType.PLAYBACK);
 		File file;
 		if (filenameGenerator.resolvesToAbsolutePath()) {
Index: /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java
===================================================================
--- /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java (revision 2246)
+++ /java/server/trunk/src/org/red5/server/net/rtmp/RTMPConnection.java (revision 2263)
@@ -418,12 +418,10 @@
 				return null;
 			}
-			ApplicationContext appCtx = scope.getContext()
-					.getApplicationContext();
-			ClientBroadcastStream cbs = (ClientBroadcastStream) appCtx
-					.getBean("clientBroadcastStream");
 			/**
 			 * Picking up the ClientBroadcastStream defined as a spring
 			 * prototype in red5-common.xml
 			 */
+			ClientBroadcastStream cbs = (ClientBroadcastStream) scope
+					.getContext().getBean("clientBroadcastStream");
 			Integer buffer = streamBuffers.get(streamId - 1);
 			if (buffer != null)
@@ -462,12 +460,10 @@
 				return null;
 			}
-			ApplicationContext appCtx = scope.getContext()
-					.getApplicationContext();
 			/**
 			 * Picking up the PlaylistSubscriberStream defined as a spring
 			 * prototype in red5-common.xml
 			 */
-			PlaylistSubscriberStream pss = (PlaylistSubscriberStream) appCtx
-					.getBean("playlistSubscriberStream");
+			PlaylistSubscriberStream pss = (PlaylistSubscriberStream) scope
+					.getContext().getBean("playlistSubscriberStream");
 			Integer buffer = streamBuffers.get(streamId - 1);
 			if (buffer != null)
@@ -497,5 +493,4 @@
 			return null;
 		}
-
 		return streams.get(id - 1);
 	}
@@ -512,5 +507,4 @@
 			return 0;
 		}
-
 		return ((channelId - 4) / 5) + 1;
 	}
@@ -527,5 +521,4 @@
 			return null;
 		}
-
 		return streams.get(getStreamIdForChannel(channelId) - 1);
 	}
@@ -842,5 +835,4 @@
 	protected void messageReceived() {
 		readMessages++;
-
 		// Trigger generation of BytesRead messages
 		updateBytesRead();
@@ -899,5 +891,5 @@
 
 	/**
-	 * Marks that pingback was recieved
+	 * Marks that pingback was received
 	 * 
 	 * @param pong
@@ -1026,5 +1018,6 @@
 			}
 
-			if (lastPongReceived > 0 && lastPingSent - lastPongReceived > maxInactivity) {
+			if (lastPongReceived > 0
+					&& lastPingSent - lastPongReceived > maxInactivity) {
 				// Client didn't send response to ping command for too long,
 				// disconnect
Index: /java/server/trunk/src/org/red5/server/net/servlet/AMFGatewayServlet.java
===================================================================
--- /java/server/trunk/src/org/red5/server/net/servlet/AMFGatewayServlet.java (revision 2251)
+++ /java/server/trunk/src/org/red5/server/net/servlet/AMFGatewayServlet.java (revision 2263)
@@ -50,34 +50,43 @@
 
 	private static final long serialVersionUID = 7174018823796785619L;
-    /**
-     * Logger
-     */
+
+	/**
+	 * Logger
+	 */
 	protected static Log log = LogFactory.getLog(AMFGatewayServlet.class);
-    /**
-     * AMF MIME type
-     */
+
+	/**
+	 * AMF MIME type
+	 */
 	public static final String APPLICATION_AMF = "application/x-amf";
-    /**
-     * Web app context
-     */
+
+	/**
+	 * Web app context
+	 */
 	protected WebApplicationContext webAppCtx;
-    /**
-     * Web context
-     */
+
+	/**
+	 * Web context
+	 */
 	protected IContext webContext;
-    /**
-     * Bean factory
-     */
+
+	/**
+	 * Bean factory
+	 */
 	protected BeanFactory netContext;
-    /**
-     * Remoting codec factory
-     */
+
+	/**
+	 * Remoting codec factory
+	 */
 	protected RemotingCodecFactory codecFactory;
 
 	/** {@inheritDoc} */
-    @Override
+	@Override
 	public void init() throws ServletException {
 		webAppCtx = WebApplicationContextUtils
 				.getWebApplicationContext(getServletContext());
+		log.debug("Gateway: ctx path: "
+				+ webAppCtx.getServletContext().getContextPath()
+				+ " srv ctx path: " + getServletContext().getContextPath());
 		if (webAppCtx != null) {
 			webContext = (IContext) webAppCtx.getBean("web.context");
@@ -90,11 +99,13 @@
 
 	/** {@inheritDoc} */
-    @Override
+	@Override
 	public void service(HttpServletRequest req, HttpServletResponse resp)
 			throws ServletException, IOException {
 		if (log.isDebugEnabled()) {
-			log.debug("Remoting request" + req.getContextPath() + ' ' + req.getServletPath());
-		}
-		if (req.getContentType() != null && req.getContentType().equals(APPLICATION_AMF)) {
+			log.debug("Remoting request" + req.getContextPath() + ' '
+					+ req.getServletPath());
+		}
+		if (req.getContentType() != null
+				&& req.getContentType().equals(APPLICATION_AMF)) {
 			serviceAMF(req, resp);
 		} else {
@@ -103,12 +114,17 @@
 	}
 
-    /**
-     * Works out AMF request
-     * @param req                     Request
-     * @param resp                    Response
-     * @throws ServletException       Servlet exception
-     * @throws IOException            I/O exception
-     */
-    protected void serviceAMF(HttpServletRequest req, HttpServletResponse resp)
+	/**
+	 * Works out AMF request
+	 * 
+	 * @param req
+	 *            Request
+	 * @param resp
+	 *            Response
+	 * @throws ServletException
+	 *             Servlet exception
+	 * @throws IOException
+	 *             I/O exception
+	 */
+	protected void serviceAMF(HttpServletRequest req, HttpServletResponse resp)
 			throws ServletException, IOException {
 		try {
@@ -128,11 +144,14 @@
 	}
 
-    /**
-     * Decode request
-     * @param req                    Request
-     * @return                       Remoting packet
-     * @throws Exception             General exception
-     */
-    protected RemotingPacket decodeRequest(HttpServletRequest req)
+	/**
+	 * Decode request
+	 * 
+	 * @param req
+	 *            Request
+	 * @return Remoting packet
+	 * @throws Exception
+	 *             General exception
+	 */
+	protected RemotingPacket decodeRequest(HttpServletRequest req)
 			throws Exception {
 		ByteBuffer reqBuffer = ByteBuffer.allocate(req.getContentLength());
@@ -157,11 +176,14 @@
 	}
 
-    /**
-     * Handles AMF request by making calls
-     * @param req              Request
-     * @param message          Remoting packet
-     * @return                 <code>true</code> on success
-     */
-    protected boolean handleRemotingPacket(HttpServletRequest req,
+	/**
+	 * Handles AMF request by making calls
+	 * 
+	 * @param req
+	 *            Request
+	 * @param message
+	 *            Remoting packet
+	 * @return <code>true</code> on success
+	 */
+	protected boolean handleRemotingPacket(HttpServletRequest req,
 			RemotingPacket message) {
 		IScope scope = webContext.resolveScope(message.getScopePath());
@@ -169,17 +191,21 @@
 		Red5.setConnectionLocal(new ServletConnection(req, scope, message));
 
-        for (RemotingCall call: message.getCalls()) {
-            webContext.getServiceInvoker().invoke(call, scope);
-        }
-        return true;
-	}
-
-    /**
-     * Sends response to client
-     * @param resp             Response
-     * @param packet           Remoting packet
-     * @throws Exception       General exception
-     */
-    protected void sendResponse(HttpServletResponse resp, RemotingPacket packet)
+		for (RemotingCall call : message.getCalls()) {
+			webContext.getServiceInvoker().invoke(call, scope);
+		}
+		return true;
+	}
+
+	/**
+	 * Sends response to client
+	 * 
+	 * @param resp
+	 *            Response
+	 * @param packet
+	 *            Remoting packet
+	 * @throws Exception
+	 *             General exception
+	 */
+	protected void sendResponse(HttpServletResponse resp, RemotingPacket packet)
 			throws Exception {
 		ByteBuffer respBuffer = codecFactory.getSimpleEncoder().encode(null,
@@ -192,5 +218,5 @@
 		respBuffer.release();
 		respBuffer = null;
-    }
+	}
 
 }
Index: /java/server/trunk/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java
===================================================================
--- /java/server/trunk/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java (revision 2186)
+++ /java/server/trunk/src/org/red5/server/net/rtmpt/TomcatRTMPTLoader.java (revision 2263)
@@ -28,6 +28,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.red5.server.api.IServer;
 import org.red5.server.tomcat.TomcatLoader;
-import org.red5.server.api.IServer;
 
 /**
@@ -40,29 +40,35 @@
 
 	// Initialize Logging
-	protected static Log log = LogFactory.getLog(TomcatRTMPTLoader.class.getName());
+	protected static Log log = LogFactory.getLog(TomcatRTMPTLoader.class
+			.getName());
 
-    /**
-     * RTMP server instance
-     */
-    protected Server rtmptServer;
-    /**
-     * Server instance
-     */
+	/**
+	 * RTMP server instance
+	 */
+	protected Server rtmptServer;
+
+	/**
+	 * Server instance
+	 */
 	protected IServer server;
-    /**
-     * Host
-     */
+
+	/**
+	 * Host
+	 */
 	private Host host;
-    /**
-     * Context, in terms of JEE context is web application in a servlet container
-     */
+
+	/**
+	 * Context, in terms of JEE context is web application in a servlet
+	 * container
+	 */
 	private Context context;
 
 	/**
-     * Setter for server
-     *
-     * @param server Value to set for property 'server'.
-     */
-    public void setServer(IServer server) {
+	 * Setter for server
+	 * 
+	 * @param server
+	 *            Value to set for property 'server'.
+	 */
+	public void setServer(IServer server) {
 		log.debug("RTMPT setServer");
 		this.server = server;
@@ -70,5 +76,5 @@
 
 	/** {@inheritDoc} */
-    @Override
+	@Override
 	public void init() {
 		log.info("Loading RTMPT context");
@@ -84,5 +90,6 @@
 		host.addChild(context);
 		if (log.isDebugEnabled()) {
-			log.debug("Null check - engine: " + (null == engine) + " host: " + (null == host));
+			log.debug("Null check - engine: " + (null == engine) + " host: "
+					+ (null == host));
 		}
 		engine.addChild(host);
@@ -118,14 +125,11 @@
 	 * Set primary context
 	 * 
-     * @param contextMap
-     * @param contextMap
+	 * @param contextMap
+	 * @param contextMap
 	 */
-	//public void setContext(Context context) {
-	//	log.debug("RTMPT setContext");
-	//	this.context = context;
-	//}
 	public void setContext(Map<String, String> contextMap) {
 		log.debug("RTMPT setContext (map)");
-		context = embedded.createContext(contextMap.get("path"), contextMap.get("docBase"));
+		context = embedded.createContext(contextMap.get("path"), contextMap
+				.get("docBase"));
 		context.setReloadable(false);
 	}
Index: /java/server/trunk/src/org/red5/server/net/rtmpt/RTMPTServlet.java
===================================================================
--- /java/server/trunk/src/org/red5/server/net/rtmpt/RTMPTServlet.java (revision 2127)
+++ /java/server/trunk/src/org/red5/server/net/rtmpt/RTMPTServlet.java (revision 2263)
@@ -50,8 +50,8 @@
 	private static final long serialVersionUID = 5925399677454936613L;
 
-    /**
-     * Logger
-     */
-    protected static Log log = LogFactory.getLog(RTMPTServlet.class);
+	/**
+	 * Logger
+	 */
+	protected static Log log = LogFactory.getLog(RTMPTServlet.class);
 
 	/**
@@ -61,5 +61,5 @@
 
 	/**
-	 * Content-Type to use for RTMPT requests / responses. 
+	 * Content-Type to use for RTMPT requests / responses.
 	 */
 	private static final String CONTENT_TYPE = "application/x-fcs";
@@ -67,9 +67,9 @@
 	/**
 	 * Try to generate responses that contain at least 32768 bytes data.
-	 * Increasing this value results in better stream performance, but
-	 * also increases the latency.
+	 * Increasing this value results in better stream performance, but also
+	 * increases the latency.
 	 */
 	private static final int RESPONSE_TARGET_SIZE = 32768;
-	
+
 	// TODO: we need to check the map periodically for disconnected clients
 	/**
@@ -78,29 +78,32 @@
 	protected HashMap<Integer, RTMPTConnection> rtmptClients = new HashMap<Integer, RTMPTConnection>();
 
-    /**
-     * Web app context
-     */
-    protected WebApplicationContext appCtx;
-
-    /**
-     * Reference to RTMPT handler;
-     */
-    private static RTMPTHandler handler;
-    
-    /**
-     * Set the RTMPTHandler to use in this servlet.
-     * 
-     * @param handler
-     */
-    public void setHandler(RTMPTHandler handler) {
-    	RTMPTServlet.handler = handler;
-    }
-    
+	/**
+	 * Web app context
+	 */
+	protected WebApplicationContext appCtx;
+
+	/**
+	 * Reference to RTMPT handler;
+	 */
+	private static RTMPTHandler handler;
+
+	/**
+	 * Set the RTMPTHandler to use in this servlet.
+	 * 
+	 * @param handler
+	 */
+	public void setHandler(RTMPTHandler handler) {
+		RTMPTServlet.handler = handler;
+	}
+
 	/**
 	 * Return an error message to the client.
 	 * 
-	 * @param message           Message
-	 * @param resp              Servlet response
-	 * @throws IOException      I/O exception
+	 * @param message
+	 *            Message
+	 * @param resp
+	 *            Servlet response
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void handleBadRequest(String message, HttpServletResponse resp)
@@ -116,7 +119,10 @@
 	 * Return a single byte to the client.
 	 * 
-	 * @param message           Message
-	 * @param resp              Servlet response
-	 * @throws IOException      I/O exception
+	 * @param message
+	 *            Message
+	 * @param resp
+	 *            Servlet response
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void returnMessage(byte message, HttpServletResponse resp)
@@ -134,7 +140,10 @@
 	 * Return a message to the client.
 	 * 
-	 * @param message            Message
-	 * @param resp               Servlet response
-	 * @throws IOException       I/O exception
+	 * @param message
+	 *            Message
+	 * @param resp
+	 *            Servlet response
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void returnMessage(String message, HttpServletResponse resp)
@@ -152,8 +161,12 @@
 	 * Return raw data to the client.
 	 * 
-	 * @param client             RTMP connection
-	 * @param buffer             Raw data as byte buffer
-	 * @param resp               Servlet response
-	 * @throws IOException       I/O exception
+	 * @param client
+	 *            RTMP connection
+	 * @param buffer
+	 *            Raw data as byte buffer
+	 * @param resp
+	 *            Servlet response
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void returnMessage(RTMPTConnection client, ByteBuffer buffer,
@@ -176,7 +189,9 @@
 	/**
 	 * Return the client id from a url like /send/123456/12 -> 123456
-     * @param req                Servlet request
-     * @return                   Client id
-     */
+	 * 
+	 * @param req
+	 *            Servlet request
+	 * @return Client id
+	 */
 	protected Integer getClientId(HttpServletRequest req) {
 		String path = req.getPathInfo();
@@ -203,6 +218,7 @@
 	 * Get the RTMPT client for a session.
 	 * 
-	 * @param req                Servlet request
-	 * @return                   RTMP client connection
+	 * @param req
+	 *            Servlet request
+	 * @return RTMP client connection
 	 */
 	protected RTMPTConnection getClient(HttpServletRequest req) {
@@ -220,6 +236,8 @@
 	 * Skip data sent by the client.
 	 * 
-	 * @param req                Servlet request
-	 * @throws IOException       I/O exception
+	 * @param req
+	 *            Servlet request
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void skipData(HttpServletRequest req) throws IOException {
@@ -234,7 +252,10 @@
 	 * Send pending messages to client.
 	 * 
-	 * @param client              RTMP connection
-	 * @param resp                Servlet response
-	 * @throws IOException        I/O exception
+	 * @param client
+	 *            RTMP connection
+	 * @param resp
+	 *            Servlet response
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void returnPendingMessages(RTMPTConnection client,
@@ -245,5 +266,5 @@
 			// no more messages to send...
 			if (client.isClosing())
-				// Tell client to close connection 
+				// Tell client to close connection
 				returnMessage((byte) 0, resp);
 			else
@@ -258,8 +279,12 @@
 	 * Start a new RTMPT session.
 	 * 
-	 * @param req                 Servlet request
-	 * @param resp                Servlet response
-	 * @throws ServletException   Servlet exception
-	 * @throws IOException        I/O exception
+	 * @param req
+	 *            Servlet request
+	 * @param resp
+	 *            Servlet response
+	 * @throws ServletException
+	 *             Servlet exception
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void handleOpen(HttpServletRequest req, HttpServletResponse resp)
@@ -285,8 +310,12 @@
 	 * Close a RTMPT session.
 	 * 
-	 * @param req                 Servlet request
-	 * @param resp                Servlet response
-	 * @throws ServletException   Servlet exception
-	 * @throws IOException        I/O exception
+	 * @param req
+	 *            Servlet request
+	 * @param resp
+	 *            Servlet response
+	 * @throws ServletException
+	 *             Servlet exception
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void handleClose(HttpServletRequest req, HttpServletResponse resp)
@@ -311,10 +340,14 @@
 
 	/**
-	 * Add data for an established session.   
-	 * 
-	 * @param req                 Servlet request
-	 * @param resp                Servlet response
-	 * @throws ServletException   Servlet exception
-	 * @throws IOException        I/O exception
+	 * Add data for an established session.
+	 * 
+	 * @param req
+	 *            Servlet request
+	 * @param resp
+	 *            Servlet response
+	 * @throws ServletException
+	 *             Servlet exception
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void handleSend(HttpServletRequest req, HttpServletResponse resp)
@@ -349,13 +382,13 @@
 
 		// Execute the received RTMP messages
-        for (Object message : messages) {
-            try {
-                handler.messageReceived(client, client.getState(), message);
-            } catch (Exception e) {
-                log.error("Could not process message.", e);
-            }
-        }
-
-        // Send results to client
+		for (Object message : messages) {
+			try {
+				handler.messageReceived(client, client.getState(), message);
+			} catch (Exception e) {
+				log.error("Could not process message.", e);
+			}
+		}
+
+		// Send results to client
 		returnPendingMessages(client, resp);
 		if (client.isClosing()) {
@@ -367,8 +400,12 @@
 	 * Poll RTMPT session for updates.
 	 * 
-	 * @param req                  Servlet request
-	 * @param resp                 Servlet response
-	 * @throws ServletException    Servlet exception
-	 * @throws IOException         I/O exception
+	 * @param req
+	 *            Servlet request
+	 * @param resp
+	 *            Servlet response
+	 * @throws ServletException
+	 *             Servlet exception
+	 * @throws IOException
+	 *             I/O exception
 	 */
 	protected void handleIdle(HttpServletRequest req, HttpServletResponse resp)
@@ -399,7 +436,9 @@
 	/**
 	 * Main entry point for the servlet.
-     *
-     * @param req                  Request object
-     * @param resp                 Response object
+	 * 
+	 * @param req
+	 *            Request object
+	 * @param resp
+	 *            Response object
 	 */
 	@Override
@@ -422,19 +461,19 @@
 		char p = path.charAt(1);
 		switch (p) {
-			case 'o': //OPEN_REQUEST
+			case 'o': // OPEN_REQUEST
 				handleOpen(req, resp);
 				break;
-			case 'c': //CLOSE_REQUEST
+			case 'c': // CLOSE_REQUEST
 				handleClose(req, resp);
 				break;
-			case 's': //SEND_REQUEST
+			case 's': // SEND_REQUEST
 				handleSend(req, resp);
 				break;
-			case 'i': //IDLE_REQUEST
+			case 'i': // IDLE_REQUEST
 				handleIdle(req, resp);
 				break;
 			default:
-				handleBadRequest("RTMPT command " + path + " is not supported.",
-						resp);
+				handleBadRequest(
+						"RTMPT command " + path + "

Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.



More information about the Red5commits mailing list