You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by laserjim <la...@gmail.com> on 2009/05/22 13:25:00 UTC

Specify DevMode Dynamically at Runtime

Hello,

I have a struts application.  Sometimes, at runtime, I decide I want to
enable dev mode.  Modifying struts.properties requires redeploying the
webapp.  Is there a way to enable devmode dynamically?

Thanks!
-- 
View this message in context: http://www.nabble.com/Specify-DevMode-Dynamically-at-Runtime-tp23668635p23668635.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Specify DevMode Dynamically at Runtime

Posted by laserjim <la...@gmail.com>.
Pretty straight forward, the source code seems unnecessary given my answer,
but whatever:

I use a context listener that calls this line when the apache context is
active...
public void contextInitialized (ServletContextEvent sce)
{
	if(!Server.isLive()) Dispatcher.addDispatcherListener(new
DebugDispatchListener());
}


/** Listens to the Struts dispatch lifecycle and enables debugging on all
dispatchers.  Used when !Server.isLive(); **/
class DebugDispatchListener implements DispatcherListener
{
	public void dispatcherDestroyed(Dispatcher arg0) { }
	public void dispatcherInitialized(Dispatcher dispatcher)
	{
		dispatcher.setDevMode("true");
	}
}





sheltonn wrote:
> 
> Code, please.
> 
>  
> Norris Shelton
> Software Engineer
> Sun Certified Java 1.1 Programmer
> Shelton Consulting, LLC
> ICQ# 26487421
> AIM NorrisEShelton
> YIM norrisshelton
> 
> 
> 
> 
> ________________________________
> From: laserjim <la...@gmail.com>
> To: user@struts.apache.org
> Sent: Friday, May 22, 2009 8:42:42 AM
> Subject: Re: Specify DevMode Dynamically at Runtime
> 
> 
> SOLVED: When you're in debug mode, add a dispatch initialization listener
> to
> the Struts Dispatch class; the dispatch listener can call
> setDevMode("true");.  Tested, works, Struts 2.1.6
> 
> 
> 
> laserjim wrote:
>> 
>> Hello,
>> 
>> I have a struts application.  Sometimes, at runtime, I decide I want to
>> enable dev mode.  Modifying struts.properties requires redeploying the
>> webapp.  Is there a way to enable devmode dynamically?
>> 
>> Thanks!
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/Specify-DevMode-Dynamically-at-Runtime-tp23668635p23669706.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
>       
> 

-- 
View this message in context: http://www.nabble.com/Specify-DevMode-Dynamically-at-Runtime-tp23668635p23676673.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Specify DevMode Dynamically at Runtime

Posted by Norris Shelton <no...@yahoo.com>.
Code, please.

 
Norris Shelton
Software Engineer
Sun Certified Java 1.1 Programmer
Shelton Consulting, LLC
ICQ# 26487421
AIM NorrisEShelton
YIM norrisshelton




________________________________
From: laserjim <la...@gmail.com>
To: user@struts.apache.org
Sent: Friday, May 22, 2009 8:42:42 AM
Subject: Re: Specify DevMode Dynamically at Runtime


SOLVED: When you're in debug mode, add a dispatch initialization listener to
the Struts Dispatch class; the dispatch listener can call
setDevMode("true");.  Tested, works, Struts 2.1.6



laserjim wrote:
> 
> Hello,
> 
> I have a struts application.  Sometimes, at runtime, I decide I want to
> enable dev mode.  Modifying struts.properties requires redeploying the
> webapp.  Is there a way to enable devmode dynamically?
> 
> Thanks!
> 

-- 
View this message in context: http://www.nabble.com/Specify-DevMode-Dynamically-at-Runtime-tp23668635p23669706.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


      

Re: Specify DevMode Dynamically at Runtime

Posted by laserjim <la...@gmail.com>.
SOLVED: When you're in debug mode, add a dispatch initialization listener to
the Struts Dispatch class; the dispatch listener can call
setDevMode("true");.  Tested, works, Struts 2.1.6



laserjim wrote:
> 
> Hello,
> 
> I have a struts application.  Sometimes, at runtime, I decide I want to
> enable dev mode.  Modifying struts.properties requires redeploying the
> webapp.  Is there a way to enable devmode dynamically?
> 
> Thanks!
> 

-- 
View this message in context: http://www.nabble.com/Specify-DevMode-Dynamically-at-Runtime-tp23668635p23669706.html
Sent from the Struts - User mailing list archive at Nabble.com.


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