Novice User
Novice User

Reputation: 3824

Get case insensitive request header value

From HttpServletRequest.getHeader("name") how can I get the value irrespective of case ...like somebody specifying name or Name etc.

Upvotes: 2

Views: 9600

Answers (1)

BennyLau
BennyLau

Reputation: 107

According to the javadoc, the parameter is considered case insensitive:

http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getHeader%28java.lang.String%29

So your example should already be good to go, catching both "name" and "Name".

Upvotes: 4

Related Questions