Understanding the application structure

rajdeeprath edited this page Sep 14, 2016 · 5 revisions

There are different ways to create a red5 application using eclipse and the downloaded red5 distribution. Before we move to the actual development it is very important to understand the structure of a red5 application and the different configuration files involved. Given below is a screenshot of the red65 application - live which comes pre-installed with red5 pro and open source.

To follow up with this section navigate to {RED5HOME}/webapps/live/ directory location, where RED5HOME is the root folder of your extracted red5 server distribution.

App Structure

In the above picture above, you can see that the application has three folders - persistence, streams, WEB-INF.

  1. persistence : An automatic system generated folder.

  2. streams : Stores media files for streaming and recorded stream files. This is also system generated. When a live stream is recorded red5 automatically creates this folder. If you do not have this folder you can create it and place Red5 compatible files in for video-on-demand streaming as well. We will explore of about this folder in later lessons.For now, it is sufficient to know that this is used for media files storage.

  3. WEB-INF : Contains web application configuration files and necessary classes. This directory is not accessible to end user. If you wish to serve HTML / JSP files you can place it at the same level as WEB-INF, streams, and persistence.

WEB-INF Content

The above picture shows the content of a standard WEB-INF directory ({RED5HOME}/webapps/live/WEB-INF). Red5 is a tomcat based server and follows a similar structure. There are three configuration files - red5-web.properties, red5-web.xml and web.xml by default (minimal). Other optional content can include a classes directory which will contain your custom java compiled classes and a lib directory which will hold java libraries used in your application as jar files.

  • red5-web.properties( : Holds the application context path entry (which is used to connect to the application) and virtualHosts entry by default.These are mandatory. Other than these you can use this file to store you own custom application properties as well.

  • red5-web.xml : Wires your entire application to red5 core. This is where your application entry point is defined and the application is wired to red5 core. When creating own applications you will have custom java classes - Java Beans. You would naturally wire them in here to register them with application startup.

  • web.xml : The main web application container directive for the server which tells the red5 server about how your application starts up, how it behaves and how to configure it. When developing custom java servlets, this is where you would register them.

SPECIAL NOTE: Red5 is very closely integrated with spring framework.So if you are a java enthusiastic it is recommended you take interest in spring right away. It is not just a recommendation but an absolute requirement if you want to be able to do more then just create a basic red5 application. None of these lessons is designed to go into any depth of spring.

We will see all these files in details and changes that can be edited into them, as we proceed further into this series. For now, these brief description should suffice the curious mind of yours. An application cannot run without these files.




Defined application contextPath of this application scope (Also used for connecting to this application) and a series of comma separated virtualHosts configuration which is * by default.


<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd">

<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="/WEB-INF/red5-web.properties" />

<bean id="web.context" class="org.red5.server.Context" autowire="byType" />

<bean id="web.scope" class="org.red5.server.scope.WebScope">
<property name="server" ref="red5.server" />
<property name="parent" ref="global.scope" />
<property name="context" ref="web.context" />
<property name="handler" ref="web.handler" />
<property name="contextPath" value="${webapp.contextPath}" />
<property name="virtualHosts" value="${webapp.virtualHosts}" />

<bean id="web.handler" class="org.red5.server.adapter.ApplicationAdapter" />



The main application configuration file which wires the application to the red5 core. Any custom classes / Java beans would need to be registered here. The web.handler property refers to the main application adapter (entry point) of this application. By default, you can refer to red5's ApplicationAdapter implementation. However, when developing your own application, it should refer to your own ApplicationAdapter class implementation. You can also substitute values from red5-web.properties placeholders in here.


<?xml version="1.0" encoding="ISO-8859-1"?>
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"











The core tomcat web application configuration file which tells the core server container how to handle this web application. The webAppRootKey property is same as the contaxtPath that is mentioned in red5-web.properties. Your custom servlets and java servlet filters can be registered here. This file is also used to define restrictions on directory access for security premises.


I hope, this lesson was informative enough to get you accustomed to the different essential red5 configuration files. In the next lesson, we will dive into some actual code development process and we shall see how to use these files along the way.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.