如何将此应用程序移植为 Web 服务?
我有一个java应用程序,它执行一些逻辑...... 但java应用程序只是一个.jar应用程序。但我想让它成为网络上的应用程序......我可以从用户那里获取参数,但是如何从用户那里传递参数,并将其放入我的.jar中,并处理和输出结果给用户??
请注意,.jar 应用程序只是一个控制台应用程序,它不需要用户界面,只需要与其通信的命令行。谢谢。
I have a java application which doing some logic... ...
But the java application is only a .jar application. But I would like to let it become an application on the web....I can get the param from the user, but how can I pass the param from user, and put it into my .jar, and process and output the result to the user??
notice that the .jar application is only a console application, which don't need a user interface, only cmd lines communicated with it. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你有源代码吗?如果这样做,您可以使用 JAX-WS 注释公开服务。 JAX-WS 在 J2SE6 中可用。
看看这个: http://java.sun.com/developer/technicalArticles/ J2SE/jax_ws_2/
然后,您必须将修改后的代码打包到 WAR 而不是 jar,因为您的应用程序现在变成了 Web 应用程序。然后它必须托管在应用程序服务器中 - 例如 Tomcat。
Do you have source code? If you do, you can expose the services using JAX-WS annotations. JAX-WS is available in J2SE6.
Take a look at this: http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/
You then have to package the modified code to a WAR instead of a jar, because your application now becomes a web application. Then it will have to be hosted in an application server - Tomcat for example.
您可以查看Metro。
You may take a look at Metro.