0

I am using Java with Spring framework.

I have a multiaction controller which is having lots of service methods, and I want to to create restful URLs like as following:

http://server.com/url/events/multiActionMethod1

http://server.com/url/events/multiActionMethod2

http://server.com/url/events/multiActionMethod3

http://server.com/url/events/multiActionMethod4

http://server.com/url/events/multiActionMethod5

How can I achieve above tasks?

1 Answer 1

1

I think maybe something isn't coming through clearly in your question. It reads like all you're looking for is this:

@RequestMapping("/events/multiActionMethod1")
public ReturnType multiActionMethod1(SomeParameter param) {
  //request handling logic
}

is there more to the question you could elaborate on?

edit: ugh no, none of that is in 2. You'd need 2.5 for annotations and 3 if you want support for using parts of the url as parameters. The easiest thing to do if you really want it to work that way in an older version is slap a URL rewriter on the front and convert it to regular query string before it hits spring.

Sign up to request clarification or add additional context in comments.

2 Comments

will this code also be able to handle /events/multiActionMethod1/event_id_here
@Faisal no. it's bean introduced in Spring 2.5.x. Why use that old stuff anyway? Update to 3.x!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.