HTTP « MVC « Spring Q&A

1. Keep file between http requests

Imagine this simple form for uploading a file:

<form action="upload" enctype="multipart/form-data">
    <input type="text" name="name"/>
    <input type="file" name="file"/>
    <input type="submit"/>
If there is some error ...

2. HTTP 500 Response with Body?

I have a RESTEasy service that returns a HTTP 500 when a server side error occurs. I manage to attach a body to the HTTP response in order to give more ...

3. HTTP - 500 org.springframework.web.util.NestedServletException: Handler processing failed;

I'm noob to Spring. I'm using :

  1. Apache Tomcat 6.0.20
  2. Spring 3.x
I want to create simple "Hello World !!!" on my index page. Unfortunately i got the following error:
org.springframework.web.util.NestedServletException: Handler processing failed; ...

4. Using Spring's @RequestBody and reading HttpServletRequest.getInputStream() afterwards

I'm mapping my request's JSON POST data into an object using Spring's @RequestBody annotation and MappingJacksonHttpMessageConverter. However after that I'd like to read the data in String form to do some ...

5. HTTP status 500 when using file upload with freemarker

I'm trying to add an image upload in my freemarker page(ftl file) using spring and hibernate technology - this is the error I had every time I run the application :


6. how to handle both XmlHttpRequest(AJAX) and regular http requests in one spring mvc method?

currently my solution is For AJAX:

@RequestMapping(value = "/verify", method = {RequestMethod.GET},
    headers = "x-requested-with=XMLHttpRequest")
    @ResponseBody userTO
    void ...

7. Handling multiple s with the same name in spring-mvc

Please take a look at codes below. Four text boxes are displayed. If I input "1" and "2" to former text-boxes, these are binded as comma-separated "1,2" as I expected. However, if I ...

8. using multiple values HttpStatus in @ResponseStatus

I am using the Spring annotation @ResponseStatus in my Exception like

public class UnauthorizedException extends Exception{
Problem is I want to throw the same error for a number of values like HttpStatus.SC_SERVICE_UNAVAILABLE, etc.. Is ...

9. Data binding of type of Date Class. "2010/01/02" binds correctly, but "2010-01-02" does not

I found that, by default when I using Spring MVC, "2010/01/02" binds correctly, but "2010-01-02" does not. I know Spring has some useful binding mechanisms like initBinder. However, in this question I ...

10. Implementing an HTTP proxy to overcome cross-site AJAX requests restrictions (?)

I have a Spring-MVC webapp (3.0.5-RELEASE) which needs to access JSON webservices from another webapp on a different sub-domain (from the client/browser via AJAX). I've solved this in the past by ...

11. How to avoid stacktrace HTTP Status 500 page with MaxUploadSizeExceededException

I have this code (like in Spring's reference):

<bean id="multipartResolver" 
        <!-- one of the properties available; the maximum file size ...

12. How do I change the response for a HTTP OPTIONS request in a Spring MVC 2.5 application?

This sounds like a trivial question but somehow I can't seem to figure it out. I have a Spring MVC application. I don't support any http methods except GET and POST. I ...

13. Spring MVC Request body error handling

While using @RequestBody StreamSource found out, that if xml in request body in not valid StreamSource throws an Exception(resulting in 400 Bad Request) and i'm not able to handle it(tell client ...

14. Handling both Multipart and non-multipart HTTP POSTs in Spring MVC

I have a SpringMVC web service for uploading files which looks like this:

@RequestMapping(value="/upload.json", method = RequestMethod.POST)
public @ResponseBody Map<String, Object> upload(MultipartHttpServletRequest request) {
    // upload the file
and everything is ...

16. Spring 3.0 MVC Data Binding with HTTP PUT

I have a simple Spring 3.0 controller with a PUT request mapping

public class FooController {
    @RequestMapping(value = "/foo/{id}", method = RequestMethod.PUT)
    public @ResponseBody FooView put(@PathVariable ...

17. Strange behavior in Tomcat URL request scenario

Sorry to be so unspecific with title and tags. I have a problem with URL requests to Tomcat in a simple failover scenario with multiple applications being involved. A strange error ...

18. Why is HttpEntity causing an HTTP Status 415 error in Spring?

This has been bugging me for days and I'm turning to the community for help. I've been trying to access the request body and headers using the HttpEntity as suggested by ...

19. Configuration problem:Spring NamespaceHandler for []

Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [].
can anyone tell why this error is happening? this is my configuration.
<beans xmlns=""

20. Multiple response http status in Spring MVC

By having the following code:

@RequestMapping(value =  "/system/login", method = RequestMethod.GET)
public void login(@RequestBody Login login) {
    if(login.username == "test" && login.password == "test") {

21. Spring MVC Request Life Cycle

This seems like a pretty basic question but I unfortunately don't know the answer and can't seem to find it. I'm trying to understand the lifecycle of an initial POST/GET to a ...

22. Wrong UTF8 conversion in the Spring MVC app

I have some trouble with Spring HTTP message conversion. In my app I have the login form. When registered user try to login he get the login error ( redirect to /login?login_error=1) The ...

23. Spring MVC - HTTP GET requests for static resources are handled by custom servlet

I'm working on a proxy servlet that maps all requests. I specified web.xml in the following way:


24. HTTP Error 500 unable to find a solution

I am following a tutorial, and i got the following HTTP Error 500. I am unable to solve this even after googling it since yesterday. Can someone help me ...

25. HTTP byte-range requests for resources in Spring MVC

Hi, as far as I could see, HTTP byte-range requests aren't supported by the ResourceHttpRequestHandler (as configured with ). Is there any other way to make this work? I'd like to ...

26. HTTP to HTTPS in spring MVC

HTTP to HTTPS in spring MVC I've googled around without much luck. For example I have a SimpleFormController and I want to redirect the client to a secure HTTPS page "new_view.htm" ...

27. Question: How to setup http sesson management in MVC Spring

Question: How to setup http sesson management in MVC Spring Hi, I am new to spring and i not a smart guy... can anybody here teach me how to set the ...

28. No mapping found for HTTP request with MVC requests

No mapping found for HTTP request with MVC requests I am receiving the following error: WARN org.springframework.web.servlet.PageNotFound 2008-06-17 13:37:30,140 - No mapping found for HTTP request with URI [/spring-security/WEB-INF/views/help.jsp] in DispatcherServlet ...

29. Binding HTTP form fields onto model of type Map

Binding HTTP form fields onto model of type Map Hi, We use Spring 2.5.5 and WebFlow 2.0 for our web application. When mapping http form field values onto the underlying model ...

30. How to send Http Response AND return Model/View?

Hi, Please kindly help with your expertise. Web Server got an HTTP POST and tries to do 2 things: 1. Send HTTP Response to HTTP Requester (via URL?) 2. Return Model/View ...

31. How to send Http Response AND return Model/View?

Hi, Please kindly help with your expertise. Web Server got an HTTP POST and tries to do 2 things: 1. Send HTTP Response to HTTP Requester (via URL?) 2. Return Model/View ...

32. http inbound channel adapter in spring mvc environment

Hi I have an application built with Spring ROO and I'm not sure of the best way to configure an http inbound channel adapter that will work alongside Spring MVC. In ...

33. Http error handling - Spring 3 MVC

What's is the best way to handle http errors (404, 500 ect) in a way that when the error happens the controller reacts and forwards it to a page rather than ...