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
1 answer

Post authorizing Spring asynchronous controller response

I have a REST controller with a GET method. It returns a resource. I want to verify if the resource belongs to the authorized user by comparing the owner field on the Resource with the authorized user's login. With a normal synchronous request I'd…
jannis
  • 4,843
  • 1
  • 23
  • 53
0
votes
3 answers

How do i effectively check a picture repository website for changes?

I am currently developing a synchronization service that fetches all user profile pictures from an exchange server. In order to track changes, i have decided to MD5 encode the response body and persist it with the entity in the database in order to…
cristianhh
  • 128
  • 12
0
votes
1 answer

Spring HttpServerErrorException custom response body not being serialized

I have a Controller like this example: @RestController @RequestMapping(value = "/risk", produces = {MediaType.APPLICATION_JSON_VALUE}) public class CalculationController { @RequestMapping(value = "/calculate", method = RequestMethod.POST) …
0
votes
1 answer

Posted objects in RequestTemplate end up having null fields once they reach the RestController

I am trying to save a domain object via my REST api from within another Spring MVC application using RestTemplate. It successfully makes the call to the api, but the foo and bar fields of TheThing object end up being null once it reaches the rest…
secondbreakfast
  • 4,194
  • 5
  • 47
  • 101
0
votes
1 answer

Spring authentication page change

Sorry about the poor title, I didn't know how to put it in words. My issue is that I created using Spring Initializr a project with: Spring Web Spring Security Spring Actuator Spring…
0
votes
1 answer

Is it possible to add your own text/event-stream Serializer to Spring Boot 2.0.0?

Currently the only serialization of text/event-stream is done via ServerSentEventHttpMessageWriter. Is it possible to provide your own writer to change the way the data is serialized (providing a different format besides the SSE format) ?
user1568967
  • 1,816
  • 2
  • 16
  • 18
0
votes
1 answer

Error when creating restful controller test with xml

I'm trying to create a controller test with payload in xml, using MockMvc, But when I run the test the following error appears: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; [Fatal Error]: 1: 1: Premature end of file. My test…
Tiago Costa
  • 1,004
  • 4
  • 17
  • 31
0
votes
1 answer

Java Spring - Add and remove Filter at runtime

I have a request dumper filter that I want to activate/deactivate at runtime (using a custom actuator endpoint). However I cannot find a way to do so without restarting the app. My current solution does just that: @Configuration public class…
Pete
  • 10,720
  • 25
  • 94
  • 139
0
votes
1 answer

InterceptingAsyncClientHttpRequestFactory Use

I was trying to understand the use of InterceptingAsyncClientHttpRequestFactory. When run test with MockRestServiceServer I saw requestFactory is decorated with this ResquestFactory. Is there any other use of this requestFactory? Basically I want to…
Vijendra Kumar Kulhade
  • 2,217
  • 3
  • 15
  • 25
0
votes
1 answer

spring web support for optional multi-valued parameters

I have a spring web 4.3.4 app with a REST endpoint: @RequestMapping(value = "/doStuff", method = RequestMethod.GET) public ResponseEntity findSomething(@RequestParam(value = "status") Optional> statusFilter) { …
Michael Böckling
  • 7,341
  • 6
  • 55
  • 76
0
votes
2 answers

How to fetch data using RestTemplate in Spring

My task is writting a code to fetch data from rest API via URL like this curl -k -v -XPOST -H "username: password" -H "Content-type: application/json" http://localhost:8181/api/rest/person/query -d ' { "name": "person's name", …
Thịnh Kều
  • 163
  • 1
  • 1
  • 17
0
votes
0 answers

ModelAndView thread-saftey Spring Boot web app

Is using the ModelAndView in this manner "thread-safe"? The UserToken bean passed on the constructor is session-scoped and proxied, so each user should be accessing their own token, right? Or is using the same ModelAndView for all requests…
rayduels
  • 83
  • 1
  • 5
0
votes
1 answer

How to validate request against XSD and return an error object?

My task is to implement a webservice that: consumes an XML file on a POST endpoint in happy flow, it returns a DTO as JSON + HTTP 2xx the incoming XML file is validated against a XSD; if the validation fails, a JSON with a list of all validation…
Maciej Papież
  • 431
  • 1
  • 6
  • 20
0
votes
1 answer

Spring 4 WebApplicationInitializer not being called

here is my code: public class HelloWorldInitializer implements WebApplicationInitializer { @Override public void onStartup(ServletContext servletContext) throws ServletException { // TODO Auto-generated method stub …
0
votes
1 answer

Exception while querying Elasticsearch through spring-boot-starter-data-elasticsearch

I am learning spring-boot-starter-data-elasticsearch with gradle. I have defined below dependencies in my .gradle file: dependencies { compile 'org.slf4j:slf4j-api:1.7.21' compile…
anonymous
  • 483
  • 2
  • 8
  • 24