Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7914523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:08:44+00:00 2026-06-03T14:08:44+00:00

I made a Http request and this is how the request header looks like:

  • 0

I made a Http request and this is how the request header looks like:

GET /unni/servlets/servlet/HelloWorldExample HTTP/1.1
Host: localhost:8700
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Cache-Control: max-age=0

Then, I just used request.getIntHeader("User-Agent").This time I got a NumberFormatException saying that ‘request header
cannot be converted to an integer’.This is what API and servlet spec also say.I searched for more about this to get some working example, but did not get any desired results.So,how can I use this method? I am using Apache Tomcat 7.0.25.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:08:48+00:00Added an answer on June 3, 2026 at 2:08 pm

    Header with key “User_Agent” contain mixed date type value(combination of String and Integer), in your case it is :User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20100101 Firefox/12.0.

    If you trying to get this value as Integer you definitely get NumberFormatException (because header value contain non-numeric value as well).

    you can only apply request.getIntHeader() to those header which contain purely numeric value.
    you can define your own header key with numeric value and retrieve this using request.getIntHeader().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to access the http request IE made when the page
Firebug is awesome in reporting the relative time when an HTTP request was made
How do I capture HTTP response when the request is made by web browser?
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I've made a simple http server using Twisted, which sends the Content-Type: multipart/x-mixed-replace header.
I've made a voting on comments like the one this website has(something similar), and
I recently made a question based on doing a HTTP request with POST data
I'm using the PassthruAPP method to hook into HTTP/HTTPS requests made by IE. It's
I made an image to easier explain what Im after: Image Illustration http://bayimg.com/image/eabahaaci.jpg Ive
I have made a quick fiddle: http://jsfiddle.net/tLLB4/ Ok, so the premise is, i'm hovering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.