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

  • Home
  • SEARCH
  • 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 8717115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:14:16+00:00 2026-06-13T06:14:16+00:00

I am running a Spring MVC 3 maven app with embedded jetty with configuration

  • 0

I am running a Spring MVC 3 maven app with embedded jetty with configuration below:

    <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.14</version>
        <configuration>
            <scanIntervalSeconds>10</scanIntervalSeconds>
            <testClassesDirectory>/Users/mydownloads/Downloads/jackson-all-1.8.10.jar</testClassesDirectory>
            <useTestClasspath>true</useTestClasspath>
        </configuration>
    </plugin> 

As seen above, I have jackson-all-1.8.10 jar in the test classpath.

I have mappings like below which are working fine when I produce json from my controller:

@RequestMapping(value="/getSomething",produces="application/json",method=RequestMethod.GET)

However, when I try to have a POST mapping so then I get an error: 415: Unsupported Media Type

the annotation I am using for POST is:

@RequestMapping(value="/postSomething", consumes="application/json", method= RequestMethod.POST)

How can I fix this so that the jackson jar sitting in the classpath takes care of the media type?

On the client when I am making a request to POST the data the request has following headers:

Request URL:http://localhost:8080/myapp/postSomething
Request Method:POST
Status Code:415 Unsupported Media Type
**Request Headersview source**
  Accept:*/*
  Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
  Accept-Encoding:gzip,deflate,sdch
  Accept-Language:en-US,en;q=0.8
  Connection:keep-alive
  Content-Length:23
  Content-Type:application/x-www-form-urlencoded
  Cookie:JSESSIONID=1f0mox1qw67zl
  Host:localhost:8080
  Origin:http://localhost:8080
  Referer:http://localhost:8080/myapp/
  X-Requested-With:XMLHttpRequest

I have datatype: 'json' on jQuery

  • 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-13T06:14:17+00:00Added an answer on June 13, 2026 at 6:14 am

    You don’t set the request Content-Type correctly.

    As you can see in the headers you posted, the Content-Type header value is application/x-www-form-urlencoded, which is jquery default.

    Use contentType: 'application/json' attribute in jquery ajax call.

    The dataType attribute tells jquery what content type is to be expected in the response.

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

Sidebar

Related Questions

I have a Spring MVC web app running on my server. Recently I wanted
I'm following this example to get Spring up & running: http://static.springsource.org/docs/Spring-MVC-step-by-step/part2.html What they do
I have a web app running Spring 3.0 and using Spring-MVC. I have a
I wish to use Spring MVC to provide a REST web service. However, running
I am running grails plugin for Spring Social from https://github.com/synergyj/grails-spring-social-core When I tried to
I'm running Spring MVC 3.x and I have one Controller with RequestMapping annotations (
I have a spring MVC based web application running on Tomcat 7.0. We are
In intelliJ ulimate, running a bare bone spring mvc application I get the error:
I'm trying to improve my spring mvc configuration so as to not require a
I tried running a sample Spring MVC using Spring STS in Eclipse, however when

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.