spring-4

Spring 4 RestController JSON: characteristics not acceptable according to the request “accept” headers

久未见 提交于 2019-11-26 11:28:03
问题 I am using spring 4.1.1.RELEASE and have included: jackson-core-asl 1.9.13 and jackson-mapper-asl 1.9.13 in pom to create a simple app with a RestController. Here is the repo: https://github.com/robikshrestha/samplespringrest.git Here is the failing war: https://github.com/robikshrestha/samplespringrest/tree/master/failingWar pom.xml: <?xml version=\"1.0\" encoding=\"UTF-8\"?> <project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi

WebSocket with Sockjs & Spring 4 but without Stomp

假如想象 提交于 2019-11-26 10:12:49
问题 Is there a way to use WebSockets with SockJS client and Spring 4 server but not using STOMP? Based on this tutorial from Spring\'s website, I know how to set up a WebSocket based application using Stomp and Spring 4. On the client side, we have: var socket = new SockJS(\'/hello\'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { setConnected(true); console.log(\'Connected: \' + frame); stompClient.subscribe(\'/topic/greetings\', function(greeting){ showGreeting

How to return JSON data from spring Controller using @ResponseBody

♀尐吖头ヾ 提交于 2019-11-26 06:38:04
问题 Spring version 4.2.0, Hibernate 4.1.4 Here is my Controller function: @RequestMapping(value = \"/mobile/getcomp\", method = RequestMethod.GET) @ResponseBody public List<Company> listforCompanies() { List<Company> listOfCompanies= new ArrayList<Company>(); listOfCompanies = companyManager.getAllCompanies(); return listOfCompanies; } Jackson JSON mapper dependency in Pom.xml : <!-- Jackson JSON Mapper --> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl<

Spring 4 - addResourceHandlers not resolving the static resources

孤街醉人 提交于 2019-11-26 06:37:59
问题 My maven spring project directory structure is shown below. I am using Spring-4 annotation based configuration. I configure the resources like below. I tried many ways that are suggested in many Stackoverflow questions and other websites Spring 4 loading static resources http://imwill.com/spring-mvc-4-add-static-resources-by-annotation/#.U5GZlXKs9i4 But the jsp files could not load the resources, all the static content requests returns 404 error. I tried these things in jsp, <link href=\