On Thu, 2008-07-31 at 20:41 -0700, Adib Saikali wrote:
> Hello Wicket Developers,
>
> Thanks for a great framework. I am studying the source code for Wicket and
> have some questions about some parts of the code that are not obvious to me.
> I have spent many hours stepping through the code and have not found a good
> answer/reason.
>
> 1) in the WicketFilter init() and doGet() method wicket is getting the
> current class loader twice and checking if the previousClassLoader is the
> same as the current class loader. Why is this code needed and what does it
> really do? Are you fixing some bug in some app server with this code?
>
>
> final ClassLoader previousClassLoader =
> Thread.currentThread().getContextClassLoader();
> final ClassLoader newClassLoader = getClassLoader();
> try
> {
> if (previousClassLoader != newClassLoader)
> {
>
> Thread.currentThread().setContextClassLoader(newClassLoader);
> }
>
> protected ClassLoader getClassLoader()
> {
> return Thread.currentThread().getContextClassLoader();
> }
>
As you can see getClassLoader() is protected. So you (as developer)
could extend WicketFilter and provide different implementation for this
method and return another class loader suitable for your needs.
>
> Thanks
> Adib
>
>