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

Use @RequestParam for DTO fields implicitly

Controller @RequestMapping(method = RequestMethod.GET) public ResponseEntity> getAllUsers( @RequestParam(defaultValue = "") String q, @RequestParam(defaultValue = "") String[] fields, …
letthefireflieslive
  • 11,493
  • 11
  • 37
  • 61
1
vote
1 answer

@GetMapping annotation in Spring portlet

Is @GetMapping supported in spring-webmvc-portlet-4.3.1 ? For me it is not and this is what I see when trying to deploy a portlet : java.lang.IllegalStateException: No portlet mode mappings specified - neither at type nor at method level If not…
user3487063
  • 3,672
  • 1
  • 17
  • 24
1
vote
0 answers

spring web socket server and react client

i have to develop a web socket server with spring that send to the client a message avery 5 sec. The client is written in react js. This is my server code: @SpringBootApplication @EnableAsync @EnableScheduling public class TestwsApplication { …
esoni
  • 1,362
  • 4
  • 24
  • 37
1
vote
2 answers

Spring boot change server port

I have created Spring Maven project (using archetype maven-archetype-webapp) for web application. I need to bind on ip different from localhost and different port. I have created file "application.properties" in resources folder and added following…
AlexP
  • 449
  • 2
  • 9
  • 25
1
vote
1 answer

SSL (HTTPS) support in functional web framework

How am I supposed to to configure SSL for a Spring Boot Service using the functional web framework? The configuration via setting server.ssl.* properties does not work (meaning nothing happens at all) and if I am reading the docs right, only…
nonpolar
  • 55
  • 5
1
vote
2 answers

How do I inject a buffered reader into a class with a file reader as its parameter using Spring boot?

I have this spring boot application in which I have the below line inside a method. BufferedReader reader = new BufferedReader(new FileReader("somePath")); How can I inject this into my code so I can mock it for my unit tests? Using guice I could…
AnOldSoul
  • 4,017
  • 12
  • 57
  • 118
1
vote
1 answer

How to implement a generic HTTP request/response logging with web reactive

With the "traditional" web framework, one could use e.g. AbstractRequestLoggingFilter for implementing a generic logging filter. With web-reactive the filter isn't called anymore (what makes sense, since it operates on HttpServletRequest). Can…
nonpolar
  • 55
  • 5
1
vote
0 answers

Spotify Web API + Authentication Client Credentials Flow

I am new on Spotify Web API and I am facing some problems to get the token through the Client Credentials Flow. I could implement the request at Advanced REST Client with the following configs: The request by Advanced REST Client To represent this…
1
vote
1 answer

HTML templates in spring boot similar to play framework

I have worked with PlayFramework for Scala. Now I am starting with Spring (Spring Boot) for the first time. Is their any way to make HTML templates similar to Play framework. e.g. passing HTML content into a main(main.scala.html) HTML file.
1
vote
1 answer

Spring Cloud Stream - Mock Source always failed (without an existing MQ instance)

I have a RestController which has a @autowired Source attribute. I want to add some test cases of RestController. But it always fails, because the Source needs a real message broker. So my question is: can i mock Source or is there a existing way to…
JasonS
  • 445
  • 1
  • 5
  • 17
1
vote
1 answer

Spring controllers not being found

I am trying to create a RESTful service using spring web reactive. I have a controller that has the usual structure package com.hcl.bc4sc.server.controller; ... @RestController @RequestMapping("/api/v1/registrar/enroll") public class…
1
vote
1 answer

Form not posting values, 'browser edit and resend' is working

I am using Spring mvc web to submit a form. Form is rendering fine however when I am submitting this form, I am getting http status code 400, however if I use 'edit and resend' function of firefox, it is hitting corresponding controller method…
1
vote
0 answers

Primefaces Ajax Fails with 404 error code

I realized the ajax requests primefaces is making behind the scene, e.g. paging,wizard form, is failing. And when i check i console i see there's 404 error because the url used in making the request is not what is mapped by the controller. See…
Michael Dugah
  • 59
  • 1
  • 9
1
vote
0 answers

spring-web: get @RequestBody as a JSONObject

I've been hitting a block while using the spring-web library (installed via Gradle, so dependencies are installed). I know that i can use @RequestBody to input POSTed request contents and convert it into a POJO via the Jackson Unmarshaller like…
Technohacker
  • 735
  • 5
  • 19
1
vote
1 answer

Spring and returning large volume of Json data

My project is based on Java 8 and uses Spring throughout I have a service that returns a bean which contains a list of beans in it. Here is the code API Method @RequestMapping(value = "/search",", produces = { MediaType.APPLICATION_JSON_VALUE },…
Damien
  • 4,081
  • 12
  • 75
  • 126