简体   繁体   English

在服务器上运行独立的Java应用程序

[英]running standalone java application on server

I have to create the following setup : 我必须创建以下设置:

  1. The server displays a web page to the user. 服务器向用户显示一个网页。
  2. The user clicks on a button on the page.(Request is sent to the server). 用户单击页面上的按钮。(请求已发送到服务器)。
  3. The server then starts a stand alone java application on the clients behalf. 然后,服务器代表客户端启动独立的Java应用程序。 This application is meant for making certain transaction on a different web page. 此应用程序旨在在其他网页上进行某些交易。 So this new webpage must be shown to the user on the client machine(in a new broswer tab). 因此,必须在客户端计算机上的新浏览器标签中向用户显示此新网页。
  4. The client can then interact with the web page. 然后,客户端可以与网页进行交互。 All clicks made by the client on the web page ( all generated requests ) must pass through the application running on the server(the application has a proxy feature). 客户端在网页上进行的所有点击(所有生成的请求)都必须通过服务器上运行的应用程序(该应用程序具有代理功能)。 The responses must also be returned to the client. 响应也必须返回给客户端。

Is this setup possible? 这种设置可行吗? How? 怎么样? What technology must I use? 我必须使用什么技术?

EDIT : 编辑:

Is the following a better solution : 以下是更好的解决方案:

Host the application on a proxy server and configure the browser to go through the proxy server. 将应用程序托管在代理服务器上,并配置浏览器以通过代理服务器。 Will I be able to view the webpage on the client in this way. 我是否可以通过这种方式在客户端上查看网页。 Again what server/technology would i use? 同样,我将使用哪种服务器/技术?

This can be created like any simple Web Application in java. 可以像使用Java中的任何简单Web应用程序一样创建它。 Following technologies should be sufficient : 以下技术应足够:

  • JSP or any other client view like Velocity JSP或任何其他客户端视图(例如Velocity)
  • HTTPServlets : Assuming working with HTTP protocol. HTTPServlets:假定使用HTTP协议。
  • Web.xml : This file is required to configure servlets and any other proxy/Filter you want to add. Web.xml:此文件是配置servlet和要添加的任何其他代理/过滤器所必需的。

You need a client on comuter A connecting to a Server on computer B which you design in a way it can access the application on computer C and control it, so you will need the APi of the application or to design the application wo it can be controled by the server. 您需要在计算机A上连接到计算机B上的服务器的客户机A,您要设计它的方式,使其可以访问计算机C上的应用程序并对其进行控制,因此您将需要应用程序的APi或设计应用程序的APi由服务器控制。 At the end you are trying to develop something like a NetViewer like a tool for window sharing, can not you use any 3rd part tool? 最后,您正在尝试开发类似于NetViewer的工具,例如用于窗口共享的工具,您不能使用任何第三部分工具吗? do you really need to implement this. 您真的需要实现这一点吗?

Like duffymo said above, I really think this is headed off in the wrong direction. 就像上面的duffymo所说,我真的认为这是朝错误的方向前进。

Unless I am completely missing something here you are trying to get a server to redirect someone to another page just so you can save what they are doing on those other pages? 除非我在这里完全缺少某些内容,否则您将尝试使服务器将某人重定向到另一个页面,以便您可以保存他们在其他页面上正在做什么?

This can be done a lot simpler using sessions. 使用会话可以轻松得多。 The server does everything itself so there is no re-direction, which on some browsers would cause a security page to show up, and it is much simpler to code. 服务器本身会做所有事情,所以没有重定向,这在某些浏览器上会导致显示安全页面,并且编码更简单。 All you need to do is pass the session back from the client and have the server keep track of that session. 您需要做的就是将会话从客户端传回,并使服务器跟踪该会话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM