This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes PHP and the fly likes How to access php _SERVER variable from Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Languages » PHP
Bookmark "How to access php _SERVER variable from Java" Watch "How to access php _SERVER variable from Java" New topic
Author

How to access php _SERVER variable from Java

Eric Ford
Greenhorn

Joined: Jun 04, 2010
Posts: 17
I need to integrate a Java web app running under Tomcat 7 with a php app running under Apache Web server on the same machine. Specifically, the php app is responsible for user logins/security and I need my web app to be able to read the _SERVER variable named "REMOTE_USER" stored by php. I do not need to write to the php app or interact in any way other than reading the contents of that variable. If any one has experience doing something similar I would appreciate some tips how to accomplish this.

TIA

Eric
Eric Ford
Greenhorn

Joined: Jun 04, 2010
Posts: 17
Found the answer. It turns out that selected CGI variables (including REMOTE_USER) are available via the HttpServletRequest. In this case, there is a method (getRemoteUser()) that returns the value populated by Apache.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access php _SERVER variable from Java
 
Similar Threads
how to make html files within a folder accessible only through jsp
request dispatching
java maskeraiding as firefox - how?
Web programming questions
Need To have show MAC address and IP Address In Web Application