Red5 Application Directory Structure

For future reference, (and for the benefit of the worldwide interwebs), I thought I’d share the directory structure I use for my Red5 applications; it’s fairly standard but there’s not an overwhelming amount of documentation out there. (It’s based on the examples at http://code.google.com/p/red5/source/browse/java/example/trunk/).

Source folder

-> src
-> libs
-> www
-> WEB-INF
-> classes
-> logback-APPLICATION_NAME.xml
-> lib -> red5-web.properties -> red5-web.xml -> web.xml
  • The src folder builds to www/WEB-INF/classes
  • www is symbolically linked to webapps/APPLICATION_NAME
  • APPLICATION_NAME should be replaced with the name of your application

red5-web.properties

webapp.contextPath=/APPLICATION_NAME
webapp.virtualHosts=localhost, 127.0.0.1

red5-web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

<bean id="placeholderConfig">
<property name="location" value="/WEB-INF/red5-web.properties" />
</bean>

<bean id="web.context"
autowire="byType" />

<bean id="web.scope"
init-method="register">
<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>

<bean id="web.handler" singleton="true" />
</beans>

web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">

<display-name>APPLICATION_NAME</display-name>

<context-param>
<param-name>webAppRootKey</param-name>
<param-value>/APPLICATION_NAME</param-value>
</context-param>

<listener>
<listener-class>org.red5.logging.ContextLoggingListener</listener-class>
</listener>

<filter>
<filter-name>LoggerContextFilter</filter-name>
<filter-class>org.red5.logging.LoggerContextFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>LoggerContextFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<!-- remove the following servlet tags if you want to disable remoting for this application -->
<servlet>
<servlet-name>gateway</servlet-name>
<servlet-class>
org.red5.server.net.servlet.AMFGatewayServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>gateway</servlet-name>
<url-pattern>/gateway</url-pattern>
</servlet-mapping>

<security-constraint>
<web-resource-collection>
<web-resource-name>Forbidden</web-resource-name>
<url-pattern>/streams/*</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>

</web-app>

logback-APPLICATION_NAME.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<contextName>APPLICATION_NAME</contextName>
<jmxConfigurator contextName="APPLICATION_NAME" />
<appender name="APPLICATION_NAME">
<File>log/APPLICATION_NAME.log</File>
<Append>false</Append>
<Encoding>UTF-8</Encoding>
<BufferedIO>false</BufferedIO>
<ImmediateFlush>true</ImmediateFlush>
<layout>
<Pattern>
%date [%thread] %-5level %logger{35} - %msg%n
</Pattern>
</layout>
</appender>
<root>
<appender-ref ref="APPLICATION_NAME" />
</root>
<logger name="PACKAGE">
<level value="DEBUG" />
</logger>
</configuration>
  1. No comments yet.

  1. No trackbacks yet.