Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Jersey server configuration properties are ignored #88

Closed
isole opened this issue Mar 16, 2015 · 6 comments
Closed

Jersey server configuration properties are ignored #88

isole opened this issue Mar 16, 2015 · 6 comments

Comments

@isole
Copy link

isole commented Mar 16, 2015

We are going to use the connector in production and we are missing the ability to set some Jersey server configuration properties. The connector only considers two of them, i.e jersey.config.server.disableMetainfServicesLookup and jersey.config.server.disableAutoDiscovery, which basically disable the auto discovery feature, and ignores the rest. It would be nice if a more generic approach were used to consider all of them, or at least consider them by introducing new properties to the connector and map those with Jersey's sever configuration properties.

Patch proposal attached

diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
index 1145b72..d1c119b 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
@@ -39,7 +39,7 @@ public class Configuration implements ManagedService {
       ensureRootIsPresent( root );
       String rootPath = ( String )root;
       ensureRootIsValid( rootPath );
-      connector.updateConfiguration( rootPath, isWadlDisabled( properties ), getPublishDelay( properties ) );
+      connector.updateConfiguration( rootPath, getPublishDelay( properties ), properties );
     }
   }

@@ -55,14 +55,6 @@ public class Configuration implements ManagedService {
     }
   }

-  private boolean isWadlDisabled( Dictionary properties ){
-    Object wadl = properties.get( PROPERTY_WADL_DISABLE );
-    if( wadl == null ){
-      return false;
-    }
-    return ( ( Boolean)wadl ).booleanValue();
-  }
-
   private long getPublishDelay( Dictionary properties ) {
     Object interval = properties.get( PROPERTY_PUBLISH_DELAY );
     if( interval == null ){
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
index c20619c..24bf39d 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
@@ -12,14 +12,13 @@
 package com.eclipsesource.jaxrs.publisher.internal;

 import java.util.ArrayList;
+import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpService;
-
 import com.eclipsesource.jaxrs.publisher.ServletConfiguration;
 import com.eclipsesource.jaxrs.publisher.internal.ServiceContainer.ServiceHolder;

@@ -38,8 +37,8 @@ public class JAXRSConnector {
   private final List<ServiceHolder> resourceCache;
   private ServletConfiguration servletConfiguration;
   private String rootPath;
-  private boolean isWadlDisabled;
   private long publishDelay;
+  private Dictionary jerseyServerProperties;

   JAXRSConnector( BundleContext bundleContext ) {
     this.bundleContext = bundleContext;
@@ -50,15 +49,15 @@ public class JAXRSConnector {
     this.publishDelay = Configuration.DEFAULT_PUBLISH_DELAY;
   }

-  void updateConfiguration( String rootPath, boolean isWadlDisabled, long publishDelay ) {
+  void updateConfiguration( String rootPath, long publishDelay, Dictionary jerseyServerProperties ) {
     synchronized( lock ) {
-      doUpdateConfiguration( rootPath, isWadlDisabled, publishDelay );
+      doUpdateConfiguration( rootPath, publishDelay, jerseyServerProperties );
     }
   }

-  private void doUpdateConfiguration( String rootPath, boolean isWadlDisabled, long publishDelay ) {
+  private void doUpdateConfiguration( String rootPath, long publishDelay, Dictionary jerseyServerProperties ) {
     this.rootPath = rootPath;
-    this.isWadlDisabled = isWadlDisabled;
+    this.jerseyServerProperties = jerseyServerProperties;
     this.publishDelay = publishDelay;
     doUpdateHttpServices();
   }
@@ -98,7 +97,7 @@ public class JAXRSConnector {
     ServiceHolder serviceHolder = httpServices.add( reference );
     HttpService service = ( HttpService )serviceHolder.getService();
     contextMap.put( service, 
-                    createJerseyContext( service, rootPath, isWadlDisabled, publishDelay, servletConfiguration ) );
+                    createJerseyContext( service, rootPath, jerseyServerProperties, publishDelay, servletConfiguration ) );
     clearCache();
     return service;
   }
@@ -210,10 +209,10 @@ public class JAXRSConnector {
   // For testing purpose
   JerseyContext createJerseyContext( HttpService service,
                                      String rootPath,
-                                     boolean disableWadl,
+                                     Dictionary jerseyServerProperties,
                                      long publishDelay,
                                      ServletConfiguration servletConfiguration )
   {
-    return new JerseyContext( service, rootPath, disableWadl, publishDelay, servletConfiguration );
+    return new JerseyContext( service, rootPath, jerseyServerProperties, publishDelay, servletConfiguration );
   }
 }
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
index da50499..582a1c2 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
@@ -15,16 +15,14 @@ package com.eclipsesource.jaxrs.publisher.internal;

 import java.util.ArrayList;
 import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.List;
-
 import javax.servlet.ServletException;
 import javax.ws.rs.core.Application;
-
 import org.glassfish.jersey.server.ServerProperties;
 import org.osgi.service.http.HttpContext;
 import org.osgi.service.http.HttpService;
 import org.osgi.service.http.NamespaceException;
-
 import com.eclipsesource.jaxrs.publisher.ServletConfiguration;


@@ -38,22 +36,25 @@ public class JerseyContext {
   private final ServletConfiguration servletConfigurationService;
   private final ResourcePublisher resourcePublisher;
   private boolean isApplicationRegistered;
+  private final Dictionary jerseyServerProperties;

-  public JerseyContext( HttpService httpService, String rootPath, boolean isWadlDisabled, long publishDelay ) {
-    this( httpService, rootPath, isWadlDisabled, publishDelay, null ); 
+  public JerseyContext( HttpService httpService, String rootPath, Dictionary jerseyServerProperties, long publishDelay ) {
+    this( httpService, rootPath, jerseyServerProperties, publishDelay, null ); 
   }

   public JerseyContext( HttpService httpService,
                         String rootPath,
-                        boolean isWadlDisabled,
+                        Dictionary jerseyServerProperties,
                         long publishDelay,
                         ServletConfiguration servletConfigurationService )
   {
     this.httpService = httpService;
+    this.jerseyServerProperties = jerseyServerProperties;
     this.rootPath = rootPath == null ? "/services" : rootPath;
     this.application = new RootApplication();
+    applyJerseyConfiguration();
     disableAutoDiscovery();
-    disableWadl( isWadlDisabled );
+    disableWadl();
     this.servletContainerBridge = new ServletContainerBridge( application );
     this.servletConfigurationService = servletConfigurationService;
     this.resourcePublisher = new ResourcePublisher( servletContainerBridge, publishDelay );
@@ -64,7 +65,6 @@ public class JerseyContext {
     this.application.addProperty(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, false );
     // disable auto discovery on server, as it's handled via OSGI
     this.application.addProperty(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true );
-    this.application.addProperty(ServerProperties.RESPONSE_SET_STATUS_OVER_SEND_ERROR, true); //patch proposal
   }

   /**
@@ -72,11 +72,37 @@ public class JerseyContext {
    * default to each resource and an auto-generated /application.wadl resource is deployed too. In
    * case you want to disable that you can set this property to true.
    * 
-   * @param disableWadl <code>true</code> to disable WADL feature 
+   * @deprecated The 'disableWadl' property can be directly injected to Jersey's configuration 
+   *    via the 'jerseyProperties' dictionary, hence this could be marked as deprecated and can be removed.
    */
-  private void disableWadl( boolean disableWadl ) {
+  private void disableWadl() {
+    final boolean disableWadl;
+    {
+        Object o = jerseyServerProperties.get(ServerProperties.WADL_FEATURE_DISABLE);
+        if (o == null) {
+            disableWadl = false;
+        } else {
+            disableWadl = Boolean.parseBoolean((String) o);
+        }
+    }
     this.application.addProperty( ServerProperties.WADL_FEATURE_DISABLE, disableWadl );
   }
+  
+  /**
+   * Apply the jersey configuration. The Server configuration properties that are supported can be 
+   * found in {@link org.glassfish.jersey.server.ServerProperties}
+   */
+  private void applyJerseyConfiguration() {
+      Enumeration enumeration = jerseyServerProperties.keys();
+      while(enumeration.hasMoreElements()) {
+        String key = (String) enumeration.nextElement();
+        
+        if (key.startsWith("jersey.config") || key.startsWith("javax.ws.rs")) {
+          Object value = jerseyServerProperties.get(key);
+          this.application.addProperty(key, value);
+        }
+      }
+  }

   public void addResource( Object resource ) {
     getRootApplication().addResource( resource );
@hstaudacher
Copy link
Owner

Hi,
I also thought about this problem. Thanks for the patch but I think the solution is not generic enough. I would go with an Interface/Service that takes the "Application" and will be called before the application is registered.

This would allow you to register it as an service e.g. MyJerseyConfiguration and add the properties the way you like it e.g. ConfigAdmin, SysProperties etc. This interface can look like this:

public interface ApplicationConfiguration {
  void configure( Application application );
}

What do you think?

@hstaudacher
Copy link
Owner

Btw. this would also clean up the current wadl etc. handling because they could be registered in a DefaultConfiguration instead of the current pass-through mess.

@isole
Copy link
Author

isole commented Mar 18, 2015

Pretty much similar to ServletConfiguration? Sounds good. I am guessing you are going to keep the two properties 'root' and 'publishDelay', right? I took the liberty and created a patch for that. Tell me if it's ok and I will create a pull request.

diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/ApplicationConfiguration.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/ApplicationConfiguration.java
new file mode 100644
index 0000000..81fdd1d
--- /dev/null
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/ApplicationConfiguration.java
@@ -0,0 +1,8 @@
+package com.eclipsesource.jaxrs.publisher;
+
+import javax.ws.rs.core.Application;
+
+public interface ApplicationConfiguration {
+
+    void configure(Application application);
+}
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Activator.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Activator.java
index c0e10ef..40e1bff 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Activator.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Activator.java
@@ -39,6 +39,7 @@ public class Activator implements BundleActivator {
   private ResourceTracker allTracker;
   private ServletConfigurationTracker servletConfigurationTracker;
   private ServiceRegistration configRegistration;
+  private ApplicationConfigurationTracker applicationConfigurationTracker;

   @Override
   public void start( BundleContext context ) throws Exception {
@@ -51,6 +52,7 @@ public class Activator implements BundleActivator {
     openHttpServiceTracker( context );
     openServletConfigurationTracker( context );
     openAllServiceTracker( context );
+    openApplicationConfigurationTracker( context );
   }

   private void registerConfiguration( BundleContext context ) {
@@ -83,6 +85,11 @@ public class Activator implements BundleActivator {
     allTracker = new ResourceTracker( context, allResourceFilter.getFilter(), jaxRsConnector );
     allTracker.open();
   }
+  
+  private void openApplicationConfigurationTracker( BundleContext context ) {
+    applicationConfigurationTracker = new ApplicationConfigurationTracker( context, jaxRsConnector );
+    applicationConfigurationTracker.open();
+  }

   private ResourceFilter getResourceFilter( BundleContext context ) {
     ServiceReference filterReference = context.getServiceReference( ResourceFilter.class.getName() );
@@ -97,6 +104,7 @@ public class Activator implements BundleActivator {
     httpTracker.close();
     servletConfigurationTracker.close();
     allTracker.close();
+    applicationConfigurationTracker.close();
     connectorRegistration.unregister();
     configRegistration.unregister();
   }
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/ApplicationConfigurationTracker.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/ApplicationConfigurationTracker.java
new file mode 100644
index 0000000..8f156d8
--- /dev/null
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/ApplicationConfigurationTracker.java
@@ -0,0 +1,32 @@
+
+package com.eclipsesource.jaxrs.publisher.internal;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Filter;
+import org.osgi.framework.ServiceReference;
+import org.osgi.util.tracker.ServiceTracker;
+import com.eclipsesource.jaxrs.publisher.ApplicationConfiguration;
+
+public class ApplicationConfigurationTracker extends ServiceTracker {
+
+    private JAXRSConnector connector;
+    private final BundleContext context;
+
+    public ApplicationConfigurationTracker(BundleContext context, JAXRSConnector connector) {
+        super(context, ApplicationConfiguration.class.getName(), null);
+        this.context = context;
+        this.connector = connector;
+    }
+    
+    @Override
+    public Object addingService( ServiceReference reference ) {
+        return connector.setApplicationConfiguration(reference);
+    }
+    
+    @Override
+    public void removedService( ServiceReference reference, Object service ) {
+      if( service instanceof ApplicationConfiguration ) {
+          connector.unsetApplicationConfiguration(reference, ( ApplicationConfiguration ) service);
+      }
+    }
+}
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
index d1c119b..4cc7522 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/Configuration.java
@@ -22,7 +22,6 @@ public class Configuration implements ManagedService {

   static final String CONFIG_SERVICE_PID = "com.eclipsesource.jaxrs.connector";
   static final String PROPERTY_ROOT = "root";
-  static final String PROPERTY_WADL_DISABLE = "disableWadl";
   static final String PROPERTY_PUBLISH_DELAY = "publishDelay";
   static final long DEFAULT_PUBLISH_DELAY = 150;

@@ -39,7 +38,7 @@ public class Configuration implements ManagedService {
       ensureRootIsPresent( root );
       String rootPath = ( String )root;
       ensureRootIsValid( rootPath );
-      connector.updateConfiguration( rootPath, getPublishDelay( properties ), properties );
+      connector.updateConfiguration( rootPath, getPublishDelay( properties ) );
     }
   }

diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
index 24bf39d..9df8e17 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JAXRSConnector.java
@@ -19,6 +19,7 @@ import java.util.Map;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.http.HttpService;
+import com.eclipsesource.jaxrs.publisher.ApplicationConfiguration;
 import com.eclipsesource.jaxrs.publisher.ServletConfiguration;
 import com.eclipsesource.jaxrs.publisher.internal.ServiceContainer.ServiceHolder;

@@ -36,9 +37,9 @@ public class JAXRSConnector {
   private final BundleContext bundleContext;
   private final List<ServiceHolder> resourceCache;
   private ServletConfiguration servletConfiguration;
+  private ApplicationConfiguration applicationConfiguration;
   private String rootPath;
   private long publishDelay;
-  private Dictionary jerseyServerProperties;

   JAXRSConnector( BundleContext bundleContext ) {
     this.bundleContext = bundleContext;
@@ -49,15 +50,14 @@ public class JAXRSConnector {
     this.publishDelay = Configuration.DEFAULT_PUBLISH_DELAY;
   }

-  void updateConfiguration( String rootPath, long publishDelay, Dictionary jerseyServerProperties ) {
+  void updateConfiguration( String rootPath, long publishDelay ) {
     synchronized( lock ) {
-      doUpdateConfiguration( rootPath, publishDelay, jerseyServerProperties );
+      doUpdateConfiguration( rootPath, publishDelay );
     }
   }

-  private void doUpdateConfiguration( String rootPath, long publishDelay, Dictionary jerseyServerProperties ) {
+  private void doUpdateConfiguration( String rootPath, long publishDelay ) {
     this.rootPath = rootPath;
-    this.jerseyServerProperties = jerseyServerProperties;
     this.publishDelay = publishDelay;
     doUpdateHttpServices();
   }
@@ -97,7 +97,7 @@ public class JAXRSConnector {
     ServiceHolder serviceHolder = httpServices.add( reference );
     HttpService service = ( HttpService )serviceHolder.getService();
     contextMap.put( service, 
-                    createJerseyContext( service, rootPath, jerseyServerProperties, publishDelay, servletConfiguration ) );
+                    createJerseyContext( service, rootPath, publishDelay, applicationConfiguration, servletConfiguration ) );
     clearCache();
     return service;
   }
@@ -209,10 +209,26 @@ public class JAXRSConnector {
   // For testing purpose
   JerseyContext createJerseyContext( HttpService service,
                                      String rootPath,
-                                     Dictionary jerseyServerProperties,
                                      long publishDelay,
+                                     ApplicationConfiguration applicationConfiguration, 
                                      ServletConfiguration servletConfiguration )
   {
-    return new JerseyContext( service, rootPath, jerseyServerProperties, publishDelay, servletConfiguration );
+    return new JerseyContext( service, rootPath, publishDelay, applicationConfiguration, servletConfiguration );
   }
+
+  ApplicationConfiguration setApplicationConfiguration(ServiceReference reference) {
+    if (applicationConfiguration == null ) {
+        applicationConfiguration = (ApplicationConfiguration) bundleContext.getService(reference);
+        return applicationConfiguration;
+    }
+    return null;
+  }
+  
+  void unsetApplicationConfiguration(ServiceReference reference, ApplicationConfiguration service) {
+      if( applicationConfiguration == service ) {
+          applicationConfiguration = null;
+        bundleContext.ungetService( reference );
+        doUpdateHttpServices();
+      }
+    } 
 }
diff --git a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
index 582a1c2..4c85f05 100644
--- a/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
+++ b/com.eclipsesource.jaxrs.publisher/src/com/eclipsesource/jaxrs/publisher/internal/JerseyContext.java
@@ -23,6 +23,7 @@ import org.glassfish.jersey.server.ServerProperties;
 import org.osgi.service.http.HttpContext;
 import org.osgi.service.http.HttpService;
 import org.osgi.service.http.NamespaceException;
+import com.eclipsesource.jaxrs.publisher.ApplicationConfiguration;
 import com.eclipsesource.jaxrs.publisher.ServletConfiguration;


@@ -34,27 +35,24 @@ public class JerseyContext {
   private final String rootPath;
   private final ServletContainerBridge servletContainerBridge;
   private final ServletConfiguration servletConfigurationService;
+  private final ApplicationConfiguration applicationConfiguration;
   private final ResourcePublisher resourcePublisher;
   private boolean isApplicationRegistered;
-  private final Dictionary jerseyServerProperties;

-  public JerseyContext( HttpService httpService, String rootPath, Dictionary jerseyServerProperties, long publishDelay ) {
-    this( httpService, rootPath, jerseyServerProperties, publishDelay, null ); 
+  public JerseyContext( HttpService httpService, String rootPath, long publishDelay ) {
+    this( httpService, rootPath, publishDelay, null, null ); 
   }

   public JerseyContext( HttpService httpService,
                         String rootPath,
-                        Dictionary jerseyServerProperties,
                         long publishDelay,
+                        ApplicationConfiguration applicationConfiguration,
                         ServletConfiguration servletConfigurationService )
   {
     this.httpService = httpService;
-    this.jerseyServerProperties = jerseyServerProperties;
+    this.applicationConfiguration = applicationConfiguration;
     this.rootPath = rootPath == null ? "/services" : rootPath;
     this.application = new RootApplication();
-    applyJerseyConfiguration();
-    disableAutoDiscovery();
-    disableWadl();
     this.servletContainerBridge = new ServletContainerBridge( application );
     this.servletConfigurationService = servletConfigurationService;
     this.resourcePublisher = new ResourcePublisher( servletContainerBridge, publishDelay );
@@ -67,43 +65,6 @@ public class JerseyContext {
     this.application.addProperty(ServerProperties.FEATURE_AUTO_DISCOVERY_DISABLE, true );
   }

-  /**
-   * WADL generation is enabled in Jersey by default. This means that OPTIONS methods are added by
-   * default to each resource and an auto-generated /application.wadl resource is deployed too. In
-   * case you want to disable that you can set this property to true.
-   * 
-   * @deprecated The 'disableWadl' property can be directly injected to Jersey's configuration 
-   *    via the 'jerseyProperties' dictionary, hence this could be marked as deprecated and can be removed.
-   */
-  private void disableWadl() {
-    final boolean disableWadl;
-    {
-        Object o = jerseyServerProperties.get(ServerProperties.WADL_FEATURE_DISABLE);
-        if (o == null) {
-            disableWadl = false;
-        } else {
-            disableWadl = Boolean.parseBoolean((String) o);
-        }
-    }
-    this.application.addProperty( ServerProperties.WADL_FEATURE_DISABLE, disableWadl );
-  }
-  
-  /**
-   * Apply the jersey configuration. The Server configuration properties that are supported can be 
-   * found in {@link org.glassfish.jersey.server.ServerProperties}
-   */
-  private void applyJerseyConfiguration() {
-      Enumeration enumeration = jerseyServerProperties.keys();
-      while(enumeration.hasMoreElements()) {
-        String key = (String) enumeration.nextElement();
-        
-        if (key.startsWith("jersey.config") || key.startsWith("javax.ws.rs")) {
-          Object value = jerseyServerProperties.get(key);
-          this.application.addProperty(key, value);
-        }
-      }
-  }
-
   public void addResource( Object resource ) {
     getRootApplication().addResource( resource );
     registerServletWhenNotAlreadyRegistered();
@@ -113,6 +74,7 @@ public class JerseyContext {
   void registerServletWhenNotAlreadyRegistered() {
     if( !isApplicationRegistered ) {
       isApplicationRegistered = true;
+      applicationConfiguration.configure(application);
       registerApplication();
     }
   }

@hstaudacher
Copy link
Owner

Hi, thanks for your work but I also started yesterday implementing it ;).

I took the chance and refactor the Configuration class to get rid of all the property references. Will have a version ready this evening I guess.

When I'm publishing a RC p2 repo can you test it?

@isole
Copy link
Author

isole commented Mar 18, 2015

Hehe, no problem

Sure

@hstaudacher
Copy link
Owner

@isole I will provide an RC tomorrow morning in a separate issue and link it here. Will also update the included jersey version before.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants