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

Do i need to flush or close the OutputStream in my custom Spring Web MessageConverter

I've build a custom Spring Web MessageConverter and overridden the writeInternal method. Should i call flush on the getBody() OutputStream? Should i close the getBody() OutputStream? there's seems to be quite the mismatch between the different…
Chris DaMour
  • 3,650
  • 28
  • 37
2
votes
2 answers

Spring WebApplicationInitializer (ServletContainerInitializer, @HandlesTypes) with Embedded Tomcat

I fail to understand why in the following minimal project my implementation of Spring's WebApplicationInitializer interface is found when running tests within Eclipse and IntelliJ, but not when using Maven (mvn clean test). With Eclipse and IntellIJ…
C-Otto
  • 5,615
  • 3
  • 29
  • 62
2
votes
0 answers

Principal argument null for anonymous user in ResourceServer

I have an extremely simple sample app here: https://github.com/timtebeek/anonymous-principal Relevant bits copied below: ResourceConfig.java @Configuration @EnableResourceServer public class ResourceConfig extends ResourceServerConfigurerAdapter { …
Tim
  • 19,793
  • 8
  • 70
  • 95
2
votes
3 answers

Spring Boot static content url mapping

Is anybody here who know how to create a mapping file from static directory to respond for certain url in Spring Boot? For example, I have file in directory /resource in Spring Boot structure resources/static/html/index.html and I want it to…
Piotr Żak
  • 2,083
  • 6
  • 29
  • 42
2
votes
1 answer

File download via ajax+spring-web

I have some xml files stored as strings in my database and scala+spring based backend with this controller: @RequestMapping(value = Array("/download"), method = Array(RequestMethod.GET)) def downloadFile(@RequestParam filename: String, //some more…
Everv0id
  • 1,862
  • 3
  • 25
  • 47
2
votes
1 answer

Combined Spring Boot integration & web application won't start

I have created two Spring Boot applications. One uses Spring Integration to read stuff from several feeds and the other combines the retrieved data from the feeds on a simple web page. Currently these two exist as separate apps but I want to combine…
Deddiekoel
  • 1,939
  • 3
  • 17
  • 25
2
votes
3 answers

AngularJS POST for PDF data always fails

I'm trying to work around Internet Explorer's URL limits (refer to this Microsoft support article for more information) in order to generate a PDF. I have a base-64 encoded String representing a PDF's byte stream in my client-side JS. For Firefox…
Roddy of the Frozen Peas
  • 14,380
  • 9
  • 49
  • 99
2
votes
1 answer

Spring RestTemplate + map XML result to Domain object

With the use of Spring RestTemplate, how can map following XML result to some Domain Object? As a solution I have designed following Domain classes but I am wonder whether how can I map those contain values (ex: 100, 200, 300) to domain object…
Channa
  • 4,963
  • 14
  • 65
  • 97
2
votes
3 answers

Invalid controller configuration at Spring MVC 4

I am new to Spring framework. I would to develop a simple web-app that displays a hello.jsp content based on url "/greeting.html". But now, it gives me 404 error. What am I doing wrong? Here is the github repo for my project (this project was…
mr.M
  • 851
  • 6
  • 23
  • 41
2
votes
0 answers

Conflicting application contexts when combining @EnableWebMvc with @EnableContextResourceLoader (a spring-cloud-aws annotation)

I am attempting to integrate with Amazon S3 using spring-cloud-aws. The application is web-based and uses @EnableWebMvc on the configuration. When I add the @EnableContextResourceLoader annotation so that I can access files in S3 buckets, I receive…
pens-fan-69
  • 979
  • 7
  • 11
2
votes
0 answers

Spring Rest Controller url mapping inheritance

I have multiple REST controllers and would like all the url's to have "/rest" as the common url pattern. E.g. (1) UserController: http://localhost:9000/rest/user (2) TicketController: http://localhost:9000/rest/ticket Is there a way i can…
Prashant
  • 151
  • 1
  • 2
  • 10
1
vote
1 answer

Spring REST - Deserializing object from GET request query

I'm trying to implement an endpoint that takes a serialized object from request parameter and deserializes it into a POJO. Is there an easy way how to do this with Spring? The example of a…
fugasjunior
  • 461
  • 1
  • 6
  • 22
1
vote
1 answer

Spring WebMVC Exception Handling

I have a global exception handler that extends ExceptionHandlerExceptionResolver that handles exceptions thrown from my @RestController. The JSON payload returned in the response includes an "exception" field. E.g. { "timestamp":…
blackcompe
  • 3,180
  • 16
  • 27
1
vote
0 answers

Using Async-IO of servlet3.1 with Spring

How to use Async-IO(setWriteListener) of Servlet3.1 with Spring-5 ? Also, I found Link-A which mentions one needs to add Listener to outputStream. On other hand Link-B says it should work with spring 5 and tomcat 8.5+. Next I profiled a JVM and…
Bhuvan
  • 4,028
  • 6
  • 42
  • 84
1
vote
1 answer

Send an HTTP request through a specific network interface using Spring RestTemplate

I am using Spring RestTemplate and I need to force my client to send an HTTP request through a specific network interface. I already found a solution using java socket: NetworkInterface nif =…
Zak FST
  • 361
  • 3
  • 6
  • 17