Allowed methods

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Allowed methods

Britta Katzenbach
Hello!

we migrated a project to struts 2.5. Therefore we had to add the allowed methods to the actions. We use a bit of inheritance in the action and would appreciate, if the allowed methods would be inherited as well. We tried as well to define some additional allowed methods on certain packages. But this works only if I do not add methods directly on a certain action class. Is there a reason why allowed methods are not inherited? Why can I not add allowed methods to all actions in the package and add special methods on certain actions?

Best regards,

Britta Katzenbach






smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Lukasz Lenart
2018-01-25 9:31 GMT+01:00 Britta Katzenbach <[hidden email]>:

> Hello!
>
> we migrated a project to struts 2.5. Therefore we had to add the allowed
> methods to the actions. We use a bit of inheritance in the action and would
> appreciate, if the allowed methods would be inherited as well. We tried as
> well to define some additional allowed methods on certain packages. But this
> works only if I do not add methods directly on a certain action class. Is
> there a reason why allowed methods are not inherited? Why can I not add
> allowed methods to all actions in the package and add special methods on
> certain actions?

Can you post an example config? How deep inheritance do you have?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Britta Katzenbach
struts.xml:

<package name="default" extends="tiles-default"  namespace="/„ >
<global-allowed-methods>abort,execute,search,reset,download,refresh,delegate,forward,release,saveComments</global-allowed-methods>
</package>

Java:

@AllowedMethods(value = {"changeLanguage", "deleteAttachment", "uploadMailAttachment"})
public class SpecifyMailTask extends AbstractTask {

@AllowedMethods(value = {"saveInputAndSuccess"})
public abstract class AbstractTask extends AbstractBasicJbpmTask implements ModelDriven<TaskModel>, Preparable {…}

@AllowedMethods(value = { "abort", "cancel", "claim", "claimAndStart", "claimAndSkip", "complete", "delegate", "forward",
        "incomplete", "release""skipAndComplete", "start", "suspend", "uploadTaskAttachment"})
public abstract class AbstractBasicJbpmTask extends AbstractCrmAction implements ModelDriven<TaskModel>, Preparable {…}

This it would look like, if we could use inheritance. In others cases we have one or more layer of inheritance more. 

Regards, 

Britta Katzenbach

_____________________________________________________
Tel. +49 30 27019889

Dr. Lippke & Dr. Wagner GmbH
Nassauische Str. 25
10717 Berlin
Tel./Fax: +49 30 2147309-0 / 2

Geschäftsführer: Dr. Andreas Lippke und Florian Schlittgen
Registergericht: Amtsgericht Berlin HRB 25607








Am 25.01.2018 um 10:32 schrieb Lukasz Lenart <[hidden email]>:

2018-01-25 9:31 GMT+01:00 Britta Katzenbach <[hidden email]>:
Hello!

we migrated a project to struts 2.5. Therefore we had to add the allowed
methods to the actions. We use a bit of inheritance in the action and would
appreciate, if the allowed methods would be inherited as well. We tried as
well to define some additional allowed methods on certain packages. But this
works only if I do not add methods directly on a certain action class. Is
there a reason why allowed methods are not inherited? Why can I not add
allowed methods to all actions in the package and add special methods on
certain actions?

Can you post an example config? How deep inheritance do you have?


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]



smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Lukasz Lenart
2018-01-25 10:50 GMT+01:00 Britta Katzenbach <[hidden email]>:
> struts.xml:
>
> <package name="default" extends="tiles-default"  namespace="/„ >
> …
> <global-allowed-methods>abort,execute,search,reset,download,refresh,delegate,forward,release,saveComments</global-allowed-methods>
> </package>

I assume you do not declare actions in struts.xml, you just use the
Convention, right?

> Java:
>
> @AllowedMethods(value = {"changeLanguage", "deleteAttachment",
> "uploadMailAttachment"})
> public class SpecifyMailTask extends AbstractTask {
>
> @AllowedMethods(value = {"saveInputAndSuccess"})
> public abstract class AbstractTask extends AbstractBasicJbpmTask implements
> ModelDriven<TaskModel>, Preparable {…}
>
> @AllowedMethods(value = { "abort", "cancel", "claim", "claimAndStart",
> "claimAndSkip", "complete", "delegate", "forward",
>         "incomplete", "release", "skipAndComplete", "start", "suspend",
> "uploadTaskAttachment"})
> public abstract class AbstractBasicJbpmTask extends AbstractCrmAction
> implements ModelDriven<TaskModel>, Preparable {…}

You can put these annotations in package-info.java as well

> This it would look like, if we could use inheritance. In others cases we
> have one or more layer of inheritance more.

This is a limitation of our AnnotationUtils class but we can extend
it, please register a ticket in JIRA
https://issues.apache.org/jira/projects/WW/issues


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Britta Katzenbach

Yes, you are right we do not declare actions in struts.xml and just use the Convention.

I tried to put it in the package-info.java. It worked as long as I did not add an additional method to a certain action, i.e. SpecifyMailTask. If I add here the annotation to allow the methods "changeLanguage", "deleteAttachment“, "uploadMailAttachment“ additionally, the other methods, which are allowed via the package-info.java, are not allowed anymore. Is this a wanted behavior?

I will register a ticket, thank you for your quick response.

Regards,

Britta Katzenbach

Am 25.01.2018 um 12:02 schrieb Lukasz Lenart <[hidden email]>:

2018-01-25 10:50 GMT+01:00 Britta Katzenbach <[hidden email]>:
struts.xml:

<package name="default" extends="tiles-default"  namespace="/„ >

<global-allowed-methods>abort,execute,search,reset,download,refresh,delegate,forward,release,saveComments</global-allowed-methods>
</package>

I assume you do not declare actions in struts.xml, you just use the
Convention, right?

Java:

@AllowedMethods(value = {"changeLanguage", "deleteAttachment",
"uploadMailAttachment"})
public class SpecifyMailTask extends AbstractTask {

@AllowedMethods(value = {"saveInputAndSuccess"})
public abstract class AbstractTask extends AbstractBasicJbpmTask implements
ModelDriven<TaskModel>, Preparable {…}

@AllowedMethods(value = { "abort", "cancel", "claim", "claimAndStart",
"claimAndSkip", "complete", "delegate", "forward",
       "incomplete", "release", "skipAndComplete", "start", "suspend",
"uploadTaskAttachment"})
public abstract class AbstractBasicJbpmTask extends AbstractCrmAction
implements ModelDriven<TaskModel>, Preparable {…}

You can put these annotations in package-info.java as well

This it would look like, if we could use inheritance. In others cases we
have one or more layer of inheritance more.

This is a limitation of our AnnotationUtils class but we can extend
it, please register a ticket in JIRA
https://issues.apache.org/jira/projects/WW/issues


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Britta Katzenbach
In reply to this post by Lukasz Lenart
The JIRA entry is:


Regards,

Britta Katzenbach



Am 25.01.2018 um 12:02 schrieb Lukasz Lenart <[hidden email]>:

2018-01-25 10:50 GMT+01:00 Britta Katzenbach <[hidden email]>:
struts.xml:

<package name="default" extends="tiles-default"  namespace="/„ >

<global-allowed-methods>abort,execute,search,reset,download,refresh,delegate,forward,release,saveComments</global-allowed-methods>
</package>

I assume you do not declare actions in struts.xml, you just use the
Convention, right?

Java:

@AllowedMethods(value = {"changeLanguage", "deleteAttachment",
"uploadMailAttachment"})
public class SpecifyMailTask extends AbstractTask {

@AllowedMethods(value = {"saveInputAndSuccess"})
public abstract class AbstractTask extends AbstractBasicJbpmTask implements
ModelDriven<TaskModel>, Preparable {…}

@AllowedMethods(value = { "abort", "cancel", "claim", "claimAndStart",
"claimAndSkip", "complete", "delegate", "forward",
       "incomplete", "release", "skipAndComplete", "start", "suspend",
"uploadTaskAttachment"})
public abstract class AbstractBasicJbpmTask extends AbstractCrmAction
implements ModelDriven<TaskModel>, Preparable {…}

You can put these annotations in package-info.java as well

This it would look like, if we could use inheritance. In others cases we
have one or more layer of inheritance more.

This is a limitation of our AnnotationUtils class but we can extend
it, please register a ticket in JIRA
https://issues.apache.org/jira/projects/WW/issues


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Allowed methods

Lukasz Lenart
In reply to this post by Britta Katzenbach
2018-01-25 13:00 GMT+01:00 Britta Katzenbach <[hidden email]>:
> I tried to put it in the package-info.java. It worked as long as I did not
> add an additional method to a certain action, i.e. SpecifyMailTask. If I add
> here the annotation to allow the methods "changeLanguage",
> "deleteAttachment“, "uploadMailAttachment“ additionally, the other methods,
> which are allowed via the package-info.java, are not allowed anymore. Is
> this a wanted behavior?

Looks like a bug, all those AllowedMethods should be merged together


Regards
--
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]