Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Application Server  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 [求助] 如何在应用程序中嵌入 jetty,实现 WEB 管理?
kingwong





发贴: 65
积分: 10
于 2004-10-26 16:23 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
现在有一个基于socket的应用程序,为了实现对这些socket连接sessions的管理,准备在应用程序中嵌入 jetty 来实现。参考了一些网上的资料,作了一个简单的集成(不知道对不对?后面有描述),然后在命令行下,同时启动 jetty 和 application。接着在IE中通过一个简单的JSP访问 application 里面的一个public 的 Hashtable(简单访问它的大小,在application启动时会初始化,控制台上有输出显示。),结果显示其 size 为 0 。

具体步骤如下:
1、启动Jetty的线程 LaunchJetty :
import org.mortbay.jetty.Server;

public class LaunchJetty implements Runnable
{
public void run()
{
Server.main(new String[] { "etc/jetty.xml" });
}
}
2、启动application的线程 LaunchTnGateWay:
同1类似。
3、命令行下启动程序 Launcher:
public class Launcher
{
public static void main(String[] args)
{
Thread ljetty = new Thread(new LaunchJetty());
ljetty.start();

Thread lgateway = new Thread(new LaunchTnGateWay());
lgateway.start();
}
}

4、控制台上的部分输出:
......
---------- gateway.cluster.size() is :5 ----------
WI
IN
MI
IL
OH
--------------------------------------------------
2004/10/26 15:52:11:950 CST [DEBUG] TnGateway - creating Daemon Socket ...
15:52:12.107 EVENT Statistics on = false for org.mortbay.jetty.Server@a470b8
15:52:12.107 EVENT Starting Jetty/4.2.22
15:52:12.169 EVENT Started org.mortbay.http.NCSARequestLog@bd928a
2004/10/26 15:52:12:278 CST [DEBUG] TnGateway - daemon is ready to accept connec
t on port 2323
15:52:12.513 EVENT Started WebApplicationContext[/test,CyberObject Demo Root]
15:52:12.732 EVENT Started WebApplicationContext[/TnGateWayConsole,file:/D:/MyH
ttpd/webapps/TnGateWayConsole/]
15:52:12.810 EVENT Started SocketListener on 0.0.0.0:8080
15:52:12.810 EVENT Started AJP13Listener on 0.0.0.0:8009
15:52:12.810 EVENT NOTICE: AJP13 is not a secure protocol. Please protect the p
ort 0.0.0.0:8009
15:52:12.810 EVENT Started org.mortbay.jetty.Server@a470b8

5、测试JSP部分输出:
co.tn.gateway.TnGateway@164b09c cluster.size() = 0

请朋友们指点一下。谢先!




flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923