Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

JSP equivalent to PHP $_SERVER?

Thread view: 
comp.lang.php - 16 Jan 2006 18:39 GMT
I looked up System.getProperties, but to be honest, I have no clue how
to use it in light of what I can do in PHP, which is this:

<?php echo $_SERVER['HTTP_USER_AGENT'] . ' ' . $_SERVER['SERVER_URI'];
?>

it would be very nice to find the JSP equivalent of <? phpinfo(); ?>
(anyone know who knows both PHP and JSP?) but until then, what on earth
do I do?

Thanx
Phil
James Westby - 16 Jan 2006 19:04 GMT
> I looked up System.getProperties, but to be honest, I have no clue how
> to use it in light of what I can do in PHP, which is this:
[quoted text clipped - 8 lines]
> Thanx
> Phil

User agent is a Http header right?

If so you want

String getHeader(String) on the HttpServletRequest

e.g.

request.getHeader("User-Agent");

this returns a String that you can do what you like with.

I don't know php, but looking up phpinfo() it seems like there wont be a
single Java equivalent, as no object has all that information at its
disposal. Some of the information is probably availabel through
different methods though.

James
phillip.s.powell@gmail.com - 17 Jan 2006 07:32 GMT
Thanx, I just had no info on that one, sorry.  In PHP $_REQUEST and
$_SERVER and $_ENV are completely different collections, so I had no
reference coming into Java.

Phil

> > I looked up System.getProperties, but to be honest, I have no clue how
> > to use it in light of what I can do in PHP, which is this:
[quoted text clipped - 27 lines]
>
> James
James Westby - 17 Jan 2006 19:57 GMT
> Thanx, I just had no info on that one, sorry.  In PHP $_REQUEST and
> $_SERVER and $_ENV are completely different collections, so I had no
> reference coming into Java.
>
> Phil

[snip]

I find it odd that the User-Agent header is retrievable from the
$_SERVER variable, rather that $_REQUEST. I guess that's noraml PHP?

Apart from that you may rind that stuff you normally get from $_REQUEST
comes in the jsp request object, the $_ENV from System.getProperties,
and $_SERVER, i saw a class that had some relevant stuff, but I can't
remember what it was now.

James


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.