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

SrpingFramework Web Client RestTemplate ConnectionRefused exception

I have some code that is attempting to make a RestTemplate call to a REST API on another server: String url = "http://$authUrl:$authPort/cdpe/users/current"; HttpHeaders requestHeaders = new HttpHeaders(); requestHeaders.add("Cookie",…
cwittah
  • 349
  • 1
  • 3
  • 17
1
vote
0 answers

how to create a custom subclass of spring resttemplate

How do I create a subclass of spring rest template where interceptors are already set. The purpose of this is to avoid set interceptors everytime resttemplate is instantiated. I just want to use the instance of this custom class directly.
0
votes
1 answer

ColorHttpMessageConverter but missing default constructor of Color

To decode url-arguments to color I use this HttpMessageConverter: public class ColorHttpMessageConverter implements HttpMessageConverter { @Override public boolean canRead(Class clazz, MediaType mediaType) { return clazz…
Grim
  • 1,938
  • 10
  • 56
  • 123
0
votes
0 answers

Spring web returns invalid response

I am using spring-web-4.3.10.RELEASE library. I call postForEntity() method of RestTemplate (entity returns by getRestOperations()) from this library like this: getRestOperations().postForEntity(getEndpoint(), new HttpEntity(requestStr,…
user3782645
0
votes
0 answers

Use ThreadLocal for request scope passing of data

I made a Java 8 rest API using Spring Boot 2. The controller endpoints can be annotated with a custom annotation @DataAware. There is an HandlerInterceptor active which checks if the current request is mapped to a method with this annotation. If it…
user1884155
  • 3,616
  • 4
  • 55
  • 108
0
votes
1 answer

Getting NoSuchMethod Error while calling a PostMapping with Json Request

I'm creating a webservice, but when I call the http://localhost:8080/mdn/add endpoint, I'm getting a stacktrace, even though I expected that the JSON data would be stored in my database. This is the entity class: @Entity @Table(name =…
lalit bhadula
  • 47
  • 1
  • 9
0
votes
1 answer

Why are some URLs "forbidden" and some not in my web app

I have a web application that is experiencing weird behavior. When you try to bring up the app, it requests that you log in as expected, and takes you to the welcome page (/) you can then select either the profile (/profile) page or the search page…
bcr666
  • 2,157
  • 1
  • 12
  • 23
0
votes
5 answers

Spring boot application downloading JSP while hitting target, but not HTML

When I am hitting the URL it is downloading the JSP page but when I am using HTML page, it gets rendered in the browser. || HTML 1 - 0 JSP || Project structure Application…
Ashutosh Sharma
  • 118
  • 2
  • 18
0
votes
2 answers

How can I detect if the JSON object within Request body is empty in Spring Boot?

I want to return an error when the body of a REST request is empty (e.g contains only {}) but there is no way to detect if the request body contains an empty JSON or not. I tried to change @RequestBody(required = true) but it's not…
KareemDev
  • 15
  • 1
  • 5
0
votes
1 answer

How do I load static resource from another folder using Spring Boot

I have the following structure ui dist index.js backend src main java org example Application.java I am trying to present index.js as a static resource. I tried the following in my…
Jackie
  • 21,969
  • 32
  • 147
  • 289
0
votes
1 answer

RestTemplate with custom ConnectionPool?

I'm using the following config to create a RestTemplate bean. @Bean @Primary public RestTemplate restTemplate(RestTemplateBuilder builder) { HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory(); …
membersound
  • 81,582
  • 193
  • 585
  • 1,120
0
votes
4 answers

RestController not working with no errors

I created a Spring Boot application with spring-boot-starter-web using STS. Then created a RestController in a sub package and started the app. It showed no errors but rest endpoint not working. Hitting localhost:8080/ gives 404 error. I tried using…
0
votes
0 answers

Jackson: Ignore deserializing one property and leave it as list of strings

I have one rest service for updating an entity. As a web interface I'm using Spring web with Jackson for processing the request bodies. @PutMapping(value = "/save") public ResponseEntity saveForm(@RequestBody…
rusna
  • 366
  • 6
  • 20
0
votes
1 answer

Asp.net web api IHttpActionResult springboot Java Equivalent

hi I am new in springboot and I want to develop rest api in springboot. In .net web api IHttpActionresult type used to return entity and httpstatuscode in same time,is there any equivalent in spring boot
Bilgehan
  • 1,135
  • 1
  • 14
  • 41
0
votes
0 answers

Controller unable to understand when UUID is sent

I have an Spring-Web controller that is supposed to accept UUIDs as parameters: @RequestMapping(value = "/searchBy", method = RequestMethod.GET) public final String searchBy(@RequestParam UUID id) { //... } I am sending to it a simple GET request…
babylonian
  • 133
  • 2
  • 10