You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alex Shneyderman <a....@gmail.com> on 2007/09/03 20:24:39 UTC

Filter source question ...

I am looking at the source of  org.apache.wicket.protocol.http.WicketFilter
and see this in the init method:

...

		final ClassLoader previousClassLoader =
Thread.currentThread().getContextClassLoader();
		final ClassLoader newClassLoader = getClassLoader();
		try
		{
			if (previousClassLoader != newClassLoader)
			{
				Thread.currentThread().setContextClassLoader(newClassLoader);
			}

....

and code for getClassLoader() :

protected ClassLoader getClassLoader() {
	return Thread.currentThread().getContextClassLoader();
}

...

this looks strange to me. I wonder if this is some sort of trick
that I do not understand or just a mess up?


-- 
Thanks,
Alex.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Filter source question ...

Posted by Eelco Hillenius <ee...@gmail.com>.
On 9/3/07, Alex Shneyderman <a....@gmail.com> wrote:
> I am looking at the source of  org.apache.wicket.protocol.http.WicketFilter
> and see this in the init method:
>
> ...
>
>                 final ClassLoader previousClassLoader =
> Thread.currentThread().getContextClassLoader();
>                 final ClassLoader newClassLoader = getClassLoader();
>                 try
>                 {
>                         if (previousClassLoader != newClassLoader)
>                         {
>                                 Thread.currentThread().setContextClassLoader(newClassLoader);
>                         }
>
> ....
>
> and code for getClassLoader() :
>
> protected ClassLoader getClassLoader() {
>         return Thread.currentThread().getContextClassLoader();
> }
>
> ...
>
> this looks strange to me. I wonder if this is some sort of trick
> that I do not understand or just a mess up?

The point of that is that getClassLoader can be overriden. So in
WicketFilter it is basically a noop, but JBQ's reloading filter for
instance overrides it and returns a different classloader.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Filter source question ...

Posted by Alex Shneyderman <a....@gmail.com>.
Never mind, figured it out.

On 9/3/07, Alex Shneyderman <a....@gmail.com> wrote:
> I am looking at the source of  org.apache.wicket.protocol.http.WicketFilter
> and see this in the init method:
>
> ...
>
>                 final ClassLoader previousClassLoader =
> Thread.currentThread().getContextClassLoader();
>                 final ClassLoader newClassLoader = getClassLoader();
>                 try
>                 {
>                         if (previousClassLoader != newClassLoader)
>                         {
>                                 Thread.currentThread().setContextClassLoader(newClassLoader);
>                         }
>
> ....
>
> and code for getClassLoader() :
>
> protected ClassLoader getClassLoader() {
>         return Thread.currentThread().getContextClassLoader();
> }
>
> ...
>
> this looks strange to me. I wonder if this is some sort of trick
> that I do not understand or just a mess up?
>
>
> --
> Thanks,
> Alex.
>


-- 
Thanks,
Alex.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org