tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Barke <e...@deo.com>
Subject RE: HTTP_USER_AGENT
Date Mon, 19 Feb 2001 13:08:30 GMT
I guess I had it coming... I stand corrected... 
It was a spontanious 'better-safe-than-sorry' mishap :)

Cheers

/erik


-----Original Message-----
From: Nick.Holloway@pyrites.org.uk [mailto:Nick.Holloway@pyrites.org.uk]
Sent: den 19 februari 2001 12:51
To: tomcat-user@jakarta.apache.org
Subject: Re: HTTP_USER_AGENT


erik@deo.com (Erik Barke) writes:
> 	String aUserAgent = (String)request.getHeader("User-Agent");

As an aside, there is no need for the cast to "String", as the return
type is already "String".

I often see people doing the same with "request.getParameter()".  I can
only guess that people get into the habit of putting the cast to "String"
when using "session.getAttribute()" (where it is needed), and extend
that to other servlet methods.

-- 
 `O O'  | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, email: tomcat-user-help@jakarta.apache.org

Mime
View raw message