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 8989543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:17:12+00:00 2026-06-15T22:17:12+00:00

in this period I am studying the Spring MVC showcase example. Now I am

  • 0

in this period I am studying the Spring MVC showcase example. Now I am studying how Spring MVC requires data.

I have some difficulties to understand how HTTP Request header are handled.

In pratcice I have the following link:

<a id="header" class="textLink" href="<c:url value="/data/header" />">Header</a>

This link generate an HTTP Request towards the URL: “/data/header”

This is the method of the RequestDataController class that handles this HTTP Request (the entire class is annoted by @RequestMapping(“/data”): so this method handle /data/header URL)

@RequestMapping(value="header", method=RequestMethod.GET)
public @ResponseBody String withHeader(@RequestHeader String Accept) {
    return "Obtained 'Accept' header '" + Accept + "'";
}

So the withHeader method take a parameter that is annoted by @RequestHeader annotation that is an annotation which indicates that a method parameter should be bound to a web request header.

Ok, so my answer is: what exactly I have inside the Accept variable? The value of my HTTP Accetp Header? or what?

Fow what I know Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used to indicate that the request is specifically limited to a small set of desired types, as in the case of a request for an in-line image.

So my output (the returned value) is: Obtained ‘Accept’ header ‘text/plain, /; q=0.01′

mmm…what it exactly means this Accept headers field value?

Thank you

Andrea

  • 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-15T22:17:13+00:00Added an answer on June 15, 2026 at 10:17 pm

    Yes, when you annotate a parameter with @RequestHeader, the parameter name is used for retrieving the header information – in your case that will be the header name of ‘Accept’- the parameter name could have been accept also, the header names are retrieved in a case insensitive manner.

    You could have also explicitly specified the header name explicitly this way: @RequestHeader("Accept")

    Accept header like you have indicated is a way for the client(browser) to say what it can accept as a media type of the response to be.

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

Sidebar

Related Questions

in this period I am studying the Spring MVC showcase example dowlodable from STS
In this period I am studying the Sping MVC showcase example dowlodable form STS
In this period I am studing the Spring MVC Showcase example dowlodable from the
In this period I am studing the Spring MVC showcase example (downloadable from STS
I inherited a horribly-designed table where data is stored like this: Period | Identifier
I have a php form. After this form is submitted, if all data is
in this period I am learning Haskell but I have problems solving a simple
So i have this table. It has some hundreds of rows. Every row has
I have several data series plotted on a chart. This is logged data spanning
I succeeded to make simple and small example which integrates between Spring MVC and

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.