@@ -298,32 +298,31 @@ private static void addServletWithApplication(final ServletContext context,
298298 * Enhance existing servlet configuration.
299299 */
300300 private static void addServletWithExistingRegistration (final ServletContext context ,
301- final ServletRegistration registration ,
301+ ServletRegistration registration ,
302302 final Class <? extends Application > clazz ,
303303 final Set <Class <?>> classes ) throws ServletException {
304304 // create a new servlet container for a given app.
305305 final ResourceConfig resourceConfig = ResourceConfig .forApplicationClass (clazz , classes )
306306 .addProperties (getInitParams (registration ))
307307 .addProperties (Utils .getContextParams (context ));
308308
309- final ServletRegistration .Dynamic dynamicRegistration ;
310309 if (registration .getClassName () != null ) {
311310 // class name present - complete servlet registration from container point of view
312311 Utils .store (resourceConfig , context , registration .getName ());
313- dynamicRegistration = (ServletRegistration .Dynamic ) registration ;
314312 } else {
315313 // no class name - no complete servlet registration from container point of view
316314 final ServletContainer servlet = new ServletContainer (resourceConfig );
317- dynamicRegistration = context .addServlet (clazz .getName (), servlet );
315+ final ServletRegistration . Dynamic dynamicRegistration = context .addServlet (clazz .getName (), servlet );
318316 dynamicRegistration .setAsyncSupported (true );
319317 dynamicRegistration .setLoadOnStartup (1 );
318+ registration = dynamicRegistration ;
320319 }
321- if (dynamicRegistration .getMappings ().isEmpty ()) {
320+ if (registration .getMappings ().isEmpty ()) {
322321 final ApplicationPath ap = clazz .getAnnotation (ApplicationPath .class );
323322 if (ap != null ) {
324323 final String mapping = createMappingPath (ap );
325324 if (!mappingExists (context , mapping )) {
326- dynamicRegistration .addMapping (mapping );
325+ registration .addMapping (mapping );
327326
328327 LOGGER .log (Level .CONFIG , LocalizationMessages .JERSEY_APP_REGISTERED_MAPPING (clazz .getName (), mapping ));
329328 } else {
0 commit comments