建立Red5应用程序


下载red5安装包或源码压缩包

eclipse安装red5插件 red5plugin

eclipse建立

 

1. 下载red5安装包或源码压缩包

我是下载压缩包直接解压到某文件夹下的。

Red5官网:http://www.red5.org/

下载地址: http://www.red5.org/downloads/red5/

选择某版本,进去之后选择某一个zip文件下载。我下载了red5.0.9.1.zip

将它解压到某文件夹下

我解压到 /Users/gff/work文件夹下

好了,先放着。

 

2. 安装red5plugin

打开eclipse,选择菜单help下的install new software

在work with里填上插件地址 :

Red5Plugin0.2.x - http://www.red5.org/downloads/projects/red5plugin/update_0.2.x/

在下面的列表里勾选,或者列表下select all,点击next

之后就是等待检索,然后确定安装,没有特殊要选择的

 

3.建立red5应用程序

3.1 建立工程

eclipse选择file->new-> Project ,选择Dynamic Web Project,点击next

 

填上工程名,下面Target Runtime 选择 new Runtime

然后选择Red5 server RunTime

next后,RuntimeDirectory 点击后面的Browse。。然后选择你刚才red5解压到的文件夹

 

next,分别选择你的red5目录下的webapps文件夹,red5.sh文件和red5-shutdown.sh文件。

点击finish 完成,回到原始建立工程的界面,点击finish完成

 

3.2 配置red5应用程序

上面建好后,eclipse的view里的server下面会出现一个red5的server,如果没有,我们新建一个server,在空白处右击,选择new->server

就选择本地的red5server,next

同刚才一样选择你的red5的目录下的对应文件

点击next,选择你刚才新建的工程,点击中间的add添加到右边列表

点击finish完成,这是servers下出现red5 server Runtime

 

server建好了,我们来配置刚才建立的工程

首先把red5的jar包添加到工程

工程,右击build path -> config build path

右边选择 Add External JARs

将red5目录下的red5.jar和red5的lib目录下的所有jar包添加进去,点击ok完成

 

配置最基本的文件

找到工程下的webContent-> WEB-INF ->web.xml

打开,添加

<context-param>

              <param-name>webAppRootKey</param-name>

              <param-value>/Red5test33</param-value>

</context-param>

其中 webAppRootKey固定的,我们不动,/Red5test33是我们的工程路径, Red5test33是工程名

web.xml文件的内容如下:

<?xml version="1.0" encoding="UTF-8"?>

<web-app id="WebApp_ID" version="2.4"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/j2eehttp://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

      <display-name>MultiChat</display-name>

      <welcome-file-list>

            <welcome-file>index.html</welcome-file>

            <welcome-file>index.htm</welcome-file>

            <welcome-file>index.jsp</welcome-file>

            <welcome-file>default.html</welcome-file>

            <welcome-file>default.htm</welcome-file>

            <welcome-file>default.jsp</welcome-file>

      </welcome-file-list>

      <context-param>

            <param-name>webAppRootKey</param-name>

            <param-value>/Red5test33</param-value>

      </context-param>

</web-app>

 

新建文件red5-web.xml,内容可以参考red5目录下的conf目录下的red5-common.xml文件

red5-web.xml内容如下

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

    xmlns:lang="http://www.springframework.org/schema/lang"

    xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsd                           

   http://www.springframework.org/schema/langhttp://www.springframework.org/schema/lang/spring-lang-3.0.xsd">

 

      <bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

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

      </bean>

 

      <bean id="web.context" class="org.red5.server.Context"

            autowire="byType" />

 

      <bean id="web.scope" class="org.red5.server.WebScope"

             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" class="demo.Application" />

</beans>

 

 

你需要修改的是<bean id="web.handler" class="demo.Application" />这句话

class离得内容是我们的住程序所在的地址,这里是demo包下的Applicaton.java

<property name="location" value="/WEB-INF/red5-web.properties"/>这句指定了 webapp.contextPath webapp.virtualHosts,这两的内容放在第三个文件red5-web.properties里,这个文件的名字可以自己指定

 

下面是red5-web.properties文件内容

webapp.contextPath=/Red5test33

webapp.virtualHosts=*,localhost, localhost:8088, 127.0.0.1:8088

 

这里 webapp.contextPath填上你工程上下文路径

好了,我们的应用程序配置完成了,现在是写主程序

工程下建包 demo

报下建立class 继承自 ApplicationAdapter

 

回到上面讲的servers,我们选择刚才建的server,右击,start,服务器就起来了,访问http://locahost:5080 可以访问你的red5

red5服务器这边基本完成了,可以先放着不在主程序里写内容

接下来我们看客户端flex builder

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值