Change Action Method In Interceptor

2015-03-11 Thread R Veach
Hi,

I know it is possible to limit struts to specific methods using the
MethodFilterInterceptor, and to change the execute method in the config or
form declaration using the method attribute.

Is it possible to have an interceptor change which method would be executed
in the action? I see I can get the method name using
invocation.getProxy().getMethod(), but I can't find any setter.

One reason I want to do this is to build submit and first time in logic
without defining it everywhere for every page and have an interceptor do
the work for me.
I would identify if it is first time or submit based on request to see if
it is GET or POST.
I could call the methods directly from the interceptor since I have the
action instance, but that would bypass the rest of the interceptor chain
and would require this interceptor to always be last in the list.

Here is an example of what I was planning:

//
if (isFirstTime(request)) {
if (action instanceof FirstTimeLogic) {
   invocation.getProxy().setMethod(executeFirstTimeInLogic);
}
} else {
if (action instanceof SubmitLogic) {
invocation.getProxy().setMethod(executeSubmitLogic);
}
}

return invocation.invoke();


Re: Change Action Method In Interceptor

2015-03-11 Thread Lukasz Lenart
2015-03-11 16:29 GMT+01:00 R Veach rveac...@gmail.com:
 Hi,

 I know it is possible to limit struts to specific methods using the
 MethodFilterInterceptor, and to change the execute method in the config or
 form declaration using the method attribute.

 Is it possible to have an interceptor change which method would be executed
 in the action? I see I can get the method name using
 invocation.getProxy().getMethod(), but I can't find any setter.

There is a reason for that - other interceptors can based on that ;-)

 One reason I want to do this is to build submit and first time in logic
 without defining it everywhere for every page and have an interceptor do
 the work for me.
 I would identify if it is first time or submit based on request to see if
 it is GET or POST.
 I could call the methods directly from the interceptor since I have the
 action instance, but that would bypass the rest of the interceptor chain
 and would require this interceptor to always be last in the list.

 Here is an example of what I was planning:

 //
 if (isFirstTime(request)) {
 if (action instanceof FirstTimeLogic) {
invocation.getProxy().setMethod(executeFirstTimeInLogic);
 }
 } else {
 if (action instanceof SubmitLogic) {
 invocation.getProxy().setMethod(executeSubmitLogic);
 }
 }

 return invocation.invoke();

The best option is to implement your own version of ActionProxyFactory
and ActionProxy - and used them instead of default one.


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

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Struts 1.x documentation and javadocs

2015-03-11 Thread Martin Gainty
mkdir /EmptyFolder
cd /EmptyFolder
wget -r http://www.laconiadatasystems.com/struts-1.3.8/docs/ 
Please do this today before my host provider finds out I uploaded at least 2 gb 
of apache stuff to the site

ping back if you have any questions,
Martin 
__ 

 


 From: lukaszlen...@apache.org
 Date: Wed, 11 Mar 2015 13:20:35 +0100
 Subject: Re: Struts 1.x documentation and javadocs
 To: user@struts.apache.org
 
 Yes, only as a downloadable versions, this allowed to simplify results
 in Google index
 
 2015-03-11 12:23 GMT+01:00 Christopher Schultz ch...@christopherschultz.net:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA256
 
  All,
 
  I realize that S1 is EOL but the press release says that the
  documentation will still be available from the Struts home page.
 
  I can't seem to find the 1.3.x API Javadocs on the site, and neither
  can Google. Are the Javadocs still available from the Struts web site,
  or do I need to download the documentation package and install it locally?
 
  Thanks,
  - -chris
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v1
  Comment: GPGTools - http://gpgtools.org
 
  iQIcBAEBCAAGBQJVACWXAAoJEBzwKT+lPKRYq/8P/0nLxdg0ZyWHF2tuo04zsU/3
  pRpKI3NSgANQ0N8Pzi40jOTGmTNb0r60oJMTSMc0ZyTx2ZSN8GPd0oVxRqfDUZmb
  ElGUjcXOz4a4In4aYT6ZQ2LLl0gEYx2VHHjUHDqt8JlTe9ytqUxyMQw7SRlxZmGS
  NoQLFRTY2nBVxhv7y2rr1HFFrZOhqfm3r7jykOMehSrx4khJ6BUKx1Svu/gltkx5
  QUCVz63j85VnLgiCrtJqx9aQhNTO0p4JrMgeKKaiNG4iTvYFpm0L4Bi1xnjLAL75
  r8OZwxpo0ZgZ/aNFIbJl/iZqr4LhnFscRVRBlBjkfm17zLg5igLnvYKTi5Ogqw1d
  qgKqgGH/gHk0deIpzwG2leUfrxBDGn90aN2Cvy31+bXRXyQWbDPllcoygIT7gqC8
  vTDqC+XUsu/wq+JmfoKkMIW+3nEwUYCB0yrhm2NMp0anbbPCctH8t49yTHtathCn
  vqh08rQclWb+OUCcLcwifCynhvyCaXEKJNv/GM+3Uq/QvRsmB5X4YME/Uno5hQas
  mzstcFqLUtCkWdl3CZb2V04uDEhmCOY65yvFAB7O4T4V0YYeJv+yrCfuaw/661Kn
  Y9rkkvr+piewrw+9gE3cdPLRHi4c5otCvt5U0UQF40t55IiOQtYw06GscP6Y7RFs
  Z3xTwrhAUVX/9UHr1oya
  =Ontf
  -END PGP SIGNATURE-
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
  

Unable to find keys located in .properties file

2015-03-11 Thread Jeanderson
Hi everyone,

I am a beginner in Struts 2 and so far, I've been working with the official
tutorials to get started with the framework. Also, I'm using Eclipse.

In the Message Resource Files [1], the framework can't find the key
located in the .properties file although it is placed in the same package
of its related action class.

Since I'm using Eclipse to create every Struts 2 project and knowing that
Struts 2 is a convention over configuration framework, I wonder if I'm
having this problem because the generated directory tree is not the same as
the one created using Maven.

Is there any recommended way to start a Struts 2 project? My code is hosted
at Github [2] and maybe someone could give me a hint of what is wrong with
it. I did everything as suggested in the tutorial and that's why I believe
the issue is having a different directory tree.

[1] http://struts.apache.org/docs/message-resource-files.html
[2]
https://github.com/jeandersonbc/labs-struts2/tree/master/tutorial/message_resource

Thanks in advance,

Jeanderson Barros Cândido
http://jeandersonbc.github.io


Re: Unable to find keys located in .properties file

2015-03-11 Thread Jeanderson
Hello Lukasz Lenart,

Thank you for your message. I imagined that working with a directory tree
generated by Eclipse could be a problem.
I started a new project based on Maven [1], however, if you run my code,
you will get again a warning:


2015-03-11 17:48:00,316  WARN
(com.opensymphony.xwork2.util.LocalizedTextUtil:64) - Missing key
[formBean.firstName] in bundles [[org/apache/struts2/struts-messages,
com/opensymphony/xwork2/xwork-messages]]!
2015-03-11 17:48:00,340  WARN
(org.apache.struts2.components.ServletUrlRenderer:60) - No configuration
found for the specified action: 'register' in namespace: ''. Form action
defaulting to 'action' attribute's literal value.


It is not clear for me what is wrong, it is like the framework can't find
the properties files for some reason.
Any idea of what am I missing?

[1]
https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource

Best regards,
Jeanderson Barros Cândido
http://jeandersonbc.github.io

2015-03-11 16:10 GMT-03:00 Lukasz Lenart lukaszlen...@apache.org:

 2015-03-11 18:09 GMT+01:00 Jeanderson jeanderso...@gmail.com:
  Hi everyone,
 
  I am a beginner in Struts 2 and so far, I've been working with the
 official
  tutorials to get started with the framework. Also, I'm using Eclipse.
 
  In the Message Resource Files [1], the framework can't find the key
  located in the .properties file although it is placed in the same package
  of its related action class.
 
  Since I'm using Eclipse to create every Struts 2 project and knowing that
  Struts 2 is a convention over configuration framework, I wonder if I'm
  having this problem because the generated directory tree is not the same
 as
  the one created using Maven.
 
  Is there any recommended way to start a Struts 2 project? My code is
 hosted
  at Github [2] and maybe someone could give me a hint of what is wrong
 with
  it. I did everything as suggested in the tutorial and that's why I
 believe
  the issue is having a different directory tree.
 
  [1] http://struts.apache.org/docs/message-resource-files.html
  [2]
 
 https://github.com/jeandersonbc/labs-struts2/tree/master/tutorial/message_resource

 Your project [2] is a bit messy, you're using Maven (pom.xml) but you
 don't follow standard layout structure for Maven projects. If you want
 to use Maven to build your Struts2 project it's far better to start
 with Maven Archetypes, read this


 http://struts.apache.org/docs/struts-2-maven-archetypes.html#Struts2MavenArchetypes-Quickstart

 and basically use this

 mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/


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

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: Unable to find keys located in .properties file

2015-03-11 Thread Lukasz Lenart
2015-03-11 18:09 GMT+01:00 Jeanderson jeanderso...@gmail.com:
 Hi everyone,

 I am a beginner in Struts 2 and so far, I've been working with the official
 tutorials to get started with the framework. Also, I'm using Eclipse.

 In the Message Resource Files [1], the framework can't find the key
 located in the .properties file although it is placed in the same package
 of its related action class.

 Since I'm using Eclipse to create every Struts 2 project and knowing that
 Struts 2 is a convention over configuration framework, I wonder if I'm
 having this problem because the generated directory tree is not the same as
 the one created using Maven.

 Is there any recommended way to start a Struts 2 project? My code is hosted
 at Github [2] and maybe someone could give me a hint of what is wrong with
 it. I did everything as suggested in the tutorial and that's why I believe
 the issue is having a different directory tree.

 [1] http://struts.apache.org/docs/message-resource-files.html
 [2]
 https://github.com/jeandersonbc/labs-struts2/tree/master/tutorial/message_resource

Your project [2] is a bit messy, you're using Maven (pom.xml) but you
don't follow standard layout structure for Maven projects. If you want
to use Maven to build your Struts2 project it's far better to start
with Maven Archetypes, read this

http://struts.apache.org/docs/struts-2-maven-archetypes.html#Struts2MavenArchetypes-Quickstart

and basically use this

mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/


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

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Struts 1.x documentation and javadocs

2015-03-11 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

All,

I realize that S1 is EOL but the press release says that the
documentation will still be available from the Struts home page.

I can't seem to find the 1.3.x API Javadocs on the site, and neither
can Google. Are the Javadocs still available from the Struts web site,
or do I need to download the documentation package and install it locally?

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVACWXAAoJEBzwKT+lPKRYq/8P/0nLxdg0ZyWHF2tuo04zsU/3
pRpKI3NSgANQ0N8Pzi40jOTGmTNb0r60oJMTSMc0ZyTx2ZSN8GPd0oVxRqfDUZmb
ElGUjcXOz4a4In4aYT6ZQ2LLl0gEYx2VHHjUHDqt8JlTe9ytqUxyMQw7SRlxZmGS
NoQLFRTY2nBVxhv7y2rr1HFFrZOhqfm3r7jykOMehSrx4khJ6BUKx1Svu/gltkx5
QUCVz63j85VnLgiCrtJqx9aQhNTO0p4JrMgeKKaiNG4iTvYFpm0L4Bi1xnjLAL75
r8OZwxpo0ZgZ/aNFIbJl/iZqr4LhnFscRVRBlBjkfm17zLg5igLnvYKTi5Ogqw1d
qgKqgGH/gHk0deIpzwG2leUfrxBDGn90aN2Cvy31+bXRXyQWbDPllcoygIT7gqC8
vTDqC+XUsu/wq+JmfoKkMIW+3nEwUYCB0yrhm2NMp0anbbPCctH8t49yTHtathCn
vqh08rQclWb+OUCcLcwifCynhvyCaXEKJNv/GM+3Uq/QvRsmB5X4YME/Uno5hQas
mzstcFqLUtCkWdl3CZb2V04uDEhmCOY65yvFAB7O4T4V0YYeJv+yrCfuaw/661Kn
Y9rkkvr+piewrw+9gE3cdPLRHi4c5otCvt5U0UQF40t55IiOQtYw06GscP6Y7RFs
Z3xTwrhAUVX/9UHr1oya
=Ontf
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 1.x documentation and javadocs

2015-03-11 Thread Lukasz Lenart
Yes, only as a downloadable versions, this allowed to simplify results
in Google index

2015-03-11 12:23 GMT+01:00 Christopher Schultz ch...@christopherschultz.net:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA256

 All,

 I realize that S1 is EOL but the press release says that the
 documentation will still be available from the Struts home page.

 I can't seem to find the 1.3.x API Javadocs on the site, and neither
 can Google. Are the Javadocs still available from the Struts web site,
 or do I need to download the documentation package and install it locally?

 Thanks,
 - -chris
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1
 Comment: GPGTools - http://gpgtools.org

 iQIcBAEBCAAGBQJVACWXAAoJEBzwKT+lPKRYq/8P/0nLxdg0ZyWHF2tuo04zsU/3
 pRpKI3NSgANQ0N8Pzi40jOTGmTNb0r60oJMTSMc0ZyTx2ZSN8GPd0oVxRqfDUZmb
 ElGUjcXOz4a4In4aYT6ZQ2LLl0gEYx2VHHjUHDqt8JlTe9ytqUxyMQw7SRlxZmGS
 NoQLFRTY2nBVxhv7y2rr1HFFrZOhqfm3r7jykOMehSrx4khJ6BUKx1Svu/gltkx5
 QUCVz63j85VnLgiCrtJqx9aQhNTO0p4JrMgeKKaiNG4iTvYFpm0L4Bi1xnjLAL75
 r8OZwxpo0ZgZ/aNFIbJl/iZqr4LhnFscRVRBlBjkfm17zLg5igLnvYKTi5Ogqw1d
 qgKqgGH/gHk0deIpzwG2leUfrxBDGn90aN2Cvy31+bXRXyQWbDPllcoygIT7gqC8
 vTDqC+XUsu/wq+JmfoKkMIW+3nEwUYCB0yrhm2NMp0anbbPCctH8t49yTHtathCn
 vqh08rQclWb+OUCcLcwifCynhvyCaXEKJNv/GM+3Uq/QvRsmB5X4YME/Uno5hQas
 mzstcFqLUtCkWdl3CZb2V04uDEhmCOY65yvFAB7O4T4V0YYeJv+yrCfuaw/661Kn
 Y9rkkvr+piewrw+9gE3cdPLRHi4c5otCvt5U0UQF40t55IiOQtYw06GscP6Y7RFs
 Z3xTwrhAUVX/9UHr1oya
 =Ontf
 -END PGP SIGNATURE-

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Unable to find keys located in .properties file

2015-03-11 Thread Lukasz Lenart
Almost gut

your action is in:
src/main/java/lab_struts/tutorial/message_resource/action

but the related properties file in:
src/main/resources/lab_struts/tutorial/message_resource/

so they differ on the last part - action and that's why message
cannot be found. You have two options here:
- rename Register.properties to package.properties then it will be
used for all actions in this package and below
- create subdirectory action and move Register.properties there

It's explained here
http://struts.apache.org/docs/localization.html


2015-03-11 21:58 GMT+01:00 Jeanderson jeanderso...@gmail.com:
 Hello Lukasz Lenart,

 Thank you for your message. I imagined that working with a directory tree
 generated by Eclipse could be a problem.
 I started a new project based on Maven [1], however, if you run my code,
 you will get again a warning:

 
 2015-03-11 17:48:00,316  WARN
 (com.opensymphony.xwork2.util.LocalizedTextUtil:64) - Missing key
 [formBean.firstName] in bundles [[org/apache/struts2/struts-messages,
 com/opensymphony/xwork2/xwork-messages]]!
 2015-03-11 17:48:00,340  WARN
 (org.apache.struts2.components.ServletUrlRenderer:60) - No configuration
 found for the specified action: 'register' in namespace: ''. Form action
 defaulting to 'action' attribute's literal value.
 

 It is not clear for me what is wrong, it is like the framework can't find
 the properties files for some reason.
 Any idea of what am I missing?

 [1]
 https://github.com/jeandersonbc/labs-struts2/tree/hotfix/tutorial/message_resource

 Best regards,
 Jeanderson Barros Cândido
 http://jeandersonbc.github.io

 2015-03-11 16:10 GMT-03:00 Lukasz Lenart lukaszlen...@apache.org:

 2015-03-11 18:09 GMT+01:00 Jeanderson jeanderso...@gmail.com:
  Hi everyone,
 
  I am a beginner in Struts 2 and so far, I've been working with the
 official
  tutorials to get started with the framework. Also, I'm using Eclipse.
 
  In the Message Resource Files [1], the framework can't find the key
  located in the .properties file although it is placed in the same package
  of its related action class.
 
  Since I'm using Eclipse to create every Struts 2 project and knowing that
  Struts 2 is a convention over configuration framework, I wonder if I'm
  having this problem because the generated directory tree is not the same
 as
  the one created using Maven.
 
  Is there any recommended way to start a Struts 2 project? My code is
 hosted
  at Github [2] and maybe someone could give me a hint of what is wrong
 with
  it. I did everything as suggested in the tutorial and that's why I
 believe
  the issue is having a different directory tree.
 
  [1] http://struts.apache.org/docs/message-resource-files.html
  [2]
 
 https://github.com/jeandersonbc/labs-struts2/tree/master/tutorial/message_resource

 Your project [2] is a bit messy, you're using Maven (pom.xml) but you
 don't follow standard layout structure for Maven projects. If you want
 to use Maven to build your Struts2 project it's far better to start
 with Maven Archetypes, read this


 http://struts.apache.org/docs/struts-2-maven-archetypes.html#Struts2MavenArchetypes-Quickstart

 and basically use this

 mvn archetype:generate -DarchetypeCatalog=http://struts.apache.org/


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

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org