Monday, December 30, 2013

openfire and jwchat support bosh - setup log

1.setup openfire

1.1downlaod openfire setup program

http://www.igniterealtime.org/downloads/index.jsp

1.2extract openfire files

extract openfire_3_8_2.zip to c:\program files\

image

1.3 setup

C:\Program Files\openfire\bin\openfire.exe

image

click "Launch Admin", or open url : http://127.0.0.1:9090

image

click "continue"

image

change domain value:"localhost",click "continue"

image

click "Embedded Database",click "continue"

image

click "continue"

image

input "New Password:" and "Confirm Password:" with same value: "admin",click "continue",then wait some seconds.

image

ok.then click "Login to the admin console"

image

input username and password with:"admin","admin". click "Login"

image

it ok!

1.4 edit openfire to support BoshConnection.

image

click "security settings"

image

checked "Accept self-signed certificates. Server dialback over TLS is now available. " ,click "Save Setting".

1.5 restart openfire

image

click "Stop" then click "Start".

2. setup jwchat

2.1download

download from https://sourceforge.net/projects/jwchat/files/latest/download

2.2 extract

extract jwchat-1.0.zip to [your tomcat server]\webapps\ROOT\jwchat

image

then modify filenames from filename.locale to filename,for example, browsercheck.js.zh_CN => browsercheck.js

and your can used these java tool:(i forget who is author):


package replacejwtfilename;

import java.io.File;

public abstract class Replacejwtfilename {

public static void rename(String path, String type) {
File dir = new File(path);
File[] list = dir.listFiles();
for (File file : list) {
String name = file.getName();
String[] s = name.split("\\.");
if (s.length == 3 && type.equals(s[2])) {
System.out.println(s[0] + "--" + s[1] + "--" + s[2]);
file.renameTo(new File(path + "/" + s[0] + "." + s[1]));
}
}
}

public static void main(String[] args) {
rename("E:\\develop\\xampp\\tomcat\\webapps\\ROOT\\jwchat", "zh_CN");
}
}


2.3 install Jabber HTTP Binding Servlet

download these zip and extract it in webapps\ROOT\WEB-INF\lib\


image


my webapps\ROOT\WEB-INF\web.xml:

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

version="3.0"
metadata-complete="true">

<servlet>
<servlet-name>Jabber HTTP Binding Servlet</servlet-name>
<servlet-class>org.jabber.JabberHTTPBind.JHBServlet</servlet-class>
<!--
<init-param>
<param-name>debug</param-name>
<param-value>1</param-value>
</init-param>
-->
</servlet>

<servlet-mapping>
<servlet-name>Jabber HTTP Binding Servlet</servlet-name>
<url-pattern>/JHB/</url-pattern>
</servlet-mapping>

<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>

</web-app>



2.4 start tomcat


my tomcat server port is 8080,so it address is http://localhost:8080/jwchat/


image


switch " Nativa Binding " => "Open delay", Server:"localhost" username and password your can random input,for example,i input username and password with same value "pkrss",then checked "register new account", click "Login"


image


ok!


3.last webim


3.1 introduction


these project is from where internet sample.it used Jabber HTTP Binding Servlet and JSJaC.js.


it it so simple.so i add these project to here.


3.1 downlaod


download this zip , it used netbeans and can used other java ide.


it run as:


image


4.thanks!

No comments: