struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken McWilliams <>
Subject Re: struts2-rest-plugin issues getting non-restful urls to cooperate
Date Wed, 29 Jun 2016 17:21:30 GMT
I have not forgotten about this but in setting up a project I like
everything to work well, the restful urls and non-restful urls are more
less happy. My issue was with POST and PUT requests. The Action uses
model-driven, and with POST which calls create() all is well, while PUT
which calls update() and has almost identical code did not (there are a few
questions on StackOverflow with several different answers). The put method
also sets an id, and then decides to use model driven. I'm not sure what I
did wrong, anyways it somehow was solved out of frustration when I
re-implemented to use

So a couple observations as a first time user of the struts2-rest-plugin:
- I like the Idea of this extension of conventions, adding constraints can
make you think along certain tried and true methods and make work faster.
- It would be nice if somehow this plugin directly required the conventions
plugin such that it also was able to incorporate the convention
annotations; that is, while these restful conventions are good being able
to override the result with a tiles result (and all the other conventions
overrides afforded with the well though out annotations provided by the
conventions plugin) would be particularly interesting.
- Since I couldn't get such annotations working I need non-restful urls to
render the views, which then call the service provided by the rest-plugin,
that really isn't a big deal.
- Back to results, the rest-plugin seems to favor ContentTypeHandlers...
which I was not familiar with until I ran into an issue where I didn't like
what it was producing. I found that I could recycle the code of my
FlexJsonResult type, if I used ActionContext to get the action (I forget
why right now, but there is a difference in method arguments) then I had
enough information to render what was needed.
- In using the rest-plugin for crud operations, I felt the need to create
interfaces so I would be forced/reminded of what needs to be implemented,
Struts2 has ActionSupport, it would be nice if similar interfaces already
existed for the rest-result type as there are a lot more methods which
typically need to be implemented.
- The documentation shows model driven, so I assume that is the suggested
method of use: I really don't like how the models type is required to be
Object because we are to support the index() method, which returns List<T>
while the rest of the methods return T. So there are more often than not a
ternary operator in the getModel() method.

On Mon, May 30, 2016 at 12:18 AM, Lukasz Lenart <>

> 2016-05-27 17:41 GMT+02:00 Ken McWilliams <>:
> > I got it working but I think the documentation could be made with more
> > "hand holding". I'll post a "How to set up struts2 with conventions and
> > both restful and non-restful urls". Then self-answer  the question this
> > weekend with all the configuration and project set-up steps and then post
> > the link here for review, in-case there are any
> differences/recommendations
> > in setup.
> Great! Looking forward :)
> Best
> --
> Ɓukasz
> + 48 606 323 122
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Sent from my C64 using a 300 baud modem

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message