aspose file tools*
The moose likes Struts and the fly likes I cannot get rest plugin to hit my setters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "I cannot get rest plugin to hit my setters" Watch "I cannot get rest plugin to hit my setters" New topic
Author

I cannot get rest plugin to hit my setters

Brendan Gibson
Greenhorn

Joined: Apr 02, 2010
Posts: 3
I am trying to use Restful URL's like

"/Books/12345"

I can get

"/books/12345"

working, but have been unable to change the Action URL to be able to use one with an initial capital letter.

I have tried

public class BooksController

@Action("/Books")
public HttpHeaders show() {
...
}

public void setId(String id) {
this.id = id;
}

which hits show(), but not setId() if my URL is "/Books/12345", however it still works if my URL is "/books/12345"

How do I get a changed path (from the convention) to hit my setter method?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What version? (I don't know what the Convention plugin does to URLs during request processing--is there a compelling reason to have upper-case URLs?)
Brendan Gibson
Greenhorn

Joined: Apr 02, 2010
Posts: 3
The compelling reason that I am doing this is because the functionality exists (using apache) - I want to port it to using Struts, and we want to respect old bookmarks by using the same URL naming scheme.

I am trying to use version 2.1.2

Perhaps there is another way to read the id. In an interceptor perhaps?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

The issue isn't the id, it's the prefix: did you check the plugin source?
Brendan Gibson
Greenhorn

Joined: Apr 02, 2010
Posts: 3
Good idea! I'll play with it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I cannot get rest plugin to hit my setters