hstaudacher / osgi-jax-rs-connector

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below
http://hstaudacher.github.io/osgi-jax-rs-connector
Other
191 stars 98 forks source link

Fixed initialization problems in connector, improved startup, added abil... #80

Closed kolkoo closed 9 years ago

kolkoo commented 9 years ago

...ity to pass initial parameters and HttpContext to Http servlet.

Signed-off-by: IVAN GEORGIEV ILIEV ivan.iliev@musala.com

kolkoo commented 9 years ago

The purpose of this pull request was at first to add the ability to pass HttpContext and initialization parameters to the connector servlet (registerServlet call last two parameters).

Along the way I discovered some problems with connector startup and I have done a few changes in order to resolve them.

All of the changes done are withing the publisher bundle, I have also adapted the tests to work with my changes and added new ones for the new functionality.

Short summary of fixes/changes:

  1. Tracking ServletConfigurationService in order to provide HttpContext and Dictionary for the registerServlet call. When such a service appears or disappears all HttpServices are removed and readded (same thing happens when Configuration is updated).
  2. Changed the ServletContainerBridge<->RootApplication resource locking and dirty flag interaction to eliminate any possible failures.
  3. The ServletContainerBridge runnable is now scheduled to run when resources are added or removed, this ensures that it will run after the servlet is registered and not before and that it will run only if needed.
  4. Added locking to ensure that we aren't unregistering servlet while calling reload on the ServletContainer - otherwise we get exceptions.
hstaudacher commented 9 years ago

Thanks. Will take a look

kaikreuzer commented 9 years ago

Holger, any idea when you might find the time for review and a potential release of 4.2? We might need it by the end of next week - in case this is unrealistic, we would probably prepare our own temporary fork.

hstaudacher commented 9 years ago

working on it right now

hstaudacher commented 9 years ago

Hey guys, thanks for your patience and your contribution.

I accepted the pull request and did a small rework. Please read the commit message to see what I have done.

IMPORTANT: I renamed the ServletConfigurationService to ServletConfiguration because the "Service" suffix does not add any value. Anyway you may need to change your implementation.

Will work on the 4.2.0 release today.

kaikreuzer commented 9 years ago

Great, thanks a lot, Holger!

hstaudacher commented 9 years ago

@kaikreuzer I will to another RC today and open a separate issue for it. As soon it get's verified by you I will do the release ;)

kaikreuzer commented 9 years ago

Ok, I'll be prepared to test it :-)

ieugen commented 9 years ago

:+1: for the release, whill you be pushing artifacts to Maven Central also?

hstaudacher commented 9 years ago

@ieugen yes it will be published. Actually I just uploaded it.

ieugen commented 9 years ago

Cool. I checked it out but it's not there yet. Will re-check in 24-48h.

[1] http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.eclipsesource.jaxrs%22