#
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.tkk7.com/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指