Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access php _SERVER variable from Java

 
Eric Ford
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic