Archive for the ‘RPC’ Category

HessianServlet和HessianProxyFactory的配置参数

星期日, 7月 27th, 2008

HessianServletHessianProxyFactory的配置参数

home-classservice-class,表示Service的实现类的类名

home-apiapi-class,是Service的接口类名

object-class,不太了解
object-api,不太了解,

debug,调试开关,默认为false,需要设置为true的时候,值必须是”true”,区分大小写(不建议设置为true)

send-collection-type,设置SerializerFactory是否在序列化的数据里传递集合类的类型名,默认为true,需要设置为false的时候,
值必须是”false”,区分大小写(不建议设置为false)

其实 SerializerFactory还有个 _isAllowNonSerializable属性,控制是否接受对没有实现 java.io.Serializable接口的对象,
通过setAllowNonSerializable来控制,
默认是不接受,为false,而HessianServlet却没提供这个参数的控制开关,因此如果要支持传输没有实现java.io.Serializable接口的对象,
则需要继承HessianServlet来加上相应控制,重载getSerializerFactory方法来设置参数或增加扩展的SerializerFactory,
而无法通过直接配置HessianServlet的初始化参数来实现。

先前提到的 hessian  3.1.5hession2.0bug ,在hessian 3.1.6里依然存在,在hessian 3.2.0中将被修正.

参考: http://maillist.caucho.com/pipermail/hessian-interest/2008-July/000405.html

ServiceContext存放了线程局部变量request,
ServiceContext.getContextRequest()

HessianProxyFactory 设置的 _isOverloadEnabled 可支持同名重载方法。
不过不建议在接口中使用同名方法和变长参数。
_user_password是设置 http basic认证的用户名和密码。
_isDebug,调试开关
_isHessian2Reply_isHessian2Request,是否使用hessian 2.0协议发送请求。
_isChunkedPost,设置Chunked编码方式发送请求。

Tags: Hessian, RPC

Related posts

cygwin环境下调试thrift的例子

星期五, 7月 18th, 2008
thiftfacebookrpc调用框架,和google protobuf相比,额外多提供了rpc serverclient的框架。
1.下载

http://www.cygwin.com/setup.exe

来源 http://www/cygwin.com
2.双击setup.exe
3.按照安装提示“下一步”
4.选择从“互联网”安装:
5.选择安装的路径为d:\Cygwin,选择本地临时目录d:\Cygwindown,用于存放下载的软件;选择连接互联网的方式,选“直接连接”。
6.选择下载源,直接在URL里输入http://www.cygwin.cn/pub/,点 Add
7.根据安装提示,选择需要安装的软件包,需要选择:
  • Cygwin or MinGW
  • GNU build tools (autoconf 2.60, automake 1.10, libtool 1.5.24)
  • boost 1.33.1+
  • g++ 4.0+
  • bison 2.3-1
  • boost 1.33.1-4
  • boost-devel 1.33.1-4
  • flex 2.5.33-1
  • pkgconfig
  • libtool
(参考:http://wiki.apache.org/thrift/ThriftInstallationWin32
devel目录下选择这些包,
另外还需要选 make (the GNU version of ‘make’ utility ),
否则在最后执行 make的时候回被提示错误:
bash: make: command not found)
完成安装。
( D:\cygwindown\http%3a%2f%2fwww.cygwin.cn%2fpub%2f\release 下面一共有以下文件夹
aalib
alternatives
apache2
apr1
aprutil1
ash
audiofile
autoconf
automake
autotrace
base-files
base-passwd
bash
binutils
bison
boost
bzip2
cmake
coreutils
cpio
crypt
curl
cygutils
cygwin
cygwin-doc
db
diffutils
docbook-xml412
docbook-xsl
e2fsprogs
editrights
esound
expat
expect
fcgi
file
findutils
flac
flex
fontconfig
freeglut
gawk
gcc
gcc-mingw
gdbm
gettext
ghostscript
glib
gmp
GNOME
gnutls
GraphicsMagick
grep
groff
gtk2-x11
guile
gzip
icu
ImageMagick
jasper
jbigkit
jpeg
lapack
lcms
less
libao
libEMF
libfpx
libgcrypt
libglade2
libgpg-error
libiconv
liblzo2
libmcrypt
libmng
libogg
libpng
libsmi
libssh2
libtasn1
libtextcat
libtool
libungif
libvorbis
libwmf
libxml2
libxslt
login
lzma
m4
make
man
ming
mingw-runtime
minires
ncurses
neon
opencdk
openjade
OpenSP
openssl
pango
patch
pcre
perl
pkg-config
pkgconfig
plotutils
popt
postgresql
pstoedit
python
qhull
readline
rebase
run
sed
speex
sqlite3
t1lib
tar
tcltk
tcp_wrappers
termcap
terminfo
tetex
texinfo
tiff
tzcode
unzip
util-linux
uw-imap
w32api
wget
which
X11
xdelta
xerces-c
zlib
_obsolete
_update-info-dir)
9.thrift-20080411p1.tar.gz
下载地址在: http://developers.facebook.com/thrift/download_thrift.php
10.解压到D:\Java\thrift-20080411p1
11.启动cygwin
$ cd d:/Java/thrift-20080411p1
转到thrift目录。
12.运行

./bootstrap.sh
运行结果为:
lizongbo@lizongbo-pc /cygdrive/d/Java/thrift-20080411p1
$ ./bootstrap.sh
configure.ac: warning: missing AC_PROG_AWK wanted by: test/Makefile:133
configure.ac: warning: missing AC_PROG_RANLIB wanted by: test/Makefile:196
configure.ac:7: installing `./install-sh'
configure.ac:7: installing `./missing'
compiler/cpp/Makefile.am: installing `./depcomp'
configure.ac: installing `./ylwrap'
lizongbo@lizongbo-pc /cygdrive/d/Java/thrift-20080411p1
$
13.运行
./configure
耐心等待命令执行完成。
14.开始make
$ cd compiler/cpp/
lizongbo@lizongbo-pc /cygdrive/d/Java/thrift-20080411p1/compiler/cpp
$ make
(要先装make包,否则会提示make: command not found)
耐心等待编译完成。
生成编译器文件在:

D:\Java\thrift-20080411p1\compiler\cpp\thrift.exe

14.用文本编辑器打开
D:\Java\thrift-20080411p1\tutorial下的\tutorial.thriftshared.thrift
tutorial.thrift第一行的#!/usr/local/bin/thrift -cpp -java -py -php -xsd -perl
改成#!/cygdrive/d/Java/thrift-20080411p1/compiler/cpp/thrift.exe -cpp -java -py -php -rb -perl -erl -xsd -r
shared.thrift的第一行#!/usr/local/bin/thrift -cpp -java -py -php -xsd -perl
改成#!/cygdrive/d/Java/thrift-20080411p1/compiler/cpp/thrift.exe  -cpp -java -py -php -xsd -perl
保存文件。