直接开始
步骤一:下载openfire源码
下载地址:http://www.igniterealtime.org/downloads/source.jsp 选中openfire_src_3_8_1.zip,下载(68.74 MB)
步骤二:eclipse导入openfire
将openfire_src_3_8_1.zip解压至eclipse工作区域中
File->New->Java Project取消掉default location的勾选状态,并浏览选择解压好的openfire_src目录。
步骤三:ant编译
在openfire项目导入进来之后,点击Window -> Show View -> Ant然后就会显示出Ant的窗口,在Ant 视图中,单击右键,在弹出的快捷菜单中选择Add Buildfiles在弹出的对话框中,展开openfire_src/build文件夹,选择build目录下的build.xml接下来双击执行openfire[default] (带一个三角符号的那个)
步骤四:配置openfireHome
eclipse中,使用快捷键ctrl+shift+r,查找文件XMPPServer,修改openfireHome
if (openfireHome == null) { try { //openfireHome = verifyHome("..", jiveConfigName).getCanonicalFile(); openfireHome = verifyHome("D:/work/eclipse3.7/workspace/openfire_src/target/openfire", jiveConfigName).getCanonicalFile();//相对路径更改为绝对路径,用于测试服务端是否可运行 dml@2013.4.15 } catch (FileNotFoundException fe) { // Ignore. } catch (IOException ie) { // Ignore. } }
步骤五:设置启动项
弹出一个对话框,在左侧菜单中右键点击Java Application,选择New创建启动配置
1.在Run窗口的Main选项卡中, 修改最上面Name文本框中的值,改成包含要启动的类的工程名openfire_src
(没什么用,就是一个标识,随便起名字。)
2.在Run窗口的Main选项卡中,
project框中填写:openfire_src
Main class 填写:org.jivesoftware.openfire.starter.ServerStarter
点击Apply应用。
3.点击进入Arguments选项卡,在上面那个框(Program arguments:)中填写
-D openfireHome="${workspace_loc:openfire_src}/target/openfire"
其中${workspace_loc:openfire_src} 中的 openfire_src 要根据你的项目名来进行同步修改。
eg.[-D openfireHome="D:/work/eclipse3.7/workspace/openfire_src/target/openfire"]
点击Apply应用。
4.点击进入Classpath选项卡,选中User Entries,然后点击右侧的Advanced按钮,会弹出一个小框,选择Add Folders,单击OK。
选择 openfire_src\src\i18n点OK 按钮将这个文件夹加入到Classpath选项卡中
选择 openfire_src\src\resources\jar 目录也加到 Classpath选项卡中
点击Apply应用。
5.点击进入Common选项卡中,勾选Run复选框。
点击Apply应用,run
步骤六:测试服务端是否搭建完毕
浏览器中输入http://127.0.0.1:9090
完
dml@2013.4.15
由于目前项目中使用了Spring Security 2.0.1 权限管理框架,登入成功后可能就需要处理些登录日志等等后续操作,Security 3之后只需要在form-login中添加authentication-success-handler-ref即可,一般是authentication-success-handler实现AuthenticationSuccessHandler的onAuthenticationSuccess方法。那在2.0下应该怎么做呢?
关键代码 ProviderManager 类中 在 doAuthentication 授权成功的时候,创建了授权成功事件。 触发登录成功后置业务 就是 监听该事件并做相关操作。
if (result != null) { sessionController.registerSuccessfulAuthentication(result); publishEvent(new AuthenticationSuccessEvent(result)); return result; }
public abstract class AbstractAuthenticationEvent extends ApplicationEvent { //~ Constructors =================================================================================================== public AbstractAuthenticationEvent(Authentication authentication) { super(authentication); } //~ Methods ======================================================================================================== /** * Getters for the <code>Authentication</code> request that caused the event. Also available from * <code>super.getSource()</code>. * * @return the authentication request */ public Authentication getAuthentication() { return (Authentication) super.getSource(); } }
由上面源代码实现授权成功事件监听器
:
public class LoginSuccessListener implements ApplicationListener { public void onApplicationEvent(ApplicationEvent event) { if (event instanceof AuthenticationSuccessEvent) { AuthenticationSuccessEvent authEvent = (AuthenticationSuccessEvent) event; UserDetails user = (UserDetails) authEvent.getAuthentication().getPrincipal(); System.out.println("模拟输出用户登录日志:[" + java.util.Calendar.getInstance().getTime() + "] " + user.getUsername()); } } }
在Spring中加入 监听器:<bean class="LoginSuccessListener"></bean>
登出就只需要配置下就可以
<logout logout-url="/j_logout" logout-success-url="/login/login.html"/>
主要类:org.springframework.security.ui.logout.LogoutFilter、org.springframework.security.config.LogoutBeanDefinitionParser
本篇是新手自己写的一点心得.建议新手看看.同时希望前辈多多指教.
写这篇的动机:在网上找了一上午的windbg配置符号教程.楞是没找到详细的,都讲的太
模糊而且互相抄袭.不适合新手看.终于靠自己的努力弄懂了一点,呵呵写出来新手们分
享.
安装与配置windbg的symbol(符号)
第一步 是从 http://www.microsoft.com/ddk/debugging 下载最新版本的 WinDBG,
因为符号服务器二进制文件是由 WinDBG 小组开发的。您将需要检查是否有 WinDBG
更新版本,因为该小组似乎具有相当紧凑的发布日程安排,并且每隔几个月就会发布
更新版本。
第二步 双击下载的文件安装windbg.安装时注意记住安装到那里了.
第三步 windbg访问符号需要两个文件(SYMSRV.DLL 和 SYMSTORE.EXE)所以添加主path
环境变量中它们的路径进去,即:你的windbg安装目录.
操作方法:在桌面我的电脑点右键--属性--高级--环境变量,在系统变量列表框中找到
path双击,在变量值最后面加一个分号再把你的安装目录写上.点确定. 这一步是告诉
windbg那两个文件放在什么地方.
第四步 新建一个环境变量_NT_SYMBOL_PATH 值为: SRV*c:\mysymbol* http://msdl.microsoft.com/download/symbols
操作方法:桌面我的电脑点右键--属性--高级--环境变量 ,点击新建,把上面的变量名
和变量值填上.这一步的意思是说告诉windbg,我的符号文件存放在c:mysymbol中(当然
其实里面什么也没有,甚至这个文件夹也不存在,不过没关系,系统找不到的话会给你创
建一个,并在上面的网址中去帮你下载符号文件放在里面)
第五步 重启计算机,再运行运行windbg 打开一个exe文件或者附加到一个进程里去, 你会看到
Symbol search path is: SRV*c:\mysymbol* http://msdl.microsoft.com/download/symbols
打开c盘看到有一个新目录mysymbol,里面有windbg新下载的文件.
恭喜说明配置成功了.