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
0
votes
2 answers

How to organize URLs in web projects

There's plenty of resources that outline how URLs should be organized for RESTful APIs but for web in general there's little to be found. How can I structure the URLs of the web pages so that they are Sensible from the perspective of a user…
Johan Sjöberg
  • 47,929
  • 21
  • 130
  • 148
0
votes
0 answers

Why the class org/apache/commons/fileupload/FileItemFactory has not been imported automatically

I have basic dependencies in pom.xml org.springframework spring-webmvc ${org.springframework.version}
pain
  • 319
  • 2
  • 4
  • 18
0
votes
2 answers

Exception with Eureka client Expected authority at index 7: http://

Why can I get this error when I call my controller appending the URL: http://127.0.0.1:8080/status/tenant_1 to my browser? I want to call an Eureka service client called saf. 2017-10-17 16:40:01.584 INFO 12312 --- [ main]…
robyp7
  • 481
  • 2
  • 7
  • 25
0
votes
2 answers

How to use WebMvcConfigurationSupport from own auto-configuration

I'd like to add Converters via FormattingConversionService, which requires having a @Configuration class extending WebMvcConfigurationSupport: @Configuration public class WebAutoConfig extends WebMvcConfigurationSupport { @Override public…
laur
  • 498
  • 9
  • 17
0
votes
1 answer

How can I respond a list of elements in application/xml with Spring?

I'm an immigrant from JAX-RS to Spring. With my following code, @RequestMapping(method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}) public…
Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
0
votes
1 answer

How can I combine annotation based RequestMapping with static content?

I have some content that needs dynamic loading in my Controller and some content that I want to deliver in a static manner. Currently I have to configure the path of the controller manually in dispatcher-servlet.xml, e.G. the @RequestMapping isn't…
Angelo Fuchs
  • 9,825
  • 1
  • 35
  • 72
0
votes
1 answer

Mock data for client calling to spring web service

I need to get mock data for client calling to spring restful web services. I know unit testing purpose we can use mock. but my case is not the testing.
0
votes
1 answer

How to add all @PostMapping parameters to a Map?

I want to provide a POST servlet that takes the following JSON content: { "name": John "age": 25, "some": "more", "params: "should", "get": "mapped" } Two of those properties should be explicit mapped to defined parameters. All other…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
0
votes
1 answer

415 Unsupported Media Type, when NOT sending an optional request body with POST request

I have a REST controller that defines an interface which takes an optional request body. @RestController @RequestMapping(ExampleRest.EXAMPLE_URI) public class ExampleRest { public static final String EXAMPLE_URI = "/examples"; …
Herr Derb
  • 4,977
  • 5
  • 34
  • 62
0
votes
1 answer

Spring Controller not invoked for html views in mvc

I want to create simple Spring MVC application with MAVEN on top of tomcat. It has a home screen with a login link, which when clicked should redirect to the login page. To achieve this i have created a login controller to return login.html. When…
user3463832
  • 15
  • 1
  • 10
0
votes
0 answers

Spring controller method invocation advice

I have a controller that exposes the following endpoint: @RequestMapping("/all-users") List getAllUsers() { ... } I have also an annotation that helps me out with versioning of those endpoints, which ends up on something like…
Francisco Spaeth
  • 23,493
  • 7
  • 67
  • 106
0
votes
0 answers

jsp and thymleaf in one spring boot project, not working

Code(use V0.0.2) https://github.com/vikashsaini01/TaskFirst/tree/V0.0.2 Reffered this question for solution and tried to implement it but it didnt work. https://stackoverflow.com/questions/28480223/using-both-thymeleaf-and-jsp I am trying to…
Vikash
  • 2,046
  • 3
  • 23
  • 30
0
votes
1 answer

Spring Web: Download a File from a service via a Spring Service

I want to be able to download a file from a legacy service through a middle-layer Spring Web service. The problem currently is that I am returning the contents of the file and not the file itself. I've used FileSystemResource before, but I do not…
Deniss M.
  • 3,617
  • 17
  • 52
  • 100
0
votes
1 answer

Using equal sign for HttpStatus.BAD_REQUEST not working

I'm just wondering why using == to check equality of HttpStatus.BAD_REQUEST is not working: HttpStatus httpStatusCode ...; if (httpStatusCode == HttpStatus.BAD_REQUEST) {} I got it working by using equals method: if…
Julez
  • 1,010
  • 22
  • 44
0
votes
1 answer

Embedded tomcat not launching

I wanted to upgrade to spring boot 1.5.6 from boot 1.4.3. I created a simple web project using the spring initializer and added a simple Controller class. My pom.xml org.springframework.boot
Dhananjay
  • 1,140
  • 1
  • 12
  • 28