Re: How to find location of an action

2017-12-28 Thread Dave Weis
On Thu, Dec 28, 2017 at 1:55 AM, Lukasz Lenart 
wrote:

> 2017-12-27 21:06 GMT+01:00 Dave Weis :
> > Would it be a correct assumption that changing the property
> > struts.convention.relative.result.types to add 'tiles' would let me use
> my
> > tiles definitions? There's no mention at all of tiles in the document at
> > http://struts.apache.org/plugins/convention/ .
>
> I'm using a custom UnknownHandler [1] to resolve Tiles definitions
> using namespace, action name and result name
>

That's a nice and elegant way to handle it, thank you!
dave


Re: Action url

2017-12-28 Thread Yasser Zamani


On 12/28/2017 1:11 PM, Tamás Barta wrote:
> Your suggestions are ok for processing requests but are not to write urls
> (how to determine correct url) in jsps or other presentation layer output.
> To handle both sides a more sophisticated solution is needed.

As far as I can think, it seems you have to have a table (siteId, 
action, url) for mapping. Then will have to override action mapper like 
rest-plugin but is very simpler. Then will have to override Struts tags 
whom generate url e.g. url and action tags and use your customized tags 
in all jsps instead. Generally you will have both sides translator based 
on that mapping table.

These are all what I'm able to think and I'm not sure if are good practices.


Re: Action url

2017-12-28 Thread Tamás Barta
Your suggestions are ok for processing requests but are not to write urls
(how to determine correct url) in jsps or other presentation layer output.
To handle both sides a more sophisticated solution is needed.

2017. dec. 28. 10:19 ezt írta ("Yasser Zamani" ):

>
>
> On 12/28/2017 12:21 AM, Tamás Barta wrote:
> > For example there is a web application which has a LoginAction action. On
> > one site it is needed to access it via /login, on the other site
> /user/log.
> >
> > It is just an example. The urls shouldn't be hard-coded in action
> > annotations as I don't want to clone the web application just to change
> > urls.
>
> I think you can do these in several layers. At web server layer [1].
> Simpler, at Servlet layer [2] or more harder, at Struts layer like [3].
> It seems you just need rewriting url before Struts and if I were you, I
> tried [2], a Servlet filter before Struts filter.
>
> [1] https://en.wikipedia.org/wiki/Rewrite_engine#Web_frameworks
> [2] http://tuckey.org/urlrewrite/
> [3]
> https://github.com/apache/struts/blob/master/plugins/
> rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java#L188
>


Re: Action url

2017-12-28 Thread Yasser Zamani


On 12/28/2017 12:21 AM, Tamás Barta wrote:
> For example there is a web application which has a LoginAction action. On
> one site it is needed to access it via /login, on the other site /user/log.
> 
> It is just an example. The urls shouldn't be hard-coded in action
> annotations as I don't want to clone the web application just to change
> urls.

I think you can do these in several layers. At web server layer [1]. 
Simpler, at Servlet layer [2] or more harder, at Struts layer like [3]. 
It seems you just need rewriting url before Struts and if I were you, I 
tried [2], a Servlet filter before Struts filter.

[1] https://en.wikipedia.org/wiki/Rewrite_engine#Web_frameworks
[2] http://tuckey.org/urlrewrite/
[3] 
https://github.com/apache/struts/blob/master/plugins/rest/src/main/java/org/apache/struts2/rest/RestActionMapper.java#L188