You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Hideyuki TAKEUCHI <we...@chimera.st> on 2011/04/01 09:46:24 UTC
ReloadingWicketFilter does not work on Wicket 1.5-rc2
Hi all,
>From Wicket 1.5, ReloadingWicketFilter does not work.
It seems a classloader from WicketFilter.getClassLoader()
isn't used on instancing WebApplication (WicketFilter.java:281).
The below code works correctly, but ad-hoc.
public class MyWicketFilter extends ReloadingWicketFilter {
static {
ReloadingClassLoader.includePattern("myapplication.web.**");
}
@Override
public void init(boolean isServlet, FilterConfig filterConfig)
throws ServletException {
// force it to use ReloadingClassLoader
Thread.currentThread().setContextClassLoader(getClassLoader());
super.init(isServlet, filterConfig);
}
}
Anyone has an idea how to fix this?
--
Hideyuki TAKEUCHI
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ReloadingWicketFilter does not work on Wicket 1.5-rc2
Posted by Martin Grigorov <mg...@apache.org>.
Hi Hideyuki,
I think the idea is that if the Application class is modified then you'll
need to restart the whole web application.
Even if we use the ReloadingClassLoader it will reload the class but it wont
be re-init()-ed, so it will not be clear whether the changes are loaded and
taken into account or not.
What exactly is the problem you experience ?
On Fri, Apr 1, 2011 at 11:46 AM, Hideyuki TAKEUCHI <we...@chimera.st>wrote:
> Hi Martin,
> Thanks for your reply.
>
> Yes, Please see in WicketFilter.init(boolean, FilterConfig).
>
> public void init(final boolean isServlet,
> final FilterConfig filterConfig) throws ServletException {
> this.filterConfig = filterConfig;
>
> applicationFactory = getApplicationFactory();
> application = applicationFactory.createApplication(this);
> application.setName(filterConfig.getFilterName());
> application.setWicketFilter(this);
>
> ... after that ...
>
> final ClassLoader previousClassLoader =
> Thread.currentThread().getContextClassLoader();
> final ClassLoader newClassLoader = getClassLoader();
>
> ThreadContext.setApplication(application);
> try
> {
> if (previousClassLoader != newClassLoader)
> {
> Thread.currentThread().setContextClassLoader(newClassLoader);
> }
>
> --
> Hideyuki TAKEUCHI
>
>
> (11/04/01 16:55), Martin Grigorov wrote:
>
>> Are you sure ?
>> See WicketFilter's code and the usage
>> of org.apache.wicket.protocol.http.WicketFilter.getClassLoader()
>> ReloadingWicketFilter overrides this method so the reloading class loader
>> should be used in init() and doFilter().
>>
>> 2011/4/1 Hideyuki TAKEUCHI<we...@chimera.st>
>>
>> Hi all,
>>>
>>> From Wicket 1.5, ReloadingWicketFilter does not work.
>>> It seems a classloader from WicketFilter.getClassLoader()
>>> isn't used on instancing WebApplication (WicketFilter.java:281).
>>>
>>> The below code works correctly, but ad-hoc.
>>>
>>> public class MyWicketFilter extends ReloadingWicketFilter {
>>> static {
>>> ReloadingClassLoader.includePattern("myapplication.web.**");
>>> }
>>>
>>> @Override
>>> public void init(boolean isServlet, FilterConfig filterConfig)
>>> throws ServletException {
>>> // force it to use ReloadingClassLoader
>>> Thread.currentThread().setContextClassLoader(getClassLoader());
>>>
>>> super.init(isServlet, filterConfig);
>>> }
>>> }
>>>
>>>
>>> Anyone has an idea how to fix this?
>>>
>>> --
>>> Hideyuki TAKEUCHI
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>
Re: ReloadingWicketFilter does not work on Wicket 1.5-rc2
Posted by Hideyuki TAKEUCHI <we...@chimera.st>.
Hi Martin,
Thanks for your reply.
Yes, Please see in WicketFilter.init(boolean, FilterConfig).
public void init(final boolean isServlet,
final FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
applicationFactory = getApplicationFactory();
application = applicationFactory.createApplication(this);
application.setName(filterConfig.getFilterName());
application.setWicketFilter(this);
... after that ...
final ClassLoader previousClassLoader =
Thread.currentThread().getContextClassLoader();
final ClassLoader newClassLoader = getClassLoader();
ThreadContext.setApplication(application);
try
{
if (previousClassLoader != newClassLoader)
{
Thread.currentThread().setContextClassLoader(newClassLoader);
}
--
Hideyuki TAKEUCHI
(11/04/01 16:55), Martin Grigorov wrote:
> Are you sure ?
> See WicketFilter's code and the usage
> of org.apache.wicket.protocol.http.WicketFilter.getClassLoader()
> ReloadingWicketFilter overrides this method so the reloading class loader
> should be used in init() and doFilter().
>
> 2011/4/1 Hideyuki TAKEUCHI<we...@chimera.st>
>
>> Hi all,
>>
>> From Wicket 1.5, ReloadingWicketFilter does not work.
>> It seems a classloader from WicketFilter.getClassLoader()
>> isn't used on instancing WebApplication (WicketFilter.java:281).
>>
>> The below code works correctly, but ad-hoc.
>>
>> public class MyWicketFilter extends ReloadingWicketFilter {
>> static {
>> ReloadingClassLoader.includePattern("myapplication.web.**");
>> }
>>
>> @Override
>> public void init(boolean isServlet, FilterConfig filterConfig)
>> throws ServletException {
>> // force it to use ReloadingClassLoader
>> Thread.currentThread().setContextClassLoader(getClassLoader());
>>
>> super.init(isServlet, filterConfig);
>> }
>> }
>>
>>
>> Anyone has an idea how to fix this?
>>
>> --
>> Hideyuki TAKEUCHI
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: ReloadingWicketFilter does not work on Wicket 1.5-rc2
Posted by Martin Grigorov <mg...@apache.org>.
Are you sure ?
See WicketFilter's code and the usage
of org.apache.wicket.protocol.http.WicketFilter.getClassLoader()
ReloadingWicketFilter overrides this method so the reloading class loader
should be used in init() and doFilter().
2011/4/1 Hideyuki TAKEUCHI <we...@chimera.st>
> Hi all,
>
> From Wicket 1.5, ReloadingWicketFilter does not work.
> It seems a classloader from WicketFilter.getClassLoader()
> isn't used on instancing WebApplication (WicketFilter.java:281).
>
> The below code works correctly, but ad-hoc.
>
> public class MyWicketFilter extends ReloadingWicketFilter {
> static {
> ReloadingClassLoader.includePattern("myapplication.web.**");
> }
>
> @Override
> public void init(boolean isServlet, FilterConfig filterConfig)
> throws ServletException {
> // force it to use ReloadingClassLoader
> Thread.currentThread().setContextClassLoader(getClassLoader());
>
> super.init(isServlet, filterConfig);
> }
> }
>
>
> Anyone has an idea how to fix this?
>
> --
> Hideyuki TAKEUCHI
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>