??xml version="1.0" encoding="utf-8" standalone="yes"?>91成人免费电影,91福利国产成人精品照片,国产精品观看http://www.aygfsteel.com/hoojo/category/49166.html学习在于U篏Q滴水可以石I!学而不思则|,思而不学则D! zh-cnTue, 31 Jul 2012 12:23:39 GMTTue, 31 Jul 2012 12:23:39 GMT60Ud应用Q手机应用)开发IM聊天E序解决Ҏhttp://www.aygfsteel.com/hoojo/archive/2012/07/31/384441.htmlhoojohoojoTue, 31 Jul 2012 07:16:00 GMThttp://www.aygfsteel.com/hoojo/archive/2012/07/31/384441.htmlhttp://www.aygfsteel.com/hoojo/comments/384441.htmlhttp://www.aygfsteel.com/hoojo/archive/2012/07/31/384441.html#Feedback0http://www.aygfsteel.com/hoojo/comments/commentRss/384441.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/384441.htmlq个解决Ҏ已经定制下来很久了,上一D|间比较忙Q没有时间整q些东西。最q稍微好些,不怎么加班。所以抽Iȝ下,同时也分享给大家Q也是l大家一个借鉴吧!或许qƈ不是最好的解决ҎQ但只要能满_前需求的最好方案也是最好的解决ҎQ谁说不是呢QO(∩_∩)O~

 

我们采用的方案如下:

先看?/p>

xmpp-server-client

上图的流E大致上是这LQ?

手机端向PC端发送聊天内?

1、手机端E序通过Socketq接服务器端的ServerSocket

2、然后服务器端根据手机Mobile客户端发送过来统一规范的报文或聊天内容Q进行解?

3、然后将解析的内容,再用smack框架转发到openfire服务?

4、最后由openfire服务器向客户端(BS、CS、PhoneClientQ程序发送聊天信息。这里的客户端可以是pc上的览器,pc上的桌面应用Q手机应用等

5、PC客户端BSE序Q用http bind方式监听Q的长连接监听到openfire服务器发送过来的数据Q直接在面中显C?/p>

 

同样QPC客户端向手机端发送聊天内?

1、PC客户端(BSQ可以直接用http bindQxmpp 提供的httph的长q接方式Q直接向openfire服务器发送聊天数据;

2、然后openfire服务器接收到聊天内容的时候,q时候socket服务器中的smack框架中有一个聊天内容的监听?

3、监听到PC端向openfire发送的内容后,会用socket的流向手机端发送我们定义好的报文或是聊天内?

4、手机端的socket会不停的轮询Q可以模拟心跛_长连接的方式Q,判断是否有消息到达,如果有则昄

 

而普通的聊天E序的流E则是客L发送信息到openfire服务器,openfire服务器再消息{发给其他客户端。他们省Msocket服务器这部分Q那我们Z么要加上socket服务器这部分呢?

我们q样做也是有自己的道理的Q?

首先Q如果让手机端自己实现向openfire服务器发送程序的代码Q那工作量是相当大的。因为每个手机^C用的语言都不同,每个q_都需要实现向openfire服务器发送聊天信息的报文。这其实是在做重复的工作,而且每个q_实现向手机端发送报文信息的技术会让每个手机端的开发h员都要学会一套和openfire交互的代码。这势必会重复工作、重复相同业务的代码。所以,把这些代码放在一个tcp/ip的socket中{服务器进行统一发送,q也是有好处的?

其次Q把所以发送消息在报文在socket服务器完成,可以对业务进行一个统一的处理、消息过滤?/p>

 

手机端被否决的解x案,供参?/font>

手机端用http长连接的方式Q这个是不行?/p>

其一、手机的Ud|络不稳定,长连接会l常断掉Q当然你可以自动q行重连

其二、长q接一直连接在服务器上Q占用服务器资源。当然你可以使用心蟩式长q接或是轮询方式

其三、手机端一直连接服务器会用手机端用户的网l带宽流量(量不是免费的,客户会怎么惻I

其四、手机端一直连着服务器,Ҏ机的电量也有消耗(现在决电量也是一个问题)



hoojo 2012-07-31 15:16 发表评论
]]>
Spring整合CXFQ发布RSETful 风格WebServicehttp://www.aygfsteel.com/hoojo/archive/2012/07/23/383780.htmlhoojohoojoMon, 23 Jul 2012 08:58:00 GMThttp://www.aygfsteel.com/hoojo/archive/2012/07/23/383780.htmlhttp://www.aygfsteel.com/hoojo/comments/383780.htmlhttp://www.aygfsteel.com/hoojo/archive/2012/07/23/383780.html#Feedback0http://www.aygfsteel.com/hoojo/comments/commentRss/383780.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/383780.html阅读全文

hoojo 2012-07-23 16:58 发表评论
]]>
Spring 3 整合Apache CXF WebServicehttp://www.aygfsteel.com/hoojo/archive/2012/07/13/383042.htmlhoojohoojoFri, 13 Jul 2012 09:47:00 GMThttp://www.aygfsteel.com/hoojo/archive/2012/07/13/383042.htmlhttp://www.aygfsteel.com/hoojo/comments/383042.htmlhttp://www.aygfsteel.com/hoojo/archive/2012/07/13/383042.html#Feedback0http://www.aygfsteel.com/hoojo/comments/commentRss/383042.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/383042.html在CXF2版本中,整合Spring3发布CXF WebService更加简单了。因为Spring 3提供了annotation注解Q而CXF2发布WebService已经不像之前版本的配|那P参考老版本发布WebServicepd文章Q?a title="http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.html" >http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.htmlQ,现在发布一个WebService可以直接从Spring的IoC容器中拿C个对象,发布成WebService服务。当然发布WebService的配|有了些小的变动,具体请往下看?/p>

 

在老版本中发布一个WebServiceQ配|applicationContext-server.xml文g中添加如下配|如下:

jaxws:server的发布方?/p>

<bean id="userServiceBean" class="com.hoo.service.ComplexUserService"/>
 
<bean id="inMessageInterceptor" class="com.hoo.interceptor.MessageInterceptor">
    <constructor-arg  value="receive"/>
</bean>
 
<bean id="outLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<!-- 注意下面的addressQ这里的address的名U就是访问的WebService的name -->
<jaxws:server id="userService" serviceClass="com.hoo.service.IComplexUserService" address="/Users">
    <jaxws:serviceBean>
        <!-- 要暴露的 bean 的引?-->
        <ref bean="userServiceBean"/>
    </jaxws:serviceBean>
    <jaxws:inInterceptors>
        <ref bean="inMessageInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
        <ref bean="outLoggingInterceptor"/>
    </jaxws:outInterceptors>
</jaxws:server>

jaxws:endpoint的发布方?/p>

<!-- com.hoo.service.ComplexUserService是com.hoo.service.IComplexUserService接口的实玎ͼ q种Ҏ应该不能从Ioc中引用对?-->
<jaxws:endpoint id="userService2" implementor="com.hoo.service.ComplexUserService" address="/Users">
    <jaxws:inInterceptors>
        <ref bean="inMessageInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
        <ref bean="outLoggingInterceptor"/>
    </jaxws:outInterceptors>
</jaxws:endpoint>

而在2.x新版本中Q发布Ioc容器中的对象Z个WebService的方?/p>

<bean id="userServiceBean" class="com.hoo.service.ComplexUserService"/>
 
<bean id="inMessageInterceptor" class="com.hoo.interceptor.MessageInterceptor">
    <constructor-arg  value="receive"/>
</bean>
 
<bean id="outLoggingInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
<!-- 注意下面的addressQ这里的address的名U就是访问的WebService的nameQ?userServiceBean是直接引用Ioc容器中的Bean对象 -->
<jaxws:server id="userService" serviceBean="#userServiceBean" address="/Users">
    <jaxws:inInterceptors>
        <ref bean="inMessageInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
        <ref bean="outLoggingInterceptor"/>
    </jaxws:outInterceptors>
</jaxws:server>
<!-- 或者这U方式,在老版本中q个是不能引用Ioc容器中的对象Q但?.x中可以直接用#id?name的方式发布服?-->
<jaxws:endpoint id="userService2" implementor="#userServiceBean" address="/Users">
    <jaxws:inInterceptors>
        <ref bean="inMessageInterceptor"/>
    </jaxws:inInterceptors>
    <jaxws:outInterceptors>
        <ref bean="outLoggingInterceptor"/>
    </jaxws:outInterceptors>
</jaxws:endpoint>

CXF发布WebService官方参考:http://cxf.apache.org/docs/writing-a-service-with-spring.html



hoojo 2012-07-13 17:47 发表评论
]]>
在Spring、Hibernate中用Ehcache~存http://www.aygfsteel.com/hoojo/archive/2012/07/12/382860.htmlhoojohoojoThu, 12 Jul 2012 02:48:00 GMThttp://www.aygfsteel.com/hoojo/archive/2012/07/12/382860.htmlhttp://www.aygfsteel.com/hoojo/comments/382860.htmlhttp://www.aygfsteel.com/hoojo/archive/2012/07/12/382860.html#Feedback0http://www.aygfsteel.com/hoojo/comments/commentRss/382860.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/382860.html

前一?a title="http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html" href="http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html">http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html介绍了Ehcache整合Spring~存Q用页面、对象缓存;q里介l在Hibernate中用查询缓存、一U缓存、二U缓存,整合Spring在HibernateTemplate中用查询缓存?/p>

EhCache是Hibernate的二U缓存技术之一Q可以把查询出来的数据存储在内存或者磁盘,节省下次同样查询语句再次查询数据库,大幅减轻数据库压力;

EhCache的用注意点

当用Hibernate的方式修改表数据(save,update,delete{等)Q这时EhCache会自动把~存中关于此表的所有缓存全部删除掉(q样能达到同?。但对于数据l常修改的表来说Q可能就失去~存的意义了(不能减轻数据库压?Q?

在比较少更新表数据的情况下,EhCache一般要使用在比较少执行write操作的表(包括update,insert,delete{?[Hibernate的二U缓存也都是q样]Q对q发要求不是很严格的情况下,两台机子中的~存是不能实时同步的Q?/p>

 

首先要在hibernate.cfg.xml配置文g中添加配|,在hibernate.cfg.xml中的mapping标签上面加以下内容:

<!--  Hibernate 3.3 and higher -->  
<!--   
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheRegionFactory</property>
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</property>
-->  
<!-- hibernate3.0-3.2 cache config-->  
<!--    
<property name="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.EhCacheProvider</property>  
-->  
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</property>  
           
<!-- Enable Second-Level Cache and Query Cache Settings -->  
<property name="hibernate.cache.use_second_level_cache">true</property>  
<property name="hibernate.cache.use_query_cache">true</property>

 

如果你是整合在spring配置文g中,那么你得配置你的applicationContext.xml中相关SessionFactory的配|?

<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>

 

然后在hibernate.cfg.xml配置文g中加入用缓存的属?

<!-- class-cache config -->  
<class-cache class="com.hoo.hibernate.entity.User" usage="read-write" />

 

当然你也可以在User.hbm.xml映射文g需要Cache的配|class节点下,加入cM如下格式信息Q?

<class name="com.hoo.hibernate.entity.User" table="USER" lazy="false">
<cache usage="transactional|read-write|nonstrict-read-write|read-only" />
注意Qcache节点元素应紧跟class元素

 

关于选择~存{略依据Q?

ehcache不支持transactionalQ其他三U可以支持?/strong>

read- onlyQ无需修改Q?可以对其q行只读~存Q注意:在此{略下,如果直接修改数据库,即能够看到前台昄效果Q但是将对象修改至cache中会报errorQcache不会发生作用。另Q删除记录会报错Q因Z能在read-only模式的对象从cache中删除?

read-writeQ需要更新数据,那么使用?写缓存比较合适,前提Q?em>数据库不可以为serializable transaction isolation levelQ序列化事务隔离U别Q?/em>

nonstrict-read-writeQ只偶尔需要更新数据(也就是说Q两个事务同时更新同一记录的情况很不常见)Q也不需要十分严格的事务隔离Q那么比较适合使用非严D/写缓存策略?/p>

 

如果你用的注解方式Q没有User.hbm.xmlQ那么你也可以用注解方式配置~存

@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)   
public class User implements Serializable {
}

 

在Dao层用cacheQ代码如?

Session s = HibernateSessionFactory.getSession();
Criteria c = s.createCriteria(User.class);
c.setCacheable(true);//q句必须要有
System.out.println("W一ơ读?);
List<User> users = c.list();
System.out.println(users.size());
HibernateSessionFactory.closeSession();
 
s = HibernateSessionFactory.getSession();
c = s.createCriteria(User.class);
c.setCacheable(true);//q句必须要有
System.out.println("W二ơ读?);
users = c.list();
System.out.println(users.size());
HibernateSessionFactory.closeSession();

你会发现W二ơ查询没有打印sql语句Q而是直接使用~存中的对象?

如果你的Hibernate和Spring整合在一P那么你可以用HibernateTemplate来设|cache

getHibernateTemplate().setCacheQueries(true);
return getHibernateTemplate().find("from User");

当你整合SpringӞ如果你的HibernateTemplate模板配置在Spring的Ioc容器中,那么你可以这样启用query cache

<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory">
       <ref bean="sessionFactory" />
    </property>
    <property name="cacheQueries">
       <value>true</value>
    </property>
</bean>

此后Q你在dao模块中注入sessionFactory的地斚w注入hibernateTemplate卛_?

 

以上讲到的都是Spring和Hibernate的配|,下面主要l合上面使用的ehcacheQ来完成ehcache.xml的配|。如果你没有配置ehcacheQ默认情况下使用defaultCache的配|?

<cache name="com.hoo.hibernate.entity.User" maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300" timeToLiveSeconds="600" overflowToDisk="true" />
<!--
hbm文g查找cacheҎ名的{略Q如果不指定hbm文g中的region="ehcache.xml中的name的属性?Q则使用name名ؓcom.hoo.hibernate.entity.User的cacheQ如果不存在与类名匹配的cache名称Q则?defaultCache?/span>
如果User包含set集合Q则需要另行指定其cache
例如User包含citySet集合Q则需?/span>
d如下配置到ehcache.xml?/span>
-->
<cache name="com.hoo.hibernate.entity.citySet"
maxElementsInMemory="10000" eternal="false" timeToIdleSeconds="300"
timeToLiveSeconds="600" overflowToDisk="true" />

 

如果你用了Hibernate的查询缓存,需要在ehcache.xml中加入下面的配置

<cache name="org.hibernate.cache.UpdateTimestampsCache"
    maxElementsInMemory="5000" 
    eternal="true" 
    overflowToDisk="true" />
<cache name="org.hibernate.cache.StandardQueryCache"
    maxElementsInMemory="10000" 
    eternal="false" 
    timeToLiveSeconds="120"
    overflowToDisk="true" />

调试时候用log4j?strong>log4j.logger.org.hibernate.cache=debugQ更方便看到ehcache的操作过E,主要用于调试q程,实际应用发布时候,h释掉Q以免媄响性能?/p>

使用ehcacheQ打印sql语句是正常的Q因为query cache讄为true会创徏两个~存区域Q一个用于保存查询结果集 (org.hibernate.cache.StandardQueryCache)Q?另一个则用于保存最q查询的一pd表的旉?org.hibernate.cache.UpdateTimestampsCache)。请注意Q在查询~存中,它ƈ不缓存结果集中所包含的实体的切状态;它只~存q些实体的标识符属性的倹{以及各值类型的l果?strong>需要将打印sql语句与最q的cache?容相比较Q将不同之处修改到cache中,所以查询缓存通常会和二~存一起用?/strong>



hoojo 2012-07-12 10:48 发表评论
]]>
Ehcache 整合Spring 使用面、对象缓?/title><link>http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html</link><dc:creator>hoojo</dc:creator><author>hoojo</author><pubDate>Thu, 12 Jul 2012 02:15:00 GMT</pubDate><guid>http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html</guid><wfw:comment>http://www.aygfsteel.com/hoojo/comments/382852.html</wfw:comment><comments>http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/hoojo/comments/commentRss/382852.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/hoojo/services/trackbacks/382852.html</trackback:ping><description><![CDATA[     摘要: Ehcache在很多项目中都出现过Q用法也比较单。一般的加些配置可以了Q而且Ehcache可以寚w面、对象、数据进行缓存,同时支持集群/分布式缓存。如果整合Spring、Hibernate也非常的单,Spring对Ehcache的支持也非常好。EHCache支持内存和磁盘的~存Q支持LRU、LFU和FIFO多种淘汰法Q支持分布式的CacheQ可以作为Hibernate的缓存插件。同时它也能...  <a href='http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html'>阅读全文</a><img src ="http://www.aygfsteel.com/hoojo/aggbug/382852.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/hoojo/" target="_blank">hoojo</a> 2012-07-12 10:15 <a href="http://www.aygfsteel.com/hoojo/archive/2012/07/12/382852.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Jwchat 的安装和配置、Service unavailable、Authorization failed问题汇?/title><link>http://www.aygfsteel.com/hoojo/archive/2012/05/17/378444.html</link><dc:creator>hoojo</dc:creator><author>hoojo</author><pubDate>Thu, 17 May 2012 14:05:00 GMT</pubDate><guid>http://www.aygfsteel.com/hoojo/archive/2012/05/17/378444.html</guid><wfw:comment>http://www.aygfsteel.com/hoojo/comments/378444.html</wfw:comment><comments>http://www.aygfsteel.com/hoojo/archive/2012/05/17/378444.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/hoojo/comments/commentRss/378444.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/hoojo/services/trackbacks/378444.html</trackback:ping><description><![CDATA[<p>上一介l了Openfire开源聊天IM服务器的安装Q?a title="http://www.cnblogs.com/hoojo/archive/2012/05/17/2506769.html" >http://www.cnblogs.com/hoojo/archive/2012/05/17/2506769.html</a></p> <p>q篇文章介绍Jwchat的安装和配置</p> <p> </p> <p>首先Jwchat的配|和安装需要具备的环境Q? <p>Tomcat 5.0.28+/Tomcat 6 <p>JDK 1.6+ <p>Openfire 3.7.1 <p>1?下蝲jwchat工程文g <p>下蝲站点Q?a >http://blog.jwchat.org/jwchat/download/</a> <p>Zip下蝲Q?a >http://downloads.sourceforge.net/jwchat/jwchat-1.0.zip?use_mirror</a>= <p>  <p>2?下蝲完成后,jwchat-1.0.zip解压C的tomcat的webapps目录Q将jwchat-1.0命名为jwchatQ如果不q样的话Q可能会出现错误Q如Authorization failed。至这样会方便你访问jwchat工程? <p>然后index.html.zh_CN{这样带?.后缀.zh_CN的这L文g?zh_CN都删掉,q行重命名?zh_CN是表CZ文版的,当然你也可以直接?.后缀.后缀的文件进行重命名Q那样就是默认的英文版的了? <p>扚w命名工具c: <div class="wmqeeuq" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">package com.hoo.util;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">import java.io.File;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000">/**</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * <b>function:</b> 文g命名工具c?/span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @author hoojo</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @createDate 2012-5-14 下午01:58:14</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @file FileRenameUtils.java</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @package com.hoo.util</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @blog http://blog.csdn.net/IBM_hoojo</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @email hoojo_@126.com</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @version 1.0</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> */</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">abstract</span> <span style="color: #0000ff">class</span> FileRenameUtils {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">private</span> final <span style="color: #0000ff">static</span> String FILE_PATH = <span style="color: #006080">"D:\\apache-tomcat-6.0.33\\webapps\\jwchat"</span>;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #008000">/**</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * <b>function:</b> 指定目录下的文件的typecd的文Ӟq行重命名,命名后的文g去掉type</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * <p>example: 如果type = htmlQ?index.html.html -> index.html</p></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * <p>example: 如果type = zh_CNQ?index.html.zh_CN -> index.html</p></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @author hoojo</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @createDate 2012-5-16 下午02:16:48</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @param path</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> * @param type</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #008000"> */</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> rename(String path, String type) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">if</span> (path == <span style="color: #0000ff">null</span> || <span style="color: #006080">""</span>.equals(path)) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> path = FILE_PATH;</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> File dir = <span style="color: #0000ff">new</span> File(path);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> File[] list = dir.listFiles();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">for</span> (File file : list) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> String name = file.getName();</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> String[] s = name.split(<span style="color: #006080">"\\."</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">if</span> (s.length == 3 && type.equals(s[2])) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> System.<span style="color: #0000ff">out</span>.println(s[0] + <span style="color: #006080">"--"</span> + s[1] + <span style="color: #006080">"--"</span> + s[2]);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> file.renameTo(<span style="color: #0000ff">new</span> File(path + <span style="color: #006080">"/"</span> + s[0] + <span style="color: #006080">"."</span> + s[1]));</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> main(String[] args) {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> FileRenameUtils.rename(<span style="color: #006080">"D:\\apache-tomcat-6.0.33\\webapps\\jwchat"</span>, <span style="color: #006080">"zh_CN"</span>);</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre><!--CRLF--></div></div> <p>3?下蝲JabberHTTPBindq个包,因ؓ直接下蝲的jwchat没有WEB-INF、web.xml是无法运行的? <p>JabberHTTPBind是jwchatq行http bind通信的一U方式,它可以让jwchat和openfireq行链接通信? <p>站点Q?a >http://blog.jwchat.org/jhb/</a> <p>下蝲地址Q?a >http://blog.jwchat.org/download/JabberHTTPBind-1.1.1.zip</a> <p>JabberHTTPBind会依赖xalan的library? <p>下蝲站点Q?a >http://xml.apache.org/xalan-j/downloads.html</a> <p>下蝲目录Q?a >http://labs.renren.com/apache-mirror/xml/xalan-j/</a> <p>  <p>4?下蝲完成后,JabberHTTPBind的zip解压出来的WEB-INF、META-INF一q放到刚才的jwchat目录中,q且刚才下载的xalan的xalan.jar,serializer.jar, xercesImpl.jar, xml-apis.jar攑ֈwebapps\jwchat\WEB-INF\lib目录下即可? <p>  <p>5?修改jwchat目录中的相关配置 <p>修改config.js文g <div class="wmqeeuq" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">var</span> BACKENDS = </pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">[</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> …?/pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> …?/pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> name:<span style="color: #006080">"Open Relay"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> description:<span style="color: #006080">"HTTP Binding backend that allows connecting to any jabber server"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> httpbase:<span style="color: #006080">"/JHB/"</span>, <span style="color: #008000">/* 修改q里为:/jwchat/JHB/ */</span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> type:<span style="color: #006080">"binding"</span>,</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> default_server: SITENAME</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> },</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> {</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> …?/pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> }</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px">];</pre><!--CRLF--></div></div> <p>修改WEB-INF目录下的web.xml文g <div class="wmqeeuq" id="codeSnippetWrapper"> <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff"><</span><span style="color: #800000">servlet-mapping</span><span style="color: #0000ff">></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff"><</span><span style="color: #800000">servlet-name</span><span style="color: #0000ff">></span>Jabber HTTP Binding Servlet<span style="color: #0000ff"></</span><span style="color: #800000">servlet-name</span><span style="color: #0000ff">></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #0000ff"><</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">></span>/<span style="color: #0000ff"></</span><span style="color: #800000">url-pattern</span><span style="color: #0000ff">></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> url-pattern修改为:/JHB/</pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"> <span style="color: #008000"><!-- q里的修改主|对应上面的config.jsQ如果config.js的httpbase配置?jwchat/Q那q里的就不用修改?--></span></pre><!--CRLF--><pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 10pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff"></</span><span style="color: #800000">servlet-mapping</span><span style="color: #0000ff">></span></pre><!--CRLF--></div></div> <p>6?启动tomcat后,讉K<a href="http://localhost:8080/jwchat/">http://localhost:8080/jwchat/</a> <p>如果d出现Service unavailableq个问题Q那么会有以下几U情况: <p>A?表明服务器不可用Q可能是openfire服务器没有启动, <p>B?webapps\jwchat \config.js的配|有问题Q如var SITENAME = "localhost";和openfire服务器地址没有对应 <p>C?伴随出现QException in thread "Thread-34" javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found异常Q可能是tomcat版本低于tomcat6或是jwchat~少相应的jar包,如缺xml的serializer.jar、xalan.jar、xercesImpl.jar、xml-apis.jar <p>D、如果在满了c步骤Q有djra包还出现Exception in thread "Thread-34" javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found异常Q徏议删除tomcat/work目录下的~存Q然后重启tomcat试试 <p>  <p>7?如果d出现Authorization failed验证p|Q那么有以下几种可能的情况: <p>A?用户没有注册 <p>B?openfire的证书(C:\Program Files\openfire\resources\securityQ没有安装到相应的jdk的C:\Program Files\Java\jre6\lib\security目录? <p>如果出现q种异常信息Qjavax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed也表明是安全证书的问题; <p>关于解决ssl验证Q网上有在jsjac.js中的if(this.has_sasl) q行前面加上this.has_sasl = false;来取消ssl安全证书的验证? <p>C?如果你的工程名称不是jwchatQ徏议把它修Ҏjwchatq且修改config.xml的相关链接的配置QhttpbaseQ? <p>D?q有可能是你当前的用h有注册,q个时候你可以注册一个用h是在openfire控制台的用户l中d一个用P然后再等了看看是否存在这个问题? <p>  <p>8?修改服务器名U? <p>点击服务器à服务器理器à编辑属?修改服务器名U? <p><a href="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_10.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_thumb_4.png" width="562" height="177"></a> <p>修改后的服务器名U? <p><a href="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_8.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_thumb_3.png" width="342" height="196"></a> <p>出现叹号Q我们要删除安全证书Q点L务器à服务器设|à服务器安全证书删掉q里的证书? <p><a href="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_thumb_2.png" width="562" height="69"></a> <p>删除后,在当前页面会出现提示Q然后按照提C点ȝ应的链接Q重启服务器Q然后登陆,再生成证? <p><a href="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_thumb_1.png" width="281" height="81"></a> <p>生成证书需要点旉Q然后生成完成后Q手动重启openfire服务器,再次登陆发现警告没有了? <p>  <a href="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.aygfsteel.com/images/blogjava_net/hoojo/WindowsLiveWriter/JwchatServiceunavailableAuthorizationfai_11CE2/image_thumb.png" width="316" height="186"></a> <p>9?在服务器端增加配|? <p>xmpp.httpbind.client.requests.polling = 0 <p>xmpp.httpbind.client.requests.wait = 10 <img src ="http://www.aygfsteel.com/hoojo/aggbug/378444.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/hoojo/" target="_blank">hoojo</a> 2012-05-17 22:05 <a href="http://www.aygfsteel.com/hoojo/archive/2012/05/17/378444.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Openfire 的安装和配置http://www.aygfsteel.com/hoojo/archive/2012/05/17/378440.htmlhoojohoojoThu, 17 May 2012 12:03:00 GMThttp://www.aygfsteel.com/hoojo/archive/2012/05/17/378440.htmlhttp://www.aygfsteel.com/hoojo/comments/378440.htmlhttp://www.aygfsteel.com/hoojo/archive/2012/05/17/378440.html#Feedback0http://www.aygfsteel.com/hoojo/comments/commentRss/378440.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/378440.html1?下蝲最新的openfire安装文g

官方下蝲站点Q?a >http://www.igniterealtime.org/downloads/index.jsp#openfire

下蝲地址Q?

ExeQ?a >http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_3_7_1.exe

ZIP: http://www.igniterealtime.org/downloads/download-landing.jsp?file=openfire/openfire_3_7_1.zip

我用的是zip解压版的安装文g?

其中openfire是服务器Q下面还有一个sparkQ这个是一个XMPP协议通信聊天的CS的IM软gQ它可以通过openfireq行聊天对话?

 

2?下蝲完成后,如果你下载的是exe文gQ执行你的安装文Ӟq行安装。这里我是zip的文件。解压后Q复制openfire目录到C:\Program Files\目录下;一定要在C:\Program Files\目录下的Q这样openfire安装完成了?

 

3?下面我们启动openfire服务器,q|它。在C:\Program Files\openfire\bin目录下有一个电灯的openfire.exe文gQ双L行,启动完成后可以看?

image

4?点击Launch Admin按钮q入http://127.0.0.1:9090/setup/index.jsp面Q配|openfire服务?

 

5?选择语言 中文?

image

点击continueq入

 

6?配置服务器域?

image

如果你是本地讉KQ那么你可以不修Ҏ是用localhost?27.0.0.1的方?

如果你用于外|或局域网讉KQ那么你的地址配置成外|或局域网地址

 

7?选择数据?

image

选择openfire自带的,当然你也可以选择你的数据库类型。如Oracle、SQLServer、MySQL{。如果openfire没有带jdbc的连接驱动,你需要添加连接数据库的jdbc驱动Q驱动放在C:\Program Files\openfire\lib目录?

 

8?选择Ҏ配|,默认卛_

image

 

9?理员邮Ӟ可以跌q步

image

 

10?安装完成

image

q入理员控制台面

 

11?q入http://127.0.0.1:9090/login.jsp面后,输入admin、密码admin登陆q入

image

 

12?q入后可以看?

image

服务器名U就是jwchat的连接地址Q你可以使用Spark、jwchat链接q个地址q行IM通信聊天…?

xQopenfire的安装和配置已经完成。下一文章开始完成jwchat的安装和配置?

如果你需要更换服务器名称ipQ请看下一文章!

hoojo 2012-05-17 20:03 发表评论
]]>
BlazeDS 整合 Flex HelloWorld CZhttp://www.aygfsteel.com/hoojo/archive/2011/09/16/358798.htmlhoojohoojoFri, 16 Sep 2011 07:24:00 GMThttp://www.aygfsteel.com/hoojo/archive/2011/09/16/358798.htmlhttp://www.aygfsteel.com/hoojo/comments/358798.htmlhttp://www.aygfsteel.com/hoojo/archive/2011/09/16/358798.html#Feedback2http://www.aygfsteel.com/hoojo/comments/commentRss/358798.htmlhttp://www.aygfsteel.com/hoojo/services/trackbacks/358798.html开发环境:

SystemQWindows

WebBrowserQIE6+、Firefox3+

JavaEE ServerQtomcat5.0.2.8、tomcat6

IDEQeclipse、MyEclipse 8

Flex IDEQFlash Builder 4

BlazeDSQ?.5

开发依赖库Q?

JavaEE5、blazeDS 4.5

EmailQhoojo_@126.com

BlogQ?a >http://blog.csdn.net/IBM_hoojo

http://hoojo.cnblogs.com/

 

一、准备工?/h4>

1?首先要提供相关的jar?

Java服务器端需要提供BlazeDS相关的配|和jar?

下蝲地址Q?a >http://opensource.adobe.com/wiki/display/blazeds/download+blazeds+trunk

下蝲后,解压你可以看到这L一个目?

clip_image002

Docs是文档

Resource是源?

SampleDB是示例用的数据库Q可以运行startdb.bat来启动数据库

Tomcat是内|的tomcatQ如果你没有tomcat的话可以使用它,在tomcat的webapps目录中有samplesCZ

blazeds.war是blazeDS的核心文件、库Q你可以把这个war攑ֈtomcat的webapps目录下,׃自动解压。当然你也可以自己手动解压?

Blazeds-spring.war是和spring整合的配|?

Ds-console.war是blazeDS的控制台E序

Samples.war是官Ҏ供的CZ

Samples-spring.war是spring和blazeDS的整合示?

二、部|服务器端程?/h5>

1、新Z个JavaWeb Project工程Q然后在WEB-INF/lib目录中添加如下jar?

clip_image004

q些jar包可以在blazeds.war包中的lib目录中可以找?

2?然后你需要将blazeds.war包中的WEB-INF目录下的flex目录复制到当前工E的WEB-INF?

3?blazeds.war包中的WEB-INF目录下的web.xml的配|,d到当前工E的web.xml文g?

4?最后基本的样式如下

clip_image006

5?最后你发布当前工程Q如果没有错误就表明你服务器端部|成功了?

6?~写一个HelloWorld的javaE序。代码如?

package com.hoo.flex;
 
/**
 * <b>function:</b> HelloWorld Example
 * @author hoojo
 * @createDate 2011-8-31 下午06:11:27
 * @file HelloWorld.java
 * @package com.hoo.flex
 * @project BlazeDSServer
 * @blog http://blog.csdn.net/IBM_hoojo
 * @email hoojo_@126.com
 * @version 1.0
 */
public class HelloWorld {
    
    public HelloWorld() {
    }
    
    public String sayHello(String name) {
        return "[" + name + "] say hello!";
    }
}

׃个sayHelloҎQ接收一个参数?

三、Flex客户端程?/h5>

1、创Z个Flex工程Q在选择服务器技术的时候,你需要选择J2EE。然后勾上用J2EE技术,然后选择BlazeDS。点击Next下一?

clip_image008

2、配|根文g夹,也就是JavaEE服务器端发布E序在tomcat中的位置。我q里是在tomcat的webapps的BlazeDSServer中,BlazeDSServer是我的服务器端程序。根URL是访问服务器端程序的urlQ上下文目录对应工程名称Q最后就是输出文件夹目录Q这个是Flex的文件最后在tomcat中保存的目录?

clip_image010

3、最后你需要设|服务器端的services-config.xml的\径到~译参数中,q个很重要!如果你不讄的话Q那么你在后面用RemoteObject调用BlazeDS的时候,需要设|endpoint。设|如下:

clip_image012

-services是参数键Q后面的字符串是倹{我q里是设|BlazeDSServer发布到tomcat目录中的services-config.xml的\径?

4、编译Flex前端代码Q代码如下:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" viewSourceURL="BlazeDSHelloWorld.mxml" layout="absolute" minWidth="955" minHeight="600">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.rpc.AsyncToken;
            import mx.rpc.events.ResultEvent;
            
            private function faultHandler(event: Event): void {
                Alert.show(event.toString(), event.type);
            }
            
            private function resultHandler(event: ResultEvent): void {
                //event.result是服务器端返回对?/pre>
                result.text = "MessageQ? + event.result.toString();
            }
            
            private function sendHandler(): void {
                helloRemoteObject.sayHello(userName.text);
            }        
        ]]>
    </mx:Script>
    
    <!-- 当工E没有设|编译器-service参数 或是-context-root{参敎ͼ需要手动设|endpoint参数 -->
    <mx:RemoteObject 
        id="helloRemoteObject" 
        destination="helloWorld" 
        fault="faultHandler(event)" 
        result="resultHandler(event)"
        showBusyCursor="true"/>
    <mx:Panel x="10" y="10" width="272" height="148" layout="absolute" title="BlazeDS Remote HelloWorld Sample">
        <mx:Label x="10" y="22" text="误入名U?/>
        <mx:TextInput x="70" y="19" id="userName"/>
        <mx:Button x="184" y="45" label="发? click="sendHandler()"/>
        <mx:Text x="10" y="79" id="result"/>
    </mx:Panel>    
</mx:Application>

首先你需要将Java服务器端的HelloWorldE序配置在flex的remoting-config.xml中,配置如下Q?

<?xml version="1.0" encoding="UTF-8"?>
<service id="remoting-service" 
    class="flex.messaging.services.RemotingService">
 
    <adapters>
        <adapter-definition id="java-object" class="flex.messaging.services.remoting.adapters.JavaAdapter" default="true"/>
    </adapters>
    
    <default-channels>
        <channel ref="my-amf"/>
    </default-channels>
    
    <destination id="helloWorld">    
        <properties>    
            <source>com.hoo.flex.HelloWorld</source>    
        </properties>    
    </destination> 
</service>

上面mxml代码中的RemoteObject的destination对应的就是remoting-config.xml配置文g中的destination的id。这个是一一对应的,然后在sendHandlerҎ中,helloRemoteObject对应的就是RemoteObject的idQ而sayHelloҎ对应的就是配|在remoting-config.xml中的destination的source的Java服务器端代码的公有方法。添加完配置后,需要重启tomcat?

q行上面的flexE序后,如果输入参数后,点击发送,可以看到服务器端q回的消息就说明BlazeDS整合Flex成功了?

hoojo 2011-09-16 15:24 发表评论
]]> վ֩ģ壺 | ¡| ʲ| | Ӧ| ں| | | ɽ| | | | | | | | °Ͷ| | | ۶| | | | | ɽ| ƺ| ¤| ڽ| | | ɽ| | | Ӧ| ɽ| | ϼ| | | | |