#
http://wiki.opensymphony.com/display/WW/Action+configuration
Since Webwork 2.2.1 you are also able to specify a default action to be executed when no other action is matched in the xwork.xml. This feature is provided mainly to eliminate the need to create an action class and/or element for very simple or similar results. The default action name can be set inside the package element like below:
<default-action-ref name="simpleViewResultAction"> Caution
This feature should be configured such that there is only one default action per namespace. Therefore if you have multiple packages declaring a default action with the same namespace, it is not guaranteed which action will be the default.
因没有安装python for svn,一直没能使用trac。感谢python chinese的帮助,特别感谢张俊的帮忙。
python for svn目前最新版本没有2.4的,只有2.3的,感谢张俊提供他自己编译的python2.4版本。
谢谢!
下载:
http://www.blogjava.net/Files/martinx/svn-win32-1.2.0_py2.4.rar
收藏一篇文章:http://ayiiq180.blogeden.cn/post/16101/3723
用svn几个月管理现在的项目了,虽然是个windows的项目并且windows下也有svn的前端工具了,不过看到了Trac的介绍还是忍不住装上了,Timeline,Roadmap,Milestone,wiki,Ticket都给开发交流提供了很大的便利。
- 安装前准备,Trac是用python写的,所以所有安装的前提就是python必须安装了,由于svn with python bind只有for python2.3的,所以整个安装也只能用python2.3.5了,我试验了一下python2.4.2,到使用libsvn的地方就会出错了,共需要如下软件包:
Trac 0.9.3
Clearsilver0.9.14 binaries
Python 2.3.5
Apache 2.0.54 or 2.0.55
Subversion 1.2.3
Python 2.3 Bindings for subversion 1.2.3
docutils 0.4.0
SQLite 3.2.2 这个可以不装,只有在pysqlite不能正常用的时候用这个
PySQLite 1.1.6-py2.3
Diffutils 2.8.7-1这个也是可选组件,但建议安装,否则不能diff源代码
CJKcodecs如果使用GB*的源代码编码,这个必须安装,否则无法显示其中的中文
- 安装
- 安装Python 2.3
- 安装apache
- 安装svn for win32 安装docutils:首先解压,命令行运行
> python setup.py install
- 建立svn仓库,这个不多说了,不过看到一个说法,在windows建立仓库的时候用svnadmin create --fs-type fsfs E:WILDWOLFSVNRepast,说fsfs文件系统是svn在win32上的首选fs。
- 配置apache和svn的绑定:
1)拷贝svn/bin下的所有dll和so文件到apache的modules目录下
2)建立密码文件 htpasswd -cm E:WILDWOLFSVN.htaccess samuel
3) 修改httpd.conf Uncomment:
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
AddHandler cgi-script .cgi
Add:
# Subversion
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
At the end of the httpd.conf
# Subversion
<Location /svn>
DAV svn
# any /svn/foo URL will map to a repository C:/svn/foo
# I've only got it working using SVNPath!!
SVNParentPath E:/WILDWOLF/SVN
AuthType Basic
AuthName "Subversion repository"
AuthUserFile E:/WILDWOLF/SVN/.htaccess
Require valid-user
</Location>
4) 重启apache,测试一下http://localhost:8080/svn/Repast
- 安装svn python bingings,解压下载下来的zip包,拷贝libsvn和svn两个文件夹到python的安装目录下的Lib/site_packages/下,拷贝svn安装目录bin下的所有dll到libsvn下。
- 安装PySQLite
- 安装ClearSilver
- 安装cjkcodecs
- 安装diffutils
- 安装Trac
- 配置
- 修改PythonPath/share/trac/cgi-bin/下的trac.cgi第一行成为自己安装的PathToPython,然后拷贝这个文件到apache的cgi-bin目录下。如果不想拷贝这个文件,可以在httpd.conf中增加:
<Directory "/Path/To/Trac/cgi-bin">
ScriptInterpreterSource Registry-Strict
</Directory>
在windows注册表中增加cgi的运行方式: [HKEY_CLASSES_ROOT.cgiShellExecCGICommand]
@="PathToPythonpython.exe"
- 建立trac DB:到Python23/scripts下运行:
> python trac-admin E:/WILDWOLF/SVN/trac.d
Trac [E:/WILDWOLF/SVN/trac.db]> initenv
按照提示输入项目名称和svn仓库地址等。然后给用户附权限: Trac [E:/WILDWOLF/SVN/trac.db]> permission add samuel TRAC_ADMIN
#此处运行permission list可以看到现有用户的权限和可以使用的权限定义
如果需要显示源代码中的GBK中文,并且安装了cjkcodecs,修改trac.db/conf/trac.ini中的: [trac]
default_charset = GBK
原来utf-8存储的东西不会有影响,一样是utf-8显示。
- 将Trac加到apache中,修改httpd.conf,在最后增加:
# TRAC
Alias /trac "PATH/TO/Python/share/trac/htdocs"
<Location "/cgi-bin/trac.cgi">
SetEnv TRAC_ENV "E:/WILDWOLF/SVN/trac.db"
SetEnv PYTHONPATH "PATH/TO/python"
</Location>
<Location "/cgi-bin/trac.cgi/login">
AuthType Basic
AuthName "Project"
AuthUserFile E:/WILDWOLF/SVN/.htaccess
Require valid-user
</Location>
<Directory "PATH/To/Python/share/trac/htdocs">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
- 重启apache,测试吧:
http://localhost:8080/cgi-bin/trac.cgi
-
Trac的升级,备份老版本的文件后,在python/scripts下执行
> python trac-admin E:svntrac.db upgrade
> python trac-admin E:svntrac.db wiki upgrade
lucene最新版本为1.9,从apache svn中checkout 出来已经包括了Highlighter
测试一下:
package org.apache.lucene.search.highlight;
import junit.framework.TestCase;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Searcher;
import org.apache.lucene.store.RAMDirectory;
import java.io.IOException;
import java.io.StringReader;
/** *//**
* @author martin
*/
public class WordsHighlighterTest extends TestCase {
private IndexReader reader;
RAMDirectory ramDirectory;
final private static String FIELD_NAME = "contents";
final private static String queryString = "索引";
String [] words = {
"1:索引内容结构:Document,以及包含于Document的多个Field索",
"2:索引内容优先性调整因子,boost(可对整个Document或Field指定).",
"3:索引的写入IndexWriter,索引的写入目标Directory,实现包括FsDirectory跟RamDirectory等",
"4:索引创建速度的调整"
};
protected void setUp() throws Exception {
ramDirectory = new RAMDirectory();
IndexWriter indexWriter = new IndexWriter(ramDirectory, new StandardAnalyzer(), true);
for (String s : words) {
addDoc(indexWriter, s);
}
indexWriter.optimize();
indexWriter.close();
reader = IndexReader.open(ramDirectory);
}
private void addDoc(IndexWriter indexWriter, String s) throws IOException {
Document doc = new Document();
doc.add(new Field(FIELD_NAME, s, Field.Store.YES, Field.Index.TOKENIZED, Field.TermVector.YES));
indexWriter.addDocument(doc);
}
public void testSimpleWords() throws Exception {
Query query = new QueryParser(FIELD_NAME, new StandardAnalyzer()).parse(queryString);
query = query.rewrite(reader);
System.out.println("Searching for: " + query.toString(FIELD_NAME));
Searcher searcher = new IndexSearcher(ramDirectory);
Hits hits = searcher.search(query);
Highlighter highlighter = new Highlighter(new SimpleHTMLFormatter("<font color=\"red\">", "</font>"), new QueryScorer(query));
highlighter.setTextFragmenter(new SimpleFragmenter(20));
Analyzer analyzer = new StandardAnalyzer();
for (int i = 0; i < hits.length(); i++) {
String text = hits.doc(i).get(FIELD_NAME);
TokenStream tokenStream = analyzer.tokenStream(FIELD_NAME, new StringReader(text));
String result = highlighter.getBestFragments(tokenStream, text, 2, "");
System.out.println("\t" + result);
}
}
protected void tearDown() throws Exception {
super.tearDown();
}
} 输出:
Searching for: "索 引"
4:
索引创建速度的调整
3:
索引的写入IndexWriter,
索引的写入目标Directory,实现包
1:
索引内容结构:Document,以
索
2:
索引内容优先性调整因子,boost(可对整个Document或Field指