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

Using @ConfigurationProperties statically - such as on @RequestMapping

Let's ignore for a moment whether doing this is a great idea, but I'm creating Spring Boot AutoConfiguration for an internal library and as part of this I want to auto-register a Controller that accepts GET/POST/DELETE requests (it is responsible…
Ben M
  • 1,833
  • 1
  • 15
  • 24
1
vote
1 answer

404 Error in Postman - Spring Rest

I am getting a 404 error when I test my REST Spring WebService in Postman. Can anyone suggest a solution?? My code…
user7005380
1
vote
0 answers

Redirect in Spring Web MVC not loading the redirected page

I have used POST request to the login API '/login' using JQuery (AJAX); and returned the dashboard page by return "redirect:/dashboard". In the network tab of my browser, on preview section I can see the requested page but it's not reflecting on the…
Nalin Adhikari
  • 586
  • 2
  • 6
  • 15
1
vote
0 answers

Class not found exception for WebMvcConfigurerAdapter, relevant class in Spring Data REST

I am new to Spring Data REST, I am not supported to use methods from spring-webmvc.jar. so I am planning to use @BasePathAwareController or @RepositoryRestController but I am seeing class not found exception for WebMvcConfigurerAdapter. I know that…
1
vote
1 answer

Spring Boot (1.3.5) - Default Error View

I'm using Spring Boot (v1.3.5.RELEASE). And in the docs, there's this short section regarding error-handling: Spring Boot provides an /error mapping by default that handles all errors in a sensible way, and it is registered as a ‘global’ error page…
user6679745
1
vote
0 answers

Spring SessionRegistry provides empty session lists when @EnableJdbcHttpSession is used

Since I persisted the session information of resilient and load balanced spring-boot based microservices to PostgreSQL DB by adding @EnableJdbcHttpSession to our config, the SessionRegistry provides no information at all anymore (e.g.…
1
vote
0 answers

How to return a JSON in @ExceptionHandler when a resource is not found

How an application which serves resources (.js; .css...) could return JSON entities if an error occurs ? I wrote a ControllerExceptionHandler according to this blog: package com.my.rest; import com.my.rest.errors.ErrorMessage; import…
Pleymor
  • 2,611
  • 1
  • 32
  • 44
1
vote
1 answer

How to use @XmlJavaTypeAdapter in @RestController parameters?

I have the following restcontroller, and would like to get-query the controller with thedate=2016-08-08 format. It should be automatically converted to java.time.LocalDate. But my XmlAdapter is not working. Why? import java.time.LocalDate; import…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
1
vote
1 answer

GET request with nested objects in @RestController?

Is it possible to create a GET webservice in spring and using nested properties in the query? Like search.limitResults in the following example: localhost:8080/firstname=test&search.limitResults=10 You get the idea. Can this be…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
1
vote
2 answers

PUT request with unbuffered RestTemplate

Using Spring RestTemplate, buffer request body set to false and empty body SimpleClientHttpRequestFactory requestFactory = new…
dmitryvim
  • 1,983
  • 4
  • 15
  • 27
1
vote
1 answer

Spring REST: Bad Request for pojo with LocalDateTime

Pojo.java: public class Pojo { private LocalDateTime localDateTime; private String message; // Getters, setters, toString(). Controller: @RequestMapping(value = "/test", method = RequestMethod.POST) public ResponseEntity
Johannes Flügel
  • 3,112
  • 3
  • 17
  • 32
1
vote
0 answers

Start embedded Jetty using WebApplicationInitializer

I am creating Restful (Jax-RS) services to be deployed to Fuse 6.2.1. (using Apache CFX, and deploying with OSGi bundles to Karaf) The server supports only up to Spring 3.2.12.RELEASE. I am attempting to do everything with next to zero XML…
crig
  • 859
  • 6
  • 19
1
vote
1 answer

@ExceptionHandler not being invoked test

I have been going round and round in circles trying to fix a test and nothing on SO or other online sources have provided a solution. I have this @ControllerAdvice method to handle the MyException Exception which is: @ControllerAdvice public class…
joelc
  • 331
  • 3
  • 9
1
vote
1 answer

RestTemplate returning null for getForEntity call

This returns status 200, final ResponseEntity responseEntity = rt.getForEntity( myURL, MyWrapper.class); and http headers: {X-Powered-By=[Servlet/3.0], Content-Type=[application/json; charset=UTF-8],…
ergonaut
  • 6,929
  • 1
  • 17
  • 47
1
vote
0 answers

Setting up DispatcherServlet without init-param

Hey i'm trying to wire up multiple dispatcher servlets in my web application (one dispatcher servlet and one message dispatcher servlet actually). All these servlets need to share all my beans, so i'm wiring the application context as a…
alokraop
  • 853
  • 1
  • 11
  • 29