java中的代理服务器
我是 java 新手。我需要为 IBC 2011 会议开发一个代理服务器。我有一些重新分级代理服务器的问题。
1.我将使用java开发代理服务器。
假设A(发送信息)通过代理服务器到B(接收信息)。
这里A通过HTTP服务器发送信息(在A中运行的应用程序是一个婚姻应用程序)我如何在代理服务器中接收A发送的信息以及如何将其转发到也是HTTP服务的B。
2.在开始开发代理服务器之前我现在必须做些什么。
3.如何从HTTP协议获取信息。
4.我怎样才能经常检查是否有任何消息排队从A转发到B或B到A。
任何人都可以帮助我。先谢谢了。
I am new to java.I need to develop a proxy server for IBC 2011 conference.I have some Questions regrading the Proxy server.
1.I am going to develop the proxy server using java.
Suppose A(sending the information) to B(receive the message) through the proxy server.
Here A is sending the information through HTTP serves(application running in A is a wed application) how can i receive the information send by A in proxy server and how can I forward it to the B which is also a HTTP serves.
2.What r the Things I have to now before I start developing the proxy server.
3.How can i get the information from the HTTP protocol.
4.How can i check frequently for the any message is there in line to forward to B from A or B to A.
Can any one helpme.Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请改用其中之一 http://proxies.xhaus.com/java/。一旦您考虑到 HTTP 的所有复杂性,滚动您自己的代理实现将比您想象的要困难得多。
Use one of these instead http://proxies.xhaus.com/java/. Rolling your own proxy implementation will be much harder than you think once you've taken all the intricacies of HTTP into account.
有很多库可以使用。
对于A和B,他们可以运行hessian服务器(用于监听)+客户端(用于发送)
对于代理服务器,您可以使用 JMS + hessian 服务器 + 客户端,与 A 和 B 相同。
这样就可以发送java对象了。
但 hessian 只是建议您可以使用 RMI 或 spring remoting 或者 Web 服务。
到目前为止,可用的粗麻布是最快且非常容易开发的。
从1到4你问如何设计一个超出范围的应用程序,你需要自己做:)。
there are many libraries which can you use.
for the A and B they can running hessian server(for listening) + client(for sending)
and for the proxy server you can use JMS + hessian server + client same as for A and B.
In this way you can send java objects.
But hessian is only on suggestion you can use RMI or spring remoting or maybe web services.
By far which a have working hessian is the fastest and very easy to develop.
from 1 to 4 you ask how to design a application which is out of the scope and you need to do it by you self :).
我在我的课程项目中做了类似的事情。
就我而言,您需要学习java作为代理服务器的核心知识是套接字编程。
您可以设置两个套接字:一个在代理服务器和 Web 浏览器之间进行通信,另一个在代理服务器和目标服务器之间进行通信。
另外,您还需要一些有关 Java 线程的知识,为每个连接打开一个线程将是一种有效的方法。
我假设您已经具备有关计算机网络的知识,例如 http、tcp 等。
I did something similar in my course project.
As far as i am concerned, the core knowledge u need to learn about java for this a proxy server is socket programming.
you can setup two sockets: one communicates between your proxy server and the web browser, the other communicates between your proxy server and the target server.
Also, you will need some knowledge about thread in Java, open one thread for each connection will be a efficient way.
And I assume that you already have the knowledge about those computer networking stuffs like http, tcp.etc.