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

Modify object serialization depending on what class is being serialized

So my goal is to return some objects as the response body from a Spring REST controller. The thing is, these two objects point each other, something kind of like this: public class Person { private Set teams; } public class Team { …
Unai P. Mendizabal
  • 174
  • 1
  • 1
  • 6
0
votes
3 answers

Can not access deployed WAR file on Tomcat

I have a Spring boot rest service project which works on my local machine. When I run the application as "Spring Boot App" I can access the rest service by going to http://127.0.0.1:8080/persons/all and it returns JSON as it's supposed to. I…
Arya
  • 8,473
  • 27
  • 105
  • 175
0
votes
1 answer

Is there a way to know which full URL the Spring controller is going to map?

I have a Spring Controller, @Controller @RequestMapping(value = "/employee") public class EmployeeController { @Autowired private EmployeeService employeeService; /** * returns all the employees in the datastore. * * @return list of all…
Pratik
  • 695
  • 2
  • 11
  • 29
0
votes
1 answer

Unable to bind list of checkboxes in Thymeleaf to get modified data POSTed back

I'm trying to write a UI for user management and one of the important things is ability to change user roles. Model is simple, user belongs to many roles, role has many users. The code below presents self contained @Controller for editing existing…
agilob
  • 6,082
  • 3
  • 33
  • 49
0
votes
1 answer

spring boot embedded tomcat append log to every tomcat request

I am using spring boot version 1.3.3. With the embedded tomcat. For each web requests I would like to know how intercept a web request and do some custom code then continue on with the request. My hunch is that I would override some default servlet…
Robbo_UK
  • 11,351
  • 25
  • 81
  • 117
0
votes
2 answers

Spring Getting Started Guide "Accessing JPA Data with REST" not working

I'm learning Spring using the Getting Started Guides. Right now I'm trying to complete "Accessing JPA Data with REST" guide but my code didn't work, so I tried the "complete" version, and it doesn't work too. So far everytime I import content using…
0
votes
1 answer

Cannot pass data from view to controller

Can anyone explain, how to pass id from view to controller? sources The problem: when trying to edit existing task, I have a new task added. With new edited name. @RequestMapping("/edit/{id}") public String editTask(@PathVariable("id") Long id,…
0
votes
0 answers

Consuming Json from yahoo finance using RestTemplate

I'm trying to get some financial data from yahoo finance using java / spring RestTemplate. Suppose I need the data for IBM, the link would be something like this:…
Charbel
  • 14,187
  • 12
  • 44
  • 66
0
votes
0 answers

Spring Filter ClassCastException when running project on Websphere 8.5

I am getting following error when I try to run my project on WebSphere 8.5.I used scope provided and exclusion thing but its not working.Seems servlet-api.jar is being taken from Web Container.The Spring-web version I am using is 3.0.5 Error…
0
votes
2 answers

Angular: how to post a file to the server on form submit

I have a form that's being posted to my back-end (Kotlin, Spring Web). That form had some text inputs and the post worked flawlessly. But when I added a file input, the post stopped working, returning the following error: {status: 400, error: "Bad…
Marcos Tanaka
  • 3,112
  • 3
  • 25
  • 41
0
votes
0 answers

Serve static web content and a REST API via Spring Web MVC

Important note: I am looking for a working version and not some code snippets. Please undo the duplicate, because I can't do anything with the answer from the other thread (Please read the second part of my question - unrelated to resources). I want…
0
votes
1 answer

Spring MVC Maven Jar Hell : The hierarchy of the type "ExtendedMappingJacksonJsonView" is inconsistent

I have done all I can to fix this error, added some exclusions in my pom file, but still not able to figure out why am I getting this error. pom.xml
Rajkumar
  • 440
  • 7
  • 31
0
votes
0 answers

struts2-spring-plugin with spring session scope bean

I have web RestClient with struts2 MVC and spring DI and use struts2-spring-plugin to inject after login Authenticated RestClient bean to struts2 Actions in session scope. If I have in web.xml ContextLoaderListener needed for…
sytolk
  • 7,223
  • 3
  • 25
  • 38
0
votes
1 answer

Spring rest controller result wrapping with JsonView / MappingJacksonValue

I have a Spring API that allows the user to specify the JsonView of each call using a view param like so: /api/v1/person/1?view=viewName I then use Spring's MappingJacksonValue to set the correct view dynamically instead of using @JsonView()…
RVP
  • 2,330
  • 4
  • 23
  • 34
0
votes
1 answer

Spring Security Unexpected Behaviour for Public Endpoints

I have a Spring HttpSecurity configuration as @Override protected void configure(HttpSecurity http) throws Exception { http .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS); …
F.O.O
  • 4,730
  • 4
  • 24
  • 34