Re: Class reloading

2009-07-13 Thread Dale Newfield

Musachy Barroso wrote:

I could test the path as an absolute path, if it exist, use it,
otherwise try it as a relative path to context root, sounds good?


Almost.  The File interface can tell you whether or not a given instance 
(path) isAbsolute().  Clearly if the (absolute or relative) file does 
not exist it should not be loaded, but existence shouldn't help you 
decide which way to interpret the path.


This does bring up the question:  If the given (.class or .jar) file 
does not exist at deployment time, will creation of it/changes to it 
later trigger reloading?  Either way, just to avoid confusion that bit 
of info should be added to the documentation.  (Hrm--looking at 
FilesystemAlterationListener and ClassReloadingXMLWebApplicationContext 
suggests that if the file exists at deployment time we should notice in 
onFileChange as you currently do, but if it did not exist (and we want 
to support later adding of classes/jars) we could be paying attention to 
onFileCreate/onDirectoryCreate events, too.)


Oh, and once again:  Musachy++

Lately it seems like Struts is improving more due to the heroic effort 
of a few individuals than as a result of a community effort.  (I have a 
feeling that this has fairly consistently been the case throughout the 
lifetime of struts v1 and v2.)  I'm happy that struts is improving, so 
I'm not trying to discourage heroic effort, but I'm wondering if anyone 
has any suggestions for how to get more involvement?


-Dale

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



Getter in action triggers twice. Bug?

2009-07-13 Thread Ritvars Rundzāns
Hi!

I am wondering is this Struts2 ( *2.1.6* ) fw bug, or am i just
misunderstanding something :). I created action mapping witch maps to an
action and passes two args to it from base url (not param part), like this:

action name=person-*-* class=example.Person
param name=cmd{1}/param
param name=id{2}/param

result/example/abc.jsp/result
/action

Then i created action, which justs do nothing :), but print something when
setter are called:

public void setCmd(String cmd) {
System.out.println( set:cmd );
this.cmd = cmd;
}
public String getId() {
return id;
}
public void setId(String id) {
System.out.println( set:id );
this.id = id;
}
public String getDum() {
return dum;
}
public void setDum(String dum) {
System.out.println( set:dum );
this.dum = dum;
}

Requesting URL
http://localhost:8080/struts_2_test/example/person-view-2?dum=3 gives:
set:cmd
set:id
set:cmd
set:dum
set:id

I know that setter is just setter, but this thing really annoys me :). Any
thoughts? Thanks!
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;

struts

package name=example namespace=/example extends=struts-default

action name=HelloWorld class=example.HelloWorld
result/example/HelloWorld.jsp/result
/action

action name=person-*-* class=example.Person
	param name=cmd{1}/param
	param name=id{2}/param
	
result/example/abc.jsp/result
/action

action name=Login_* method={1} class=example.Login
result name=input/example/Login.jsp/result
result type=redirectActionMenu/result
/action

action name=* class=example.ExampleSupport
result/example/{1}.jsp/result
/action

!-- Add actions here --
/package
/struts
?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;

struts

constant name=struts.enable.DynamicMethodInvocation value=false /
constant name=struts.devMode value=false /

include file=example.xml/



package name=default namespace=/ extends=struts-default
default-action-ref name=index /
action name=index
result type=redirectAction
param name=actionNameHelloWorld/param
param name=namespace/example/param
/result
/action
/package

!-- Add packages here --

/struts

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

Re: Class reloading

2009-07-13 Thread Musachy Barroso
On Mon, Jul 13, 2009 at 7:10 AM, Dale Newfieldd...@newfield.org wrote:
 Almost.  The File interface can tell you whether or not a given instance
 (path) isAbsolute().  Clearly if the (absolute or relative) file does not
 exist it should not be loaded, but existence shouldn't help you decide which
 way to interpret the path.

yes, of course I knew that! (I had never seen that method before lol)

musachy
-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Getter in action triggers twice. Bug?

2009-07-13 Thread Musachy Barroso
please post this question on the user mailing list.

thanks
musachy

On Mon, Jul 13, 2009 at 7:21 AM, Ritvars Rundzānsrrundz...@gmail.com wrote:
 Hi!

 I am wondering is this Struts2 ( 2.1.6 ) fw bug, or am i just
 misunderstanding something :). I created action mapping witch maps to an
 action and passes two args to it from base url (not param part), like this:

     action name=person-*-* class=example.Person
         param name=cmd{1}/param
         param name=id{2}/param

     result/example/abc.jsp/result
     /action

 Then i created action, which justs do nothing :), but print something when
 setter are called:

     public void setCmd(String cmd) {
         System.out.println( set:cmd );
         this.cmd = cmd;
     }
     public String getId() {
         return id;
     }
     public void setId(String id) {
         System.out.println( set:id );
         this.id = id;
     }
     public String getDum() {
         return dum;
     }
     public void setDum(String dum) {
         System.out.println( set:dum );
         this.dum = dum;
     }

 Requesting URL
 http://localhost:8080/struts_2_test/example/person-view-2?dum=3 gives:
 set:cmd
 set:id
 set:cmd
 set:dum
 set:id

 I know that setter is just setter, but this thing really annoys me :). Any
 thoughts? Thanks!


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




-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Class reloading

2009-07-13 Thread Wes Wannemacher
On Mon, Jul 13, 2009 at 12:10 PM, Lukasz
Lenartlukasz.len...@googlemail.com wrote:
 2009/7/13 Dale Newfield d...@newfield.org:
 Lately it seems like Struts is improving more due to the heroic effort of a
 few individuals than as a result of a community effort.  (I have a feeling
 that this has fairly consistently been the case throughout the lifetime of
 struts v1 and v2.)  I'm happy that struts is improving, so I'm not trying to
 discourage heroic effort, but I'm wondering if anyone has any suggestions
 for how to get more involvement?

 I'm trying to follow as I can, but looks like musachy never sleeps ;-)
 The hardest thing for me is to really understand dependencies and
 connections between classes - in Struts and / with Struts. Also
 dependency injection in Xwork is very misleading, I'm trying to walk
 around and figure out, but it's a pain in the neck ;-)



Don't worry Lukasz, it just takes time. It is very confusing, but you
get the hang of it after you've had to mess with it for a while. The
nice thing about it is that it is very simple compared to Spring. And
no, Musachy doesn't sleep.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Re: Class reloading

2009-07-13 Thread Musachy Barroso
On Mon, Jul 13, 2009 at 9:16 AM, Wes Wannemacherw...@wantii.com wrote:
 And
 no, Musachy doesn't sleep.

well in fact, I sleep walk almost every night, so yeah I don't sleep much :)

musachy
-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Class reloading

2009-07-13 Thread Musachy Barroso
I am thinking about adding another constant which holds a list of
regex, which if set, will limit what classes can be loaded by the
reloading classloader. The reason for this, is that I would like to
limit the reloaded classes to just my actions. If the reloading class
loader loads something that is not an action, there is a good chance
that instance of that class will be casted to the same class loaded by
the original class loader, which fails with a class cast exception.

musachy

On Mon, Jul 13, 2009 at 7:10 AM, Dale Newfieldd...@newfield.org wrote:
 Musachy Barroso wrote:

 I could test the path as an absolute path, if it exist, use it,
 otherwise try it as a relative path to context root, sounds good?

 Almost.  The File interface can tell you whether or not a given instance
 (path) isAbsolute().  Clearly if the (absolute or relative) file does not
 exist it should not be loaded, but existence shouldn't help you decide which
 way to interpret the path.

 This does bring up the question:  If the given (.class or .jar) file does
 not exist at deployment time, will creation of it/changes to it later
 trigger reloading?  Either way, just to avoid confusion that bit of info
 should be added to the documentation.  (Hrm--looking at
 FilesystemAlterationListener and ClassReloadingXMLWebApplicationContext
 suggests that if the file exists at deployment time we should notice in
 onFileChange as you currently do, but if it did not exist (and we want to
 support later adding of classes/jars) we could be paying attention to
 onFileCreate/onDirectoryCreate events, too.)

 Oh, and once again:  Musachy++

 Lately it seems like Struts is improving more due to the heroic effort of a
 few individuals than as a result of a community effort.  (I have a feeling
 that this has fairly consistently been the case throughout the lifetime of
 struts v1 and v2.)  I'm happy that struts is improving, so I'm not trying to
 discourage heroic effort, but I'm wondering if anyone has any suggestions
 for how to get more involvement?

 -Dale

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





-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Getter in action triggers twice. Bug?

2009-07-13 Thread Ritvars Rundzāns
If you think this post is inappropriate @ this mailing list, i disagree with
you. Despite of fact this (twice-triggering) is simple thing/fact, it is
more related to struts2 action handling implementation (dev thing) then my
lack of knowledge (user list).

Anyway, i will give it a try. Others are still welcome to discuss here ;).


Re: Getter in action triggers twice. Bug?

2009-07-13 Thread Musachy Barroso
I agree with you in principle, but there is a good chance that it is
something not properly configured, like the static params interceptor
applied twice to the action vs a struts bug.

musachy

On Mon, Jul 13, 2009 at 9:54 AM, Ritvars Rundzānsrrundz...@gmail.com wrote:
 If you think this post is inappropriate @ this mailing list, i disagree with
 you. Despite of fact this (twice-triggering) is simple thing/fact, it is
 more related to struts2 action handling implementation (dev thing) then my
 lack of knowledge (user list).

 Anyway, i will give it a try. Others are still welcome to discuss here ;).




-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Class reloading

2009-07-13 Thread Musachy Barroso
I added struts.class.reloading.acceptClasses, so now I can make the
reloading class loader handle only action classes, so I don't get
ClassCastException(s)

I also added support for the relative paths, @Dale, take it for a spin
and let me know how it works.

musachy

On Mon, Jul 13, 2009 at 9:29 AM, Musachy Barrosomusa...@gmail.com wrote:
 I am thinking about adding another constant which holds a list of
 regex, which if set, will limit what classes can be loaded by the
 reloading classloader. The reason for this, is that I would like to
 limit the reloaded classes to just my actions. If the reloading class
 loader loads something that is not an action, there is a good chance
 that instance of that class will be casted to the same class loaded by
 the original class loader, which fails with a class cast exception.

 musachy

 On Mon, Jul 13, 2009 at 7:10 AM, Dale Newfieldd...@newfield.org wrote:
 Musachy Barroso wrote:

 I could test the path as an absolute path, if it exist, use it,
 otherwise try it as a relative path to context root, sounds good?

 Almost.  The File interface can tell you whether or not a given instance
 (path) isAbsolute().  Clearly if the (absolute or relative) file does not
 exist it should not be loaded, but existence shouldn't help you decide which
 way to interpret the path.

 This does bring up the question:  If the given (.class or .jar) file does
 not exist at deployment time, will creation of it/changes to it later
 trigger reloading?  Either way, just to avoid confusion that bit of info
 should be added to the documentation.  (Hrm--looking at
 FilesystemAlterationListener and ClassReloadingXMLWebApplicationContext
 suggests that if the file exists at deployment time we should notice in
 onFileChange as you currently do, but if it did not exist (and we want to
 support later adding of classes/jars) we could be paying attention to
 onFileCreate/onDirectoryCreate events, too.)

 Oh, and once again:  Musachy++

 Lately it seems like Struts is improving more due to the heroic effort of a
 few individuals than as a result of a community effort.  (I have a feeling
 that this has fairly consistently been the case throughout the lifetime of
 struts v1 and v2.)  I'm happy that struts is improving, so I'm not trying to
 discourage heroic effort, but I'm wondering if anyone has any suggestions
 for how to get more involvement?

 -Dale

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





 --
 Hey you! Would you help me to carry the stone? Pink Floyd




-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



Re: Getter in action triggers twice. Bug?

2009-07-13 Thread Ritvars Rundzāns
I understand and agree your way of thinking. Its true i tried struts 2 the
first time today.

But. This misconfiguration thing is doubtly possible, i think, because i
used struts2 blank app as a base of my test. Just 1 filter @ web.xml
(struts filter), @ struts xml - 2 constansts were set:
constant name=struts.enable.DynamicMethodInvocation value=false /
constant name=struts.devMode value=false /

+action mapping for test (pasted in my first post).

Ok, thanks anyway, will go and try out user list.


Re: Getter in action triggers twice. Bug?

2009-07-13 Thread Dave Newton
Please ask this question on the struts-user mailing list. The struts-dev 
list is for the development of Struts itself.


http://struts.apache.org/mail.html

Thanks,
Dave

Ritvars Rundza-ns wrote:

Hi!

I am wondering is this Struts2 ( *2.1.6* ) fw bug, or am i just 
misunderstanding something :). I created action mapping witch maps to an 
action and passes two args to it from base url (not param part), like this:


action name=person-*-* class=example.Person
param name=cmd{1}/param
param name=id{2}/param
   
result/example/abc.jsp/result

/action

Then i created action, which justs do nothing :), but print something 
when setter are called:


public void setCmd(String cmd) {
System.out.println( set:cmd );
this.cmd = cmd;
}
public String getId() {
return id;
}
public void setId(String id) {
System.out.println( set:id );
this.id http://this.id = id;
}
public String getDum() {
return dum;
}
public void setDum(String dum) {
System.out.println( set:dum );
this.dum = dum;
}

Requesting URL 
http://localhost:8080/struts_2_test/example/person-view-2?dum=3 gives:

set:cmd
set:id
set:cmd
set:dum
set:id

I know that setter is just setter, but this thing really annoys me :). 
Any thoughts? Thanks!






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


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