Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 367033
Collapse All | Expand All

(-)a/bundles/org.eclipse.rap.rwt/src/org/eclipse/rap/rwt/engine/RWTServletContextListener.java (-2 / +10 lines)
Lines 73-82 public class RWTServletContextListener implements ServletContextListener { Link Here
73
  }
73
  }
74
74
75
  private ApplicationConfiguration createConfiguration( String className ) {
75
  private ApplicationConfiguration createConfiguration( String className ) {
76
    ClassLoader loader = getClass().getClassLoader();
76
    ClassLoader loader = getClassLoader();
77
    return ( ApplicationConfiguration )ClassUtil.newInstance( loader, className );
77
    return ( ApplicationConfiguration )ClassUtil.newInstance( loader, className );
78
  }
78
  }
79
79
80
  private ClassLoader getClassLoader() {
81
    ClassLoader loader = Thread.currentThread().getContextClassLoader();
82
    if (loader==null) {
83
        loader = getClass().getClassLoader();
84
    }
85
    return loader;
86
  }
87
80
  private ApplicationConfiguration readEntryPointRunnerConfiguration( ServletContext context ) {
88
  private ApplicationConfiguration readEntryPointRunnerConfiguration( ServletContext context ) {
81
    try {
89
    try {
82
      return doReadEntryPointRunnerConfiguration( context );
90
      return doReadEntryPointRunnerConfiguration( context );
Lines 90-96 public class RWTServletContextListener implements ServletContextListener { Link Here
90
    throws ClassNotFoundException
98
    throws ClassNotFoundException
91
  {
99
  {
92
    String className = context.getInitParameter( ENTRY_POINTS_PARAM );
100
    String className = context.getInitParameter( ENTRY_POINTS_PARAM );
93
    ClassLoader loader = getClass().getClassLoader();
101
    ClassLoader loader = getClassLoader();
94
    Class<?> entryPointClass = loader.loadClass( className );
102
    Class<?> entryPointClass = loader.loadClass( className );
95
    return new EntryPointRunnerConfiguration( ( Class<? extends IEntryPoint> )entryPointClass );
103
    return new EntryPointRunnerConfiguration( ( Class<? extends IEntryPoint> )entryPointClass );
96
  }
104
  }
(-)a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/rap/rwt/engine/RWTServletContextListener_Test.java (-1 / +17 lines)
Lines 94-99 public class RWTServletContextListener_Test extends TestCase { Link Here
94
    assertResourceIsRegistered();
94
    assertResourceIsRegistered();
95
  }
95
  }
96
96
97
  public void testConfiguratorWithThreadContextClassLoader() {
98
    String className = TestConfigurator.class.getName();
99
    servletContext.setInitParameter( ApplicationConfiguration.CONFIGURATION_PARAM, className );
100
101
    ClassLoader oldTCCL = Thread.currentThread().getContextClassLoader();
102
    try {
103
      Thread.currentThread().setContextClassLoader( new ClassLoader(getClass().getClassLoader()) {} );
104
      rwtServletContextListener.contextInitialized( contextInitializedEvent );
105
    } finally {
106
      Thread.currentThread().setContextClassLoader( oldTCCL );
107
    }
108
109
    assertEntryPointIsRegistered();
110
    assertPhaseListenersAreRegistered();
111
    assertResourceIsRegistered();
112
  }
113
97
  private void assertResourceManagerIsRegistered() {
114
  private void assertResourceManagerIsRegistered() {
98
    ApplicationContext applicationContext = ApplicationContextUtil.get( servletContext );
115
    ApplicationContext applicationContext = ApplicationContextUtil.get( servletContext );
99
    assertNotNull( applicationContext.getResourceManager() );
116
    assertNotNull( applicationContext.getResourceManager() );
100
- 

Return to bug 367033