Questions tagged [spring-web]

The Spring Web model-view-controller (MVC) framework.

The Spring Web model-view-controller (MVC) framework is designed around a DispatcherServlet that dispatches requests to handlers, with configurable handler mappings, view resolution, locale, time zone and theme resolution as well as support for uploading files. The default handler is based on the @Controller and @RequestMapping annotations, offering a wide range of flexible handling methods. With the introduction of Spring 3.0, the @Controller mechanism also allows you to create RESTful Web sites and applications, through the @PathVariable annotation and other features.

Official Documentation

386 questions
1
vote
1 answer

"Invalid property 'ssn' of bean class [java.lang.String]" when trying to validate request body with Spring

I have a springboot application with a rest controller sitting up top. The user access the controller through /test and passes in a json like so: {"ssn":"123456789"} I want to validate the input by at least making sure there's not an empty ssn…
Richard
  • 5,840
  • 36
  • 123
  • 208
1
vote
1 answer

Spring generating download link

Is there any way to generate temporary links for downloading file using spring web, security-oauth stack? For example domain.com/document/ed3dk4kfjw34k43kd4k3cc that works only on current session?
Fr0stDev1
  • 143
  • 2
  • 15
1
vote
1 answer

Swagger works with @RepositoryRestController

I need your help with a interesting problem: I want to use swagger for easy API Documentation and I got two classes: a versionController and a PersonController. The version controller has 2 annotations: - @RestController - @Requestmapping(value =…
1
vote
1 answer

Using MultiValuedMap as ResponseBody gives {"empty" : false} as response

I am trying to use MultiValuedMap as the ResponseBody of a rest service but the response I get in the browser is: {"empty" : false} This was working fine using MultiValueMap as the ResponseBody but after upgrading the org.apache.commons libraries,…
Alaina
  • 19
  • 6
1
vote
0 answers

Spring request parameter parsing

Can someone please explain the following behaviour: Given the following HTTP GET request /test?q=queryString&map[one]=val&map[two]=val2&map[three]=val3 why does this Controller method @RequestMapping(value = "/test") public ResponseEntity
rorschach
  • 2,871
  • 1
  • 17
  • 20
1
vote
1 answer

Spring RestController endpoints autodiscovery

Is there a way to get a list of all the endpoints declared in a @RestController annotated class? With some patience that could be achieved via reflections but is there any Spring built-in way for that? Idea is to show this list on a service landing…
S. Pauk
  • 5,208
  • 4
  • 31
  • 41
1
vote
2 answers

In which layer i should check if (something) exists?

Suppose i have User entity. I want to check if user id exists on database. I know how to check, but in which layer ? What is the best and more understandable layer for that ? In my opinion, it should be Controller layer. But i don't think it is…
Xnart
  • 21
  • 2
1
vote
0 answers

Spring MVC: (If is possible) search form on submit event generate a URI instead of URL pattern format

I have a @Controller with the following @RequestMapping annotation @RequestMapping(value={"somevalue"}, method=RequestMethod.GET, produces=MediaType.TEXT_HTML_VALUE) public String findOneById(@PathVariable String id,…
Manuel Jordan
  • 15,253
  • 21
  • 95
  • 158
1
vote
1 answer

SAXException on root element unmarshalling in spring web service

I have restful webservice with spring which has following mapping:
Gazeciarz
  • 516
  • 1
  • 8
  • 22
1
vote
1 answer

Why is the configured servlet path correctly used by the REST controllers, but ignored in Spring Security features?

I'm new to Spring and I try to create a secured rest application using Spring Boot and Spring Security. I'm searching for weeks for a solution now... I'm using Spring Boots embedded web container (Tomcat) and the spring-boot-starter-parent…
GorkiDaGurk
  • 13
  • 1
  • 4
1
vote
0 answers

ConcurrentModificationException during high load - Spring Web REST

When running load tests on a rest service, each request has random xml content, following exception occurs occasionally. It seems as the higher load the more likely that it occurs. Current implementation in Spring for unmarshal xml to java objects…
Robert
  • 11
  • 3
1
vote
2 answers

Spring returns only the first param from the query string

Spring returns only the first param from the query string, subsequent params are missing. When calling the following URL with curl: curl -i -X GET -b usercookie.txt -c usercookie.txt…
bpgergo
  • 15,669
  • 5
  • 44
  • 68
1
vote
1 answer

How to initialize spring-boot WebMvc? (ServletContext always null)

I'm using spring-boot-starter-web to add an embedded webserver to an existing application. Problem: the servletContext is always null during startup. I'm running my application using ConfigurableApplicationContext ctx =…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
1
vote
0 answers

How to handle multiple exceptions in @exeptionhandler and response body?

Should I create an extra method with org.springframework.security.access.AccessDeniedException as parameter? @ControllerAdvice public class AccessDeniedExceptionAdvice { private final Logger log = LoggerFactory.getLogger(getClass()); …
Viktor Mellgren
  • 4,318
  • 3
  • 42
  • 75
1
vote
1 answer

How to clean up resources in Spring Webflow?

I have a Spring Webflow application. In one view-state a user can upload file to server. By default, file is created temporarily by Apache Trinidad only for request scope. So I copy it to another path on server because we need user confirmation in…
Gondy
  • 4,925
  • 4
  • 40
  • 46