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
2 answers

Not able to insert into database. Getting java.lang.UnsupportedOperationException: Not supported by BasicDataSource

I am trying insert data into mysql. But whenever I call the service I get the below mentioned error. Project Setup: Project Build : Gradle Backend Server : Mysql an hava java, resources type structure similar to maven. MainApplication with main…
Vishal
  • 130
  • 1
  • 11
0
votes
1 answer

Result of using ResponseEntity with no return value

I use spring boot and it's one of my rest controller @RequestMapping(value = "/members/{memberId}/creditcard", method = RequestMethod.PUT) public ResponseEntity saveCreditCard(@PathVariable("memberId") Long memberId, @RequestBody CreditCardInfoDto…
bernard deromme
  • 151
  • 2
  • 3
  • 19
0
votes
0 answers

How to make the @RestController do not response data as restful?

I want to response a type of String as "redirect:http://www.stackoverflow.com" and expected that the browser would auto redirect to the address as what I want. But, it was failed when I use a "@RestController".(based on SpringBoot…
Jarvis
  • 371
  • 1
  • 10
  • 22
0
votes
0 answers

Spring API Rest - Creating new Custom Controllers and Registering in the /info

I've create a simple controller in my Spring Rest service: @Configuration @EnableAutoConfiguration @EnableEurekaClient @RestController @RequestMapping(path = "/composite") public class CompositeController { @Autowired private Composite…
cgval
  • 1,096
  • 5
  • 14
  • 31
0
votes
0 answers

spring jpa embeddable class send int instead of Object

I have a little problem between my RestController response and my AngularJs Controller. First, I'm calling my rest webservice with $http : myModule.controller('UserDetailsCtrl',function($http, idUser){ var self = this; …
0
votes
0 answers

Get connected user information

in a spring boot application, i use spring security and rest. My setup of my security. public class GymApplicationSecurity extends WebSecurityConfigurerAdapter { @Autowired private RESTAuthenticationEntryPoint authenticationEntryPoint; …
robert gagnon
  • 311
  • 1
  • 5
  • 14
0
votes
1 answer

manage error and sent it to the client

I use spring, spring boot and spring-rest controller and i begin with error. My controller @RequestMapping(value = "/members/{memberId}/creditcard", method = RequestMethod.POST) public void saveCreditCard(@PathVariable("memberId") Long memberId,…
robert trudel
  • 5,283
  • 17
  • 72
  • 124
0
votes
1 answer

angularJs, Spring MVC : how to send data to Spring controller

I'm trying to send an image from my web app to my Spring RestController; but I don't manage to cast Object which I receive. ANGULARJS - CONTROLLER : myModule.controller('InscriptionCtrl',function($location, $http){ var self = this; …
0
votes
0 answers

Ajax Server Call Success but go to error area

I use spring boot and jquery. I do an ajax call. var memberId = $('#memberId').val(); var type = "put"; var url = getHostName() + "/members/" + memberId + "/payments/" + paymentsId + "/process/" + paymentMode; jQuery.ajax({ type: type, …
robert trudel
  • 5,283
  • 17
  • 72
  • 124
0
votes
1 answer

pass a list of long with spring rest

I am using spring boot, spring v4.2.5 I am trying to pass a list of long. My controller is : @RequestMapping(value = "/rest/members/{memberId}/payments/{paymentsId}/process/{paymentMode}", method = RequestMethod.PUT) public void…
robert gagnon
  • 311
  • 1
  • 5
  • 14
0
votes
1 answer

Sending text area values as request to spring is always null

I have two textarea boxes like this:

kittu
  • 6,662
  • 21
  • 91
  • 185
0
votes
2 answers

request not passed to rest controller in spring

I have my rest controller like this: @RestController public class SmsRestController { @RequestMapping(value = "/sendSMS", method = RequestMethod.POST, consumes = "application/json") public ResponseEntity sendMessage(SmsBean smsBean) { …
kittu
  • 6,662
  • 21
  • 91
  • 185
0
votes
1 answer

Error 415 - Unsupported Media Type with Spring 4

I am upgrading Spring from version 3 (XML based) to 4.2.4 (annotation based) Controller @RestController public class XnetOrderResourceController{ @Autowired private XnetOrderDao orderDao; /* * GET All Orders */ …
0
votes
1 answer

Why HTTP 501 error of type JSON presented to UI as text/html instead of application/json?

I have front-end Angular running on Apache with back-end Spring REST API on Tomcat. I wanted to throw 500 error in some error case and want that response to be presented as Json to UI (Content-Type as application/json). This works fine in my local…
Anil Konduru
  • 878
  • 10
  • 18
0
votes
1 answer

error reporting in AngularJS (and Spring ResponseEntity)

I have an AngularJS front end calling an app-service which just returns some dummy data. The application intermittently fails on this call and I can't work out why. I have 'logging' (to console) in the Spring REST service which shows there is no…
gringogordo
  • 1,990
  • 6
  • 24
  • 60