Question

I have Java code that works on my desk top...its a simple app that grabs stuff from a database does something to it and outputs a list.

This is for a consumer facing site and ultimately i want to pass the list on to PHP to use to furnish a page.

I understand that I can do that with thrift and thats the current plan.

But the question is whether I need some special server besides just the JDK to run the java end of things given the fact that it is being used purely for data processing? Why or why not?

How does JRE/JDK handle different users trying to access user-specific data at the same time given that php has to grab that info from the same java application? how does the java program know the difference?

Thanks alot for your help!

Was it helpful?

Solution

You need an J2EE server, which depending on the complexity of your application might be a JSP/Servlet engine like Apache Tomcat or a full-blown J2EE application server like GlassFish, jBoss or even a commercial product like Oracle Fusion middleware suite, which also includes features like user management, LDAP server, Sigle-Sign-on, Server farm Management tools etc.

On This server you typically run a J2EE/Web application, deployed as an WAR/EAR, see the Tutorial

EDIT: Description of a basic broser/HTTP/HTML webapp: The J2EE server provides an HTTP endpoint which can be invoked from a Browser via a HTTP request, e.g. http://localhost:80870/myApp/helloWorld?param=1. The HTTP request is dispatched to a particular Servlet (a Java class impmenting ther Servlet interface), depending on the server configuration and webapp deployment. The Servlet's doService method gets called by the J2EE server, then the servlet code can read any request parameters etc from the ServletRequest object passed into the method and can the construct a response (e.g. a HTML page) by writing it to the output stream of the ServletResponse object passed into the method. The response is then sent back to the user's browser.

The J2EE container also provides a session functionality so that subsequent requests from the same browser session can share state.

This is just the basic concept - for details on how this whole j2ee stuff works you should invest at least 8 hours in going through the very first Steps of the J2EE tutorial and get a HelloWorld JSP/Servlet running on your own server. In case any detail questions arise during this, ask these questions at stackoverflow.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top