observer
observer

Reputation: 725

Spring RESTful server

I want to set up an application using RESTful principles and Spring. I found out the RESTemplate for the client-side but I don't know how to configure the server. First I want to create a simple application in which the server simply respond with an Hello {name} string after a myserverapp:8080/{name} request. Can someone help me, maybe with Java code? Thanks.

Upvotes: 0

Views: 797

Answers (3)

dardo
dardo

Reputation: 4960

Might also want to look into using Jersey, allows you to decouple your web layer from your REST layer. Using Spring's method, you need to init a controller etc. can take away from what the purpose of a controller is serving.

I have used both technologies, and it really depends on what you want to do, currently I'm writing an app using backbone.js which uses Jersey to serve up the REST, and Spring MVC as a front end to render the jsp pages.

Upvotes: 0

fmucar
fmucar

Reputation: 14548

You need to start researching a little bit via google.

http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/htmlsingle/spring-framework-reference.html#rest-resttemplate

sample:

    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
    public String delete(@PathVariable("id") Integer id)

Upvotes: 1

Alex Barnes
Alex Barnes

Reputation: 7218

It really does sound like you need to read the Spring docs and have a look around for examples on the internet (there are a lot)!

Here is one which I think it very clear and straightforward to get you started.

Upvotes: 1

Related Questions