Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 220919 Details for
Bug 367033
RWTServletContextListener should use context class loader to load configurator class
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
With this patch RWTServletContextListener now tries to load the IEntryPoint and ApplicationConfiguration with the TCCL first.
0001-Bug-367033-RWTServletContextListener-now-tries-to-lo.patch (text/plain), 3.57 KB, created by
Florian Waibel
on 2012-09-11 04:07:53 EDT
(
hide
)
Description:
With this patch RWTServletContextListener now tries to load the IEntryPoint and ApplicationConfiguration with the TCCL first.
Filename:
MIME Type:
Creator:
Florian Waibel
Created:
2012-09-11 04:07:53 EDT
Size:
3.57 KB
patch
obsolete
>From cbadd0eeec72ba0cab9cbfaedc64a461675be5aa Mon Sep 17 00:00:00 2001 >From: Florian Waibel <fwaibel@eclipsesource.com> >Date: Tue, 11 Sep 2012 10:01:55 +0200 >Subject: [PATCH] Bug 367033 - RWTServletContextListener now tries to loads > the IEntryPoint and ApplicationConfiguration with the TCCL > first. > >--- > .../rap/rwt/engine/RWTServletContextListener.java | 12 ++++++++++-- > .../rwt/engine/RWTServletContextListener_Test.java | 17 +++++++++++++++++ > 2 files changed, 27 insertions(+), 2 deletions(-) > >diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/engine/RWTServletContextListener.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/engine/RWTServletContextListener.java >index 7e5d458..4129edb 100644 >--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/engine/RWTServletContextListener.java >+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/engine/RWTServletContextListener.java >@@ -73,10 +73,18 @@ public class RWTServletContextListener implements ServletContextListener { > } > > private ApplicationConfiguration createConfiguration( String className ) { >- ClassLoader loader = getClass().getClassLoader(); >+ ClassLoader loader = getClassLoader(); > return ( ApplicationConfiguration )ClassUtil.newInstance( loader, className ); > } > >+ private ClassLoader getClassLoader() { >+ ClassLoader loader = Thread.currentThread().getContextClassLoader(); >+ if (loader==null) { >+ loader = getClass().getClassLoader(); >+ } >+ return loader; >+ } >+ > private ApplicationConfiguration readEntryPointRunnerConfiguration( ServletContext context ) { > try { > return doReadEntryPointRunnerConfiguration( context ); >@@ -90,7 +98,7 @@ public class RWTServletContextListener implements ServletContextListener { > throws ClassNotFoundException > { > String className = context.getInitParameter( ENTRY_POINTS_PARAM ); >- ClassLoader loader = getClass().getClassLoader(); >+ ClassLoader loader = getClassLoader(); > Class<?> entryPointClass = loader.loadClass( className ); > return new EntryPointRunnerConfiguration( ( Class<? extends IEntryPoint> )entryPointClass ); > } >diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/engine/RWTServletContextListener_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/engine/RWTServletContextListener_Test.java >index 6d8a037..cb1fa7e 100644 >--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/engine/RWTServletContextListener_Test.java >+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/engine/RWTServletContextListener_Test.java >@@ -94,6 +94,23 @@ public class RWTServletContextListener_Test extends TestCase { > assertResourceIsRegistered(); > } > >+ public void testConfiguratorWithThreadContextClassLoader() { >+ String className = TestConfigurator.class.getName(); >+ servletContext.setInitParameter( ApplicationConfiguration.CONFIGURATION_PARAM, className ); >+ >+ ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader(); >+ try { >+ Thread.currentThread().setContextClassLoader( new ClassLoader(getClass().getClassLoader()) {} ); >+ rwtServletContextListener.contextInitialized( contextInitializedEvent ); >+ } finally { >+ Thread.currentThread().setContextClassLoader( oldTCCL ); >+ } >+ >+ assertEntryPointIsRegistered(); >+ assertPhaseListenersAreRegistered(); >+ assertResourceIsRegistered(); >+ } >+ > private void assertResourceManagerIsRegistered() { > ApplicationContext applicationContext = ApplicationContextUtil.get( servletContext ); > assertNotNull( applicationContext.getResourceManager() ); >-- >1.7.5 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 367033
: 220919