Questions tagged [spring-restcontroller]

@RestController is Spring MVC's shortcut annotation for creating Rest Controllers. Use this tag for questions relating to the use of this annotation.

@RestController is an Spring annotation that is used to declare controllers where all @RequestMapping annotated methods assume @ResponseBody semantics by default.

Useful links:

1579 questions
0
votes
1 answer

Response from controller not handled correctly with jquery

In a spring boot application with rest architecture I try to do a ajax call jQuery.ajax({ type: "PATCH", url: getHostName() + "/members/" + memberId + "/contracts/" + contractId + "?status=CANCEL", contentType: "application/json", …
robert trudel
  • 5,283
  • 17
  • 72
  • 124
0
votes
1 answer

Getting 404 response on spring 4 rest service

I am getting a 404 response from a @RestController returning an object. Everything seems fine as I get a correct response from another url in the same @RestController, but it is a different class. I see no exception or any other error in the logs…
dabicho
  • 383
  • 4
  • 19
0
votes
1 answer

Java Spring (Maven) REST API using OAuth2

Please help me with details given at article Secure Spring REST API using OAuth2. How to run the SpringRestClient from the given source code? Here's the pom.xml, what is missing?
Impavid
  • 435
  • 1
  • 6
  • 17
0
votes
1 answer

Custom controller without view name

I'm investigating now on how Spring Controller layer actually works. If I want to have a controller that returns a model and view name (e.g. HTML file name) I just extend AbstractController class, then implement a handleRequestInternal method,…
nowszy94
  • 3,151
  • 4
  • 18
  • 33
0
votes
0 answers

Not able to join url

I use spring boot in a rest architecture. I use jquery to call server url. @PatchMapping(value = "/members/{memberId}/payments/{paymentsId}") public boolean updatePaymentStatus(@PathVariable("memberId") Long memberId, @PathVariable("paymentsId")…
robert trudel
  • 5,283
  • 17
  • 72
  • 124
0
votes
1 answer

"org.springframework.dao.DataIntegrityViolationException: could not execute statement

This is the list class @Entity @Table(name = "list") public class List extends AbstractEntity { @NotNull @Column(name = "name") private String name; @Column(name = "description") private String description; @Column(name =…
A.S
  • 798
  • 1
  • 10
  • 32
0
votes
0 answers

Spring MVC RESTful gives ClassNotFoundError for commons-logging while configured to run on GlassFish, works fine on Tomcat

I am running a basic Spring MVC RESTful application with Glassfish 4. The servlet mapping from org.springframework.web.servlet.DispatcherServlet to the RestController is correct. Everything else is in place as well. Strangely everytime I run the app…
0
votes
0 answers

Spring MVC returns 405 for api call made from my android client

I have an android app which is making api requests to my server running Spring MVC. The RestController works fine when I make a request from the browser but it responds with 404 when I am making requests from android. Not sure why Here is code…
0
votes
0 answers

Angular2 calling external REST service is failing

I have a REST service with end point http://localhost:8080/hero-rest-service/getheroes. Response from this service is…
Ani
  • 722
  • 9
  • 27
0
votes
2 answers

How correctly implement a RESTful WS architecture using Spring MVC\Boot?

I am not so into RESTful web service and I have the following doubt about how to correctly implement RESTful style in my servics working on a Spring Boot application (Spring MVC is the same thing). So basically I have some controller class like…
0
votes
4 answers

Spring @RestController invoking large number of requests

I am implementing a REST API using Spring Boot and @RestController with Java 8. One of the controller methods needs to invoke another, 3rd party REST API service. The method is outlined as follows (data format is JSON): Call a 3rd party API method…
Web User
  • 7,438
  • 14
  • 64
  • 92
0
votes
2 answers

I can not get Json array from spring rest controller and fill jQuery DataTable

I have this method in controller @RequestMapping(value = "/updateWithParams", method = RequestMethod.GET) @ResponseBody public List updateWithParams() { List list = new ArrayList<>(); …
user5620472
  • 2,722
  • 8
  • 44
  • 97
0
votes
0 answers

Spring can't handle serializing response object to json

I have some error in serializing response object in spring restful and it is not connected with my classes in order to exceptions messages. I gave up debugging it. Maybe you can help me. Code is first, than I put my questions and errors. I debug…
Piotrowy
  • 605
  • 8
  • 20
0
votes
2 answers

Spring Security not working over RestServices

I have a RestController working and I want to learn how to enable Basic Auth with Spring Security. I've created a class that extends WebSecurityConfigurerAdapter and for what I understand, it should be enough. Sadly I can call the resources without…
0
votes
1 answer

Force Swagger to expose details of Request Object

I am creating a Rest Service using Spring boot and for documentation I am using Swagger(via SpringFox). And it is almost working fine. The issue arises when I moved all of my query parameters to a request object and used that in the method signature…