码迷,mamicode.com
首页 > 其他好文 > 详细

red5 1.0.7 集成tomcat 并且 进行整合 官方例子oflaDemo

时间:2016-06-21 07:38:32      阅读:669      评论:0      收藏:0      [点我收藏+]

标签:

简介:

之所要写,是因为网上很难找到最新的。 并且 red5-server 1.0.7 版本下的 server/war 包下完全用不了,旧的版本可以直接部署到tomcat就可以了。 但是,1.0.7 不行 日志也不行,所以特意写写部署的过程。

eclipse 部署

技术分享

  直接使用maven项目导入就可以了,基本上不会有什么问题。有问题的话,可能也是jdk版本的问题。可以自行更改

整合 maven 依赖关系

说明:因为有太多的包分别在各个子项目中,现在统一全部放在parent 父级中,方便我们新建red5项目的时候进行引入即可。直接上代码(已修改好的)。

red5-server-common —-> pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.red5</groupId>
        <artifactId>red5-parent</artifactId>
        <version>1.0.7-RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-server-common</artifactId>
    <name>Red5 :: Common server classes</name>
    <description>Classes common for multiple red5 projects</description>
    <packaging>jar</packaging>
    <url>https://github.com/Red5/red5-server-common</url>
    <organization>
        <name>Red5</name>
        <url>https://github.com/Red5</url>
    </organization>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>red5-interest</name>
            <post>https://groups.google.com/forum/?fromgroups#!forum/red5interest</post>
        </mailingList>
    </mailingLists>
    <issueManagement>
        <system>github</system>
        <url>https://github.com/Red5/red5-server-common/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/Red5/red5-server-common.git</url>
        <connection>scm:git:git@github.com:Red5/red5-server-common.git</connection>
        <developerConnection>scm:git:git@github.com:Red5/red5-server-common.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>Dominick Accattato</id>
            <email>dominick@red5.org</email>
        </developer>
        <developer>
            <id>Paul Gregoire</id>
            <email>mondain@gmail.com</email>
        </developer>
        <developer>
            <id>Dan Rossi</id>
            <email>electroteque@gmail.com</email>
        </developer>
        <developer>
            <id>Tiago Jacobs</id>
            <email>tiago.jacobs@gmail.com</email>
        </developer>
    </developers>
    <repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Snapshots</name>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>sonatype-releases</id>
            <name>Sonatype Releases</name>
            <url>http://oss.sonatype.org/content/repositories/releases</url>
        </repository>
    </repositories>
    <build>
        <defaultGoal>install</defaultGoal>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
            <testResource>
                <directory>src/test/java</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                </includes>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.red5</groupId>
                <artifactId>red5-io</artifactId>
                <version>${project.version}</version>
                <exclusions>
                    <exclusion>
                        <artifactId>bcprov-jdk15on</artifactId>
                        <groupId>org.bouncycastle</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>mina-core</artifactId>
                        <groupId>org.apache.mina</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>mina-integration-jmx</artifactId>
                        <groupId>org.apache.mina</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>mina-integration-beans</artifactId>
                        <groupId>org.apache.mina</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>commons-beanutils</artifactId>
                        <groupId>commons-beanutils</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>commons-codec</artifactId>
                        <groupId>commons-codec</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>commons-lang3</artifactId>
                        <groupId>org.apache.commons</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>spring-web</artifactId>
                        <groupId>org.springframework</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>quartz</artifactId>
                        <groupId>org.quartz-scheduler</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-io</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
    </dependencies>
</project>

red5-io —-> pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.red5</groupId>
        <artifactId>red5-parent</artifactId>
        <version>1.0.7-RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-io</artifactId>
    <name>Red5 :: IO</name>
    <description>The Red5 I/O library</description>
    <packaging>jar</packaging>
    <url>https://github.com/Red5/red5-io</url>
    <organization>
        <name>Red5</name>
        <url>https://github.com/Red5</url>
    </organization>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>red5-interest</name>
            <post>https://groups.google.com/forum/?fromgroups#!forum/red5interest</post>
        </mailingList>
    </mailingLists>
    <issueManagement>
        <system>github</system>
        <url>https://github.com/Red5/red5-io/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/Red5/red5-io.git</url>
        <connection>scm:git:git@github.com:Red5/red5-io.git</connection>
        <developerConnection>scm:git:git@github.com:Red5/red5-io.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>Dominick Accattato</id>
            <email>dominick@red5.org</email>
        </developer>
        <developer>
            <id>Paul Gregoire</id>
            <email>mondain@gmail.com</email>
        </developer>
        <developer>
            <id>Dan Rossi</id>
            <email>electroteque@gmail.com</email>
        </developer>
        <developer>
            <id>Tiago Jacobs</id>
            <email>tiago.jacobs@gmail.com</email>
        </developer>
    </developers>
    <build>
        <defaultGoal>install</defaultGoal>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencies>


    </dependencies>
</project>

red5-server pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.red5</groupId>
        <artifactId>red5-parent</artifactId>
        <version>1.0.7-RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-server</artifactId>
    <name>Red5 :: Server</name>
    <description>The Red5 server</description>
    <packaging>jar</packaging>
    <url>https://github.com/Red5/red5-server</url>
    <organization>
        <name>Red5</name>
        <url>https://github.com/Red5</url>
    </organization>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>red5-interest</name>
            <post>https://groups.google.com/forum/?fromgroups#!forum/red5interest</post>
        </mailingList>
    </mailingLists>
    <issueManagement>
        <system>github</system>
        <url>https://github.com/Red5/red5-server/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/Red5/red5-server.git</url>
        <connection>scm:git:git@github.com:Red5/red5-server.git</connection>
        <developerConnection>scm:git:git@github.com:Red5/red5-server.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>Dominick Accattato</id>
            <email>dominick@red5.org</email>
        </developer>
        <developer>
            <id>Paul Gregoire</id>
            <email>mondain@gmail.com</email>
        </developer>
        <developer>
            <id>Dan Rossi</id>
            <email>electroteque@gmail.com</email>
        </developer>
        <developer>
            <id>Tiago Jacobs</id>
            <email>tiago.jacobs@gmail.com</email>
        </developer>
    </developers>
    <properties>
        <build.dir>target</build.dir>
        <finalName>${project.artifactId}-${project.version}</finalName>
        <red5-io.version>${project.version}</red5-io.version>
        <red5-service.version>${project.version}</red5-service.version>
        <red5-server-common.version>${project.version}</red5-server-common.version>
    </properties>
    <repositories>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Snapshots</name>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>sonatype-releases</id>
            <name>Sonatype Releases</name>
            <url>http://oss.sonatype.org/content/repositories/releases</url>
        </repository>
    </repositories>
    <build>
        <defaultGoal>install</defaultGoal>
        <directory>${build.dir}</directory>
        <finalName>${finalName}</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <testResources>
            <testResource>
                <directory>src/test/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <SCM-Revision>${buildNumber}</SCM-Revision>
                                    <Implementation-Build>${buildNumber}</Implementation-Build>
                                </manifestEntries>
                            </archive>
                            <excludes>
                                <exclude>**/org/red5/server/Bootstrap.class</exclude>
                                <exclude>**/org/red5/server/Shutdown.class</exclude>
                                <exclude>**/org/red5/server/jmx/mxbeans/ShutdownMXBean.class</exclude>
                                <exclude>**/org/red5/classloading/**</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-server-common</artifactId>
            <version>${red5-server-common.version}</version>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-io</artifactId>
            <version>${red5-io.version}</version>
            <type>jar</type>
            <exclusions>
                <exclusion>
                    <artifactId>bcprov-jdk15on</artifactId>
                    <groupId>org.bouncycastle</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mina-core</artifactId>
                    <groupId>org.apache.mina</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mina-integration-jmx</artifactId>
                    <groupId>org.apache.mina</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mina-integration-beans</artifactId>
                    <groupId>org.apache.mina</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-beanutils</artifactId>
                    <groupId>commons-beanutils</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-codec</artifactId>
                    <groupId>commons-codec</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-web</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>quartz</artifactId>
                    <groupId>org.quartz-scheduler</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.red5</groupId>
            <artifactId>red5-service</artifactId>
            <version>${project.version}</version>

        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>assemble</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                    <includeScope>compile</includeScope>
                                    <excludeScope>test</excludeScope>
                                    <excludeTransitive>false</excludeTransitive>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/server.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <!-- this is used for inheritance merges -->
                                <phase>package</phase>
                                <!-- bind to the packaging phase -->
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}</finalName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>milestone</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/lib</outputDirectory>
                                    <includeScope>compile</includeScope>
                                    <excludeScope>test</excludeScope>
                                    <excludeTransitive>false</excludeTransitive>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/milestone.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <!-- this is used for inheritance merges -->
                                <phase>package</phase>
                                <!-- bind to the packaging phase -->
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>${project.artifactId}</finalName>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>war</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-war-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                            <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.6</version>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/war.xml</descriptor>
                            </descriptors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id>
                                <!-- this is used for inheritance merges -->
                                <phase>package</phase>
                                <!-- bind to the packaging phase -->
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

red5-service —-> pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <parent>
        <groupId>org.red5</groupId>
        <artifactId>red5-parent</artifactId>
        <version>1.0.7-RELEASE</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-service</artifactId>
    <name>Red5 :: Service</name>
    <description>The Red5 server service daemon</description>
    <packaging>jar</packaging>
    <url>https://github.com/Red5/red5-service</url>
    <organization>
        <name>Red5</name>
        <url>https://github.com/Red5</url>
    </organization>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>red5-interest</name>
            <post>https://groups.google.com/forum/?fromgroups#!forum/red5interest</post>
        </mailingList>
    </mailingLists>
    <issueManagement>
        <system>github</system>
        <url>https://github.com/Red5/red5-service/issues</url>
    </issueManagement>
    <scm>
        <url>https://github.com/Red5/red5-service.git</url>
        <connection>scm:git:git@github.com:Red5/red5-service.git</connection>
        <developerConnection>scm:git:git@github.com:Red5/red5-service.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>Dominick Accattato</id>
            <email>dominick@red5.org</email>
        </developer>
        <developer>
            <id>Paul Gregoire</id>
            <email>mondain@gmail.com</email>
        </developer>
        <developer>
            <id>Dan Rossi</id>
            <email>electroteque@gmail.com</email>
        </developer>
        <developer>
            <id>Tiago Jacobs</id>
            <email>tiago.jacobs@gmail.com</email>
        </developer>
    </developers>
    <build>
        <defaultGoal>install</defaultGoal>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <SCM-Revision>${buildNumber}</SCM-Revision>
                                    <Implementation-Build>${buildNumber}</Implementation-Build>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/daemon.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <!-- this is used for inheritance merges -->
                        <phase>package</phase>
                        <!-- bind to the packaging phase -->
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
    <dependencies>
    </dependencies>
</project>

####red5-parent —-> pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <!-- <![CDATA[ Licensed to the Apache Software Foundation (ASF) under one 
        or more contributor license agreements. See the NOTICE file distributed with 
        this work for additional information regarding copyright ownership. The ASF 
        licenses this file to you under the Apache License, Version 2.0 (the "License"); 
        you may not use this file except in compliance with the License. You may 
        obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
        Unless required by applicable law or agreed to in writing, software distributed 
        under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 
        OR CONDITIONS OF ANY KIND, either express or implied. See the License for 
        the specific language governing permissions and limitations under the License. 
        ]]> -->
    <modelVersion>4.0.0</modelVersion>
    <artifactId>red5-parent</artifactId>
    <packaging>pom</packaging>
    <name>Red5 :: Parent</name>
    <description>Parent project for all red5 projects containing dependency management and general info</description>
    <groupId>org.red5</groupId>
    <version>1.0.7-RELEASE</version>
    <url>https://github.com/Red5/red5-parent</url>
    <inceptionYear>2005</inceptionYear>
    <organization>
        <name>Red5</name>
        <url>https://github.com/Red5</url>
    </organization>
    <licenses>
        <license>
            <name>Apache 2</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>
    <mailingLists>
        <mailingList>
            <name>red5-interest</name>
            <post>https://groups.google.com/forum/?fromgroups#!forum/red5interest</post>
        </mailingList>
    </mailingLists>
    <scm>
        <url>https://github.com/Red5/red5-parent.git</url>
        <connection>scm:git:git@github.com:Red5/red5-parent.git</connection>
        <developerConnection>scm:git:git@github.com:Red5/red5-parent.git</developerConnection>
    </scm>
    <developers>
        <developer>
            <id>Dominick Accattato</id>
            <email>dominick@red5.org</email>
        </developer>
        <developer>
            <id>Paul Gregoire</id>
            <email>mondain@gmail.com</email>
        </developer>
        <developer>
            <id>Dan Rossi</id>
            <email>electroteque@gmail.com</email>
        </developer>
        <developer>
            <id>Tiago Jacobs</id>
            <email>tiago.jacobs@gmail.com</email>
        </developer>
    </developers>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>4.2.5.RELEASE</spring.version>
        <mina.version>2.0.13</mina.version>
        <slf4j.version>1.7.18</slf4j.version>
        <logback.version>1.1.6</logback.version>
        <quartz.version>2.2.2</quartz.version>
        <bc.version>1.54</bc.version>
        <junit.version>4.12</junit.version>
        <isoparser.version>1.1.17</isoparser.version>
        <tika.version>1.11</tika.version>
        <ehcache.version>2.6.11</ehcache.version>
        <commons-beanutils.version>1.9.2</commons-beanutils.version>
        <commons-codec.version>1.10</commons-codec.version>
        <commons-lang3.version>3.4</commons-lang3.version>
        <httpclient.version>4.5.2</httpclient.version>
        <httpcore.version>4.4.4</httpcore.version>
        <xerces.version>2.11.0</xerces.version>
        <cglib.version>3.2.0</cglib.version>
        <tomcat.version>8.0.33</tomcat.version>
        <commons-daemon.version>1.0.15</commons-daemon.version>
    </properties>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>sonatype-snapshots</id>
            <name>Sonatype Snapshots</name>
            <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
            <id>sonatype-releases</id>
            <name>Sonatype Releases</name>
            <url>http://oss.sonatype.org/content/repositories/releases</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-codec</artifactId>
                    <groupId>commons-codec</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context-support</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-access</artifactId>
            <version>${logback.version}</version>
        </dependency>

        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.mina</groupId>
            <artifactId>mina-parent</artifactId>
            <version>${mina.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>${tomcat.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>

        <dependency>
            <groupId>uk.org.lidalia</groupId>
            <artifactId>sysout-over-slf4j</artifactId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <artifactId>mina-integration-beans</artifactId>
            <groupId>org.apache.mina</groupId>
            <version>${mina.version}</version>
        </dependency>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>${quartz.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-daemon</groupId>
            <artifactId>commons-daemon</artifactId>
            <version>${commons-daemon.version}</version>
        </dependency>

        <dependency>
            <groupId>org.bouncycastle</groupId>
            <artifactId>bcprov-jdk15on</artifactId>
            <version>${bc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>${logback.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.mina</groupId>
            <artifactId>mina-core</artifactId>
            <version>${mina.version}</version>
            <type>bundle</type>
        </dependency>
        <dependency>
            <groupId>org.apache.mina</groupId>
            <artifactId>mina-integration-beans</artifactId>
            <version>${mina.version}</version>
            <type>bundle</type>
        </dependency>
        <dependency>
            <groupId>org.apache.mina</groupId>
            <artifactId>mina-integration-jmx</artifactId>
            <version>${mina.version}</version>
            <type>bundle</type>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.mina</groupId>
                    <artifactId>mina-integration-ognl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-core</artifactId>
            <version>${tika.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tika</groupId>
            <artifactId>tika-parsers</artifactId>
            <version>${tika.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>cxf-rt-rs-client</artifactId>
                    <groupId>org.apache.cxf</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>cdm</artifactId>
                    <groupId>edu.ucar</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>pdfbox</artifactId>
                    <groupId>org.apache.pdfbox</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>opennlp-tools</artifactId>
                    <groupId>org.apache.opennlp</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>junrar</artifactId>
                    <groupId>com.github.junrar</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>grib</artifactId>
                    <groupId>edu.ucar</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>sis-metadata</artifactId>
                    <groupId>org.apache.sis.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>sis-utility</artifactId>
                    <groupId>org.apache.sis.core</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>sis-netcdf</artifactId>
                    <groupId>org.apache.sis.storage</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>vorbis-java-core</artifactId>
                    <groupId>org.gagravarr</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>vorbis-java-tika</artifactId>
                    <groupId>org.gagravarr</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>xz</artifactId>
                    <groupId>org.tukaani</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>geoapi</artifactId>
                    <groupId>org.opengis</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>httpservices</artifactId>
                    <groupId>edu.ucar</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jackcess</artifactId>
                    <groupId>com.healthmarketscience.jackcess</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jackcess-encrypt</artifactId>
                    <groupId>com.healthmarketscience.jackcess</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>java-libpst</artifactId>
                    <groupId>com.pff</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>netcdf4</artifactId>
                    <groupId>edu.ucar</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>bcmail-jdk15on</artifactId>
                    <groupId>org.bouncycastle</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>bcpkix-jdk15on</artifactId>
                    <groupId>org.bouncycastle</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-csv</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-exec</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jhighlight</artifactId>
                    <groupId>org.codelibs</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>jmatio</artifactId>
                    <groupId>net.sourceforge.jmatio</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>json</artifactId>
                    <groupId>org.json</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>json-simple</artifactId>
                    <groupId>com.googlecode.json-simple</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>poi</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>poi-ooxml</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>poi-scratchpad</artifactId>
                    <groupId>org.apache.poi</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>rome</artifactId>
                    <groupId>rome</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <artifactId>commons-beanutils</artifactId>
            <groupId>commons-beanutils</groupId>
            <version>${commons-beanutils.version}</version>
        </dependency>
        <dependency>
            <artifactId>commons-codec</artifactId>
            <groupId>commons-codec</groupId>
            <version>${commons-codec.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>${xerces.version}</version>
        </dependency>
        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache-core</artifactId>
            <version>${ehcache.version}</version>
        </dependency>
        <dependency>
            <groupId>com.googlecode.mp4parser</groupId>
            <artifactId>isoparser</artifactId>
            <version>${isoparser.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>
        <dependency>
            <artifactId>commons-beanutils</artifactId>
            <groupId>commons-beanutils</groupId>
            <version>${commons-beanutils.version}</version>
        </dependency>
        <dependency>
            <artifactId>commons-codec</artifactId>
            <groupId>commons-codec</groupId>
            <version>${commons-codec.version}</version>
        </dependency>
        <dependency>
            <groupId>org.quartz-scheduler</groupId>
            <artifactId>quartz</artifactId>
            <version>${quartz.version}</version>
        </dependency>
        <dependency>
            <artifactId>bcprov-jdk15on</artifactId>
            <groupId>org.bouncycastle</groupId>
            <version>${bc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>tomcat-servlet-api</artifactId>
            <version>${tomcat.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5</version>
                <configuration>
                    <compilerVersion>1.8</compilerVersion>
                    <fork>true</fork>
                    <source>1.8</source>
                    <target>1.8</target>
                    <executable>${maven.compiler.executable}</executable>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <verbose>true</verbose>
                    <failOnError>false</failOnError>
                    <sourcepath>${basedir}/src/main/java</sourcepath>
                    <includeDependencySources>false</includeDependencySources>
                    <dependencySourceIncludes>
                        <dependencySourceInclude>org.red5:*</dependencySourceInclude>
                    </dependencySourceIncludes>
                    <detectOfflineLinks>false</detectOfflineLinks>
                    <stylesheetfile>javadoc.css</stylesheetfile>
                    <links>
                        <link>http://download.oracle.com/javase/7/docs/api</link>
                        <link>http://docs.spring.io/spring/docs/4.0.3.RELEASE/javadoc-api</link>
                        <link>http://www.slf4j.org/api</link>
                        <link>http://logging.apache.org/log4j/1.2/apidocs</link>
                    </links>
                    <tags>
                        <tag>
                            <name>todo</name>
                            <!-- todo tag for all places -->
                            <placement>a</placement>
                            <head>To do:</head>
                        </tag>
                    </tags>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                </manifest>
                                <manifestEntries>
                                    <SCM-Revision>${buildNumber}</SCM-Revision>
                                    <Implementation-Build>${buildNumber}</Implementation-Build>
                                </manifestEntries>
                            </archive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                            <excludeTransitive>true</excludeTransitive>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>2.8.1</version>
            </plugin>
            <plugin>
                <artifactId>maven-scm-plugin</artifactId>
                <version>1.9.4</version>
                <configuration>
                    <connectionType>connection</connectionType>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>3.0.1</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.6</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.6</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
                <repository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
                </repository>
            </distributionManagement>
        </profile>
        <profile>
            <id>updatebuildnumber</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>buildnumber-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>validate</phase>
                                <goals>
                                    <goal>create</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doCheck>false</doCheck>
                            <doUpdate>false</doUpdate>
                            <shortRevisionLength>5</shortRevisionLength>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

整合tomcat

说明一下:有点模糊的就是为什么不是 red5-server整合tomcat项目,其实说白了,这只是一个jar并且spring管理的bean。所以不能单独整合,只能通过新建的项目然后把red5-server加入即可。 当然新建的项目就是webapp项目了。

由于之前整理好了maven管理jar的关系,所以这次我在red5-parent 直接新建 maven Module 然后给个名字red5 然后选择 maven-archetype-webapp — >next finish 就可以了。如图:
技术分享
技术分享

新建立好之后 如下:
技术分享

  • 然后就进行拷贝了。首先从https://github.com/Red5/red5-examples 会看到 一个子项目 oflaDemo
    直接拷贝源码到我们新建立好的项目如下图:
    技术分享

  • 接着拷贝 oflaDemo war包下的 oflaDemo-web.xml 到我们项目的 resources下面 如图:

    技术分享
    我们的项目如下图
    技术分享

  • 接着拷贝red5-server server包下的conf red5.properties,logback.xml,web.xml 和 webapps下面的 red5-default.xml 和 root包下面的内容(不包括 WEB-INF) 拷贝到我们的项目,red5-default.xml 需要改名字,改成 defaultContext.xml 如下图:

    技术分享

  • 其他的 xml 文件是修改了。直接贴代码如下:

beanRefContext.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
        name="default.context"
        class="org.springframework.context.support.ClassPathXmlApplicationContext" >

        <constructor-arg>

            <list>

                <value>
defaultContext.xml

                </value>

                <value>
red5-common.xml

                </value>

                <value>
red5-core.xml

                </value>
            </list>
        </constructor-arg>
    </bean>

</beans>

red5-common.xml

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

    <!-- This context is shared between all child contexts. -->
    <!-- Server bean -->

    <bean
        id="red5.server"
        class="org.red5.server.Server" />
    <!-- JMX server -->

    <!-- Serializes objects to AMF binary -->

    <bean
        id="serializer"
        class="org.red5.io.object.Serializer" />
    <!-- Deserializes objects from AMF binary -->

    <bean
        id="deserializer"
        class="org.red5.io.object.Deserializer" />
     <!-- Deals with StatusObjects representing statuses like NetConnection.Connect.Success status -->
    <bean id="statusObjectService" class="org.red5.server.net.rtmp.status.StatusObjectService" autowire="byType" /> 
    <!-- RTMP codec factory -->
<bean id="minaEncoder" class="org.red5.server.net.rtmp.codec.RTMPMinaProtocolEncoder" scope="prototype" />

    <bean id="minaDecoder" class="org.red5.server.net.rtmp.codec.RTMPMinaProtocolDecoder" scope="prototype" />


    <!-- RTMPT codec factory -->

    <bean
        id="rtmptCodecFactory"
        autowire="byType"
        class="org.red5.server.net.rtmpt.codec.RTMPTCodecFactory"
        init-method="init" >
        <property name="baseTolerance" value="${rtmpt.encoder_base_tolerance}" />
        <property name="dropLiveFuture" value="${rtmpt.encoder_drop_live_future}" />
    </bean>
    <!-- Remoting calls codec factory -->

    <bean
        id="remotingCodecFactory"
        autowire="byType"
        class="org.red5.server.net.remoting.codec.RemotingCodecFactory"
        init-method="init" />
    <!-- Streamable file factory -->
<bean id="streamableFileFactory" class="org.red5.server.stream.StreamableFileFactory">
        <property name="services">
            <list>
                <bean id="flvFileService" class="org.red5.server.service.flv.impl.FLVService">
                    <property name="generateMetadata" value="true"/>
                </bean>
                <bean id="mp3FileService" class="org.red5.server.service.mp3.impl.MP3Service"/>
                <bean id="mp4FileService" class="org.red5.server.service.mp4.impl.MP4Service"/>
                <bean id="m4aFileService" class="org.red5.server.service.m4a.impl.M4AService"/>
            </list>
        </property>
    </bean>
    <!-- Thread that writes modified objects to disk periodically -->

    <!-- Handles creation / lookup of shared objects -->

    <bean id="sharedObjectService" class="org.red5.server.so.SharedObjectService">
        <property name="maximumEventsPerUpdate" value="${so.max.events.per.update}"/>
        <property name="persistenceClassName">
            <value>org.red5.server.persistence.FilePersistence</value>
        </property>
        <property name="scheduler">
            <bean class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
                <property name="poolSize" value="${so.scheduler.pool_size}" />  
                <property name="waitForTasksToCompleteOnShutdown" value="false"/>
                <property name="daemon" value="true"/>
                <property name="threadNamePrefix" value="SharedObjectScheduler-"/>
            </bean>
        </property>
    </bean>
    <!-- High level access to streams -->

    <bean
        id="streamService"
        class="org.red5.server.stream.StreamService" />
    <!-- High level access to broadcasted streams -->

    <bean
        id="providerService"
        class="org.red5.server.stream.ProviderService" />
    <!-- Provides output to consumers -->

    <bean
        id="consumerService"
        class="org.red5.server.stream.ConsumerService" />
    <!-- Scheduling service -->

    <bean
        id="schedulingService"
        class="org.red5.server.scheduling.QuartzSchedulingService" />
    <!-- Use injection to setup thread pool for remoting clients -->

    <bean
        id="remotingClient"
        class="org.red5.server.net.remoting.RemotingClient" >

        <property
            name="poolSize"
            value="2" />
    </bean>
    <!--
    Now we can load the cache engine, only one may be enabled at a time. If no-caching is required select the
    NoCacheImpl. Three other implementations based on EhCache, WhirlyCache, and Red5Cache are also available.


    -->
 <bean id="object.cache" class="org.red5.cache.impl.NoCacheImpl"/>
    <!-- Cache to use for keyframe metadata. -->

    <bean id="keyframe.cache" class="org.red5.io.CachingFileKeyFrameMetaCache">
        <property name="maxCacheEntry" value="${keyframe.cache.entry.max}" />
    </bean>
    <!--
        Represents FLV files
        Use injection to set the cache impl to be used with flvs


    -->

    <bean
        id="flv.impl"
        class="org.red5.io.flv.impl.FLV" >

        <property name="cache" >

            <ref bean="object.cache" />
        </property>
    </bean>
    <!-- Use injection to set the keyframe cache for FLV files -->
 <bean id="flvreader.impl" class="org.red5.io.flv.impl.FLVReader">
        <property name="keyFrameCache">
            <ref bean="keyframe.cache"/>
        </property>
    </bean>
    <!-- Use injection to set the keyframe cache for MP3 files -->

    <bean
        id="mp3reader.impl"
        class="org.red5.io.mp3.impl.MP3Reader" >

        <property name="frameCache" >

            <ref bean="keyframe.cache" />
        </property>
    </bean>
    <!-- Use injection to set the buffer type for reading FLV files -->
    <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod">
            <value>org.red5.io.flv.impl.FLVReader.setBufferType</value>
        </property>
        <!-- Three buffer types are available ‘auto‘, ‘heap‘, and ‘direct‘ -->
        <property name="arguments" value="auto"/>
    </bean>
    <!-- Use injection to set the buffer size for reading FLV files -->
 <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="staticMethod">
            <value>org.red5.io.flv.impl.FLVReader.setBufferSize</value>
        </property>
        <!-- Three buffer types are available ‘auto‘, ‘heap‘, and ‘direct‘ -->
        <property name="arguments" value="4096"/>
    </bean>
    <!--
         Executor that will be used to schedule stream playback to keep
        the client buffer filled.


    -->

    <bean
        id="streamExecutor"
        class="java.util.concurrent.ScheduledThreadPoolExecutor" >

        <constructor-arg value="16" />

        <property
            name="maximumPoolSize"
            value="64" />
    </bean>
    <!--
         ClientBroadcastStream and PlaylistSubscriberStream
        that will be used by RTMPConnection and maybe other classes.
        These beans are lazy-init because most likely server will need
        to be up and running before we can get a smart implementation
        of these streams


    -->
 <bean id="playlistSubscriberStream" scope="prototype" lazy-init="true" class="org.red5.server.stream.PlaylistSubscriberStream">
        <!-- Check for buffer underruns every X ms and generate NetStream.Play.InsufficientBW accordingly.
             Set to 0 to disable. Be careful not to set this value too small to avoid network congestion.
          -->
        <property name="bufferCheckInterval" value="${subscriberstream.buffer.check.interval}"/>
        <!-- A NetStream.Play.InsufficientBW message is generated if more than X messages are queued for sending on the connection.
             This value will also control the maximum pending messages on the server. To use a smaller value on slow connections
             to get smaller delay for downstream server commands.
          -->
        <property name="underrunTrigger" value="${subscriberstream.underrun.trigger}"/>
    </bean>

    <bean
        id="clientBroadcastStream"
        class="org.red5.server.stream.ClientBroadcastStream"
        lazy-init="true"
        scope="prototype" />

</beans>

red5-core.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:lang="http://www.springframework.org/schema/lang" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    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">

    <!-- DO NOT FORMAT THIS FILE IN ECLIPSE -->

    <bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
        <property name="customEditors">
            <map>
                <entry key="java.net.SocketAddress" value="org.apache.mina.integration.beans.InetSocketAddressEditor" />
            </map>
        </property>
    </bean>

    <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="classpath:/red5.properties" />
    </bean>

    <!-- RTMP -->
    <bean id="rtmpScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
        <property name="poolSize" value="${rtmp.scheduler.pool_size}" />
        <property name="daemon" value="true" />
        <property name="waitForTasksToCompleteOnShutdown" value="true" />
        <property name="threadNamePrefix" value="RTMPConnectionScheduler-" />
    </bean>

    <bean id="messageExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
        <property name="corePoolSize" value="${rtmp.executor.core_pool_size}" />
        <property name="maxPoolSize" value="${rtmp.executor.max_pool_size}" />
        <property name="queueCapacity" value="${rtmp.executor.queue_capacity}" />
        <property name="daemon" value="false" />
        <property name="waitForTasksToCompleteOnShutdown" value="true" />
        <property name="threadNamePrefix" value="RTMPConnectionExecutor-" />
    </bean>

    <bean id="deadlockGuardScheduler" class="org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler">
        <property name="poolSize" value="${rtmp.deadlockguard.sheduler.pool_size}" />
        <property name="daemon" value="false" />
        <property name="waitForTasksToCompleteOnShutdown" value="true" />
        <property name="threadNamePrefix" value="DeadlockGuardScheduler-" />
    </bean>

    <!-- RTMP connection manager -->
    <bean id="rtmpConnManager" class="org.red5.server.net.rtmp.RTMPConnManager" />

    <!-- RTMP Handler -->
    <bean id="rtmpHandler" class="org.red5.server.net.rtmp.RTMPHandler">
        <property name="server" ref="red5.server" />
        <property name="statusObjectService" ref="statusObjectService" />
        <!-- Enable this to allow unvalidated connections -->
        <property name="unvalidatedConnectionAllowed" value="true" />
    </bean>

    <!-- RTMP Mina IO Handler -->
    <bean id="rtmpMinaIoHandler" class="org.red5.server.net.rtmp.RTMPMinaIoHandler">
        <property name="handler" ref="rtmpHandler" />
    </bean>

    <!-- RTMP Mina Transport -->
    <bean id="rtmpTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
        <property name="ioHandler" ref="rtmpMinaIoHandler" />
        <property name="addresses">
            <list>
                <value>${rtmp.host}:${rtmp.port}</value>
                <!-- You can now add additional ports and ip addresses
                <value>${rtmp.host}:1936</value>
                 -->
            </list>
        </property>
        <property name="ioThreads" value="${rtmp.io_threads}" />
        <property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
        <property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
        <property name="trafficClass" value="${rtmp.traffic_class}" />
        <property name="backlog" value="${rtmp.backlog}" />
        <property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
        <property name="keepAlive" value="${rtmp.tcp_keepalive}" />
        <property name="thoughputCalcInterval" value="${rtmp.thoughput_calc_interval}" />
        <property name="enableDefaultAcceptor" value="${rtmp.default_acceptor}" />
        <!-- Pool settings are used when the default acceptor is disabled -->
        <property name="initialPoolSize" value="${rtmp.initial_pool_size}" />
        <property name="maxPoolSize" value="${rtmp.max_pool_size}" />
        <property name="maxProcessorPoolSize" value="${rtmp.max_processor_pool_size}" />
        <property name="executorKeepAliveTime" value="${rtmp.executor_keepalive_time}" />
        <!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not enabled, polling will not occur. -->
        <property name="minaPollInterval" value="${jmx.mina.poll.interval}" />
        <property name="enableMinaMonitor" value="${jmx.mina.monitor.enable}" />
        <property name="enableMinaLogFilter" value="${mina.logfilter.enable}" />
    </bean>

    <!-- RTMP Mina Connection -->
    <bean id="rtmpMinaConnection" scope="prototype" class="org.red5.server.net.rtmp.RTMPMinaConnection">
        <!-- Executor for scheduled tasks -->
        <property name="scheduler" ref="rtmpScheduler" />
        <!-- Executor for incoming messages -->
        <property name="executor" ref="messageExecutor" />
        <!-- Deadlock guard executor -->
        <property name="deadlockGuardScheduler" ref="deadlockGuardScheduler" />
        <!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
        <property name="pingInterval" value="${rtmp.ping_interval}" />
        <!-- Disconnect client after X ms of not responding. -->
        <property name="maxInactivity" value="${rtmp.max_inactivity}" />
        <!-- Max. time in milliseconds to wait for a valid handshake. -->
        <property name="maxHandshakeTimeout" value="${rtmp.max_handshake_time}" />
        <!-- Default server bandwidth per connection -->
        <property name="defaultServerBandwidth" value="${rtmp.default_server_bandwidth}" />
        <!-- Default client bandwidth per connection -->
        <property name="defaultClientBandwidth" value="${rtmp.default_client_bandwidth}" />
        <!-- Client bandwidth limit type: 0 = hard, 1 = soft, 2 = dynamic -->
        <property name="limitType" value="${rtmp.client_bandwidth_limit_type}" />
        <!-- Bandwidth detection. If "false" the server will NOT initiate a check -->
        <property name="bandwidthDetection" value="${rtmp.bandwidth_detection}" />
        <!-- Maximum time allowed for a single RTMP packet to be processed -->
        <property name="maxHandlingTimeout" value="${rtmp.max_handling_time}" />
        <!-- Specify the size of queue that will trigger audio packet dropping, disabled if it‘s 0 -->
        <property name="executorQueueSizeToDropAudioPackets" value="${rtmp.executor.queue_size_to_drop_audio_packets}" />
        <!-- Concurrent collection tweaks -->
        <property name="channelsInitalCapacity" value="${rtmp.channel.initial.capacity}" />
        <property name="channelsConcurrencyLevel" value="${rtmp.channel.concurrency.level}" />
        <property name="streamsInitalCapacity" value="${rtmp.stream.initial.capacity}" />
        <property name="streamsConcurrencyLevel" value="${rtmp.stream.concurrency.level}" />
        <property name="pendingCallsInitalCapacity" value="${rtmp.pending.calls.initial.capacity}" />
        <property name="pendingCallsConcurrencyLevel" value="${rtmp.pending.calls.concurrency.level}" />
        <property name="reservedStreamsInitalCapacity" value="${rtmp.reserved.streams.initial.capacity}" />
        <property name="reservedStreamsConcurrencyLevel" value="${rtmp.reserved.streams.concurrency.level}" />
    </bean>

    <!-- RTMPT -->
    <!-- RTMPT Handler -->
    <bean id="rtmptHandler" class="org.red5.server.net.rtmpt.RTMPTHandler" autowire="byType">
        <property name="codecFactory" ref="rtmptCodecFactory" />
    </bean>

    <!-- Use injection to store RTMPT handler in servlet -->
    <bean id="rtmptServlet" class="org.red5.server.net.rtmpt.RTMPTServlet">
        <property name="manager" ref="rtmpConnManager" />
        <property name="handler" ref="rtmptHandler" />
        <!-- Increasing this value results in better stream performance, but also increases the latency -->
        <property name="targetResponseSize" value="${rtmpt.target_reponse_size}" />
        <!-- Response for /fcs/ident2 requests -->
        <!--
        <property name="ident2" value="127.0.0.1" />
        -->
    </bean>

    <!-- RTMPT Connection -->
    <bean id="rtmptConnection" scope="prototype" class="org.red5.server.net.rtmpt.RTMPTConnection">
        <!-- Executor for scheduled tasks -->
        <property name="scheduler" ref="rtmpScheduler" />
        <!-- Executor for incoming messages -->
        <property name="executor" ref="messageExecutor" />
        <!-- Deadlock guard executor -->
        <property name="deadlockGuardScheduler" ref="deadlockGuardScheduler" />
        <!-- Ping clients every X ms. Set to 0 to disable ghost detection code. -->
        <property name="pingInterval" value="${rtmpt.ping_interval}" />
        <!-- Disconnect client after X ms of not responding. -->
        <property name="maxInactivity" value="${rtmpt.max_inactivity}" />
        <!-- Max. time in milliseconds to wait for a valid handshake. -->
        <property name="maxHandshakeTimeout" value="${rtmpt.max_handshake_time}" />
        <!-- Maximum incoming messages to process at a time per client -->
        <property name="maxInMessagesPerProcess" value="${rtmpt.max_in_msg_process}" />
        <!-- Maximum amount of time in milliseconds to wait before allowing an offer to fail on incoming or outgoing queues -->
        <property name="maxQueueOfferTime" value="${rtmpt.max_queue_offer_time}" />
        <!-- Maximum offer attempts before failing on incoming or outgoing queues -->
        <property name="maxQueueOfferAttempts" value="${rtmpt.max_queue_offer_attempts}" />
        <!-- Maximum time allowed for a single RTMP packet to be processed -->
        <property name="maxHandlingTimeout" value="${rtmp.max_handling_time}" />
        <!-- Specify the size of queue that will trigger audio packet dropping, disabled if it‘s 0 -->
        <property name="executorQueueSizeToDropAudioPackets" value="${rtmp.executor.queue_size_to_drop_audio_packets}" />
        <!-- Concurrent collection tweaks -->
        <property name="channelsInitalCapacity" value="${rtmp.channel.initial.capacity}" />
        <property name="channelsConcurrencyLevel" value="${rtmp.channel.concurrency.level}" />
        <property name="streamsInitalCapacity" value="${rtmp.stream.initial.capacity}" />
        <property name="streamsConcurrencyLevel" value="${rtmp.stream.concurrency.level}" />
        <property name="pendingCallsInitalCapacity" value="${rtmp.pending.calls.initial.capacity}" />
        <property name="pendingCallsConcurrencyLevel" value="${rtmp.pending.calls.concurrency.level}" />
        <property name="reservedStreamsInitalCapacity" value="${rtmp.reserved.streams.initial.capacity}" />
        <property name="reservedStreamsConcurrencyLevel" value="${rtmp.reserved.streams.concurrency.level}" />
    </bean>

    <!-- RTMPS -->
    <!-- Notes to self: 
         https://www.openssl.org/docs/apps/ciphers.html#TLS-v1.2-cipher-suites 
         https://www.sslshopper.com/article-how-to-disable-weak-ciphers-and-ssl-2-in-tomcat.html

    <bean id="rtmpsMinaIoHandler" class="org.red5.server.net.rtmps.RTMPSMinaIoHandler">
        <property name="handler" ref="rtmpHandler" />
        <property name="keystorePassword" value="${rtmps.keystorepass}" />
        <property name="keystoreFile" value="${rtmps.keystorefile}" />
        <property name="truststorePassword" value="${rtmps.truststorepass}" />
        <property name="truststoreFile" value="${rtmps.truststorefile}" />
        <property name="cipherSuites">
            <array>
                <value>TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256</value>
                <value>TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384</value>

                <value>TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA</value>
                <value>TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384</value>
                <value>TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA</value>
                <value>TLS_ECDHE_RSA_WITH_RC4_128_SHA</value>
                <value>TLS_RSA_WITH_AES_128_CBC_SHA256</value>
                <value>TLS_RSA_WITH_AES_128_CBC_SHA</value>
                <value>TLS_RSA_WITH_AES_256_CBC_SHA256</value>
                <value>TLS_RSA_WITH_AES_256_CBC_SHA</value>
                <value>SSL_RSA_WITH_RC4_128_SHA</value>
            </array>
        </property>
        <property name="protocols">
            <array>
                <value>TLSv1</value>
                <value>TLSv1.1</value>
                <value>TLSv1.2</value>
            </array>
        </property>
    </bean>

    <bean id="rtmpsTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
        <property name="ioHandler" ref="rtmpsMinaIoHandler" />
        <property name="addresses">
            <list>
                 <value>${rtmps.host}:${rtmps.port}</value>
            </list>
        </property>
        <property name="ioThreads" value="${rtmp.io_threads}" />
        <property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
    </bean>
-->
    <!-- Enable when you need it. - - >
        <bean id="rtmpProxyTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
                <property name="ioHandler" ref="debugProxyIoHandler" />
                <property name="address" value="${proxy.source_host}" />
                <property name="port" value="${proxy.source_port}" />
                <property name="ioThreads" value="${rtmp.io_threads}" />
                <property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
        </bean>

        <bean id="debugProxyIoHandler"
                class="org.red5.server.net.proxy.DebugProxyHandler">
                <property name="codecFactory" ref="rtmpCodecFactory" />
                <property name="forward" value="${proxy.destination_host}:${proxy.destination_port}" />
                <property name="dumpTo" value="./webapps/dump/" />
        </bean>
-->
</beans>

到这里就集成成功了:
使用 jdk 1.8 tomcat 8以上
启动tomcat:
地址
http://localhost:8080/red5/demos/publisher.html
技术分享
技术分享

red5 1.0.7 集成tomcat 并且 进行整合 官方例子oflaDemo

标签:

原文地址:http://blog.csdn.net/dao2012/article/details/51700367

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!