GithubHelp home page GithubHelp logo

hstaudacher / osgi-jax-rs-connector Goto Github PK

View Code? Open in Web Editor NEW
190.0 190.0 98.0 247.34 MB

An OSGi - JAX-RS 2.0 Connector, software repository available on the link below

Home Page: http://hstaudacher.github.io/osgi-jax-rs-connector

License: Other

Java 77.15% HTML 22.85%

osgi-jax-rs-connector's People

Contributors

anujbhatia avatar bitdeli-chef avatar bryanhunt avatar codescale avatar cschneider avatar ddragosd avatar flamenco avatar greencable avatar hstaudacher avatar ieugen avatar iilievdev avatar larsp avatar nolfxceptme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

osgi-jax-rs-connector's Issues

Rework jersey-all bundle

It seems that the maven build to create the jersey-all bundle includes all libraries in a target folder and unpacks them into source folders. This results in duplicate class files. It's not a big deal because the bundle works as expected but by reworking it we can reduce the size by half.

Compile errors in com.eclipsesource.jaxrs.consumer.test

When running "mvn clean install" (under Windows) in project com.eclipsesource.jaxrs.build, the build fails with:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] OSGi - JAX-RS Connector ........................... SUCCESS [0.608s]
[INFO] com.eclipsesource.rest.client.driver .............. SUCCESS [4.506s]
[INFO] com.eclipsesource.jaxrs.publisher ................. SUCCESS [9.095s]
[INFO] com.eclipsesource.jaxrs.consumer .................. SUCCESS [4.585s]
[INFO] com.eclipsesource.jaxrs.provider.moxy ............. SUCCESS [3.973s]
[INFO] com.eclipsesource.jaxrs.provider.gson ............. SUCCESS [3.548s]
[INFO] com.eclipsesource.jaxrs.publisher.test ............ SUCCESS [2.304s]
[INFO] com.eclipsesource.jaxrs.consumer.test ............. FAILURE [0.275s]
[INFO] com.eclipsesource.jaxrs.provider.gson.test ........ SKIPPED
[INFO] com.eclipsesource.jaxrs.jersey.runtime.feature .... SKIPPED
[INFO] com.eclipsesource.jaxrs.connector.feature ......... SKIPPED
[INFO] com.eclipsesource.jaxrs.provider.moxy.feature ..... SKIPPED
[INFO] com.eclipsesource.jaxrs.provider.gson.feature ..... SKIPPED
[INFO] com.eclipsesource.jaxrs.repository ................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.042s
[INFO] Finished at: Fri Nov 01 11:39:26 CET 2013
[INFO] Final Memory: 39M/95M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:0.18.1:compile (default-compi
le) on project com.eclipsesource.jaxrs.consumer.test: Compilation failure: Compilation failure:
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\clientdriver\ClientDriverRequest.java:[186,0]
[ERROR] params.put(key, new MatchesRegex(value));
[ERROR] ^^^
[ERROR] The method put(String, Matcher<? extends String>) in the type Multimap<String,Matcher<? exte
nds String>> is not applicable for the arguments (String, MatchesRegex)
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\clientdriver\ClientDriverRequest.java:[213,0]
[ERROR] this.params.put(key, new MatchesRegex((Pattern) value));
[ERROR] ^^^
[ERROR] The method put(String, Matcher<? extends String>) in the type Multimap<String,Matcher<? exte
nds String>> is not applicable for the arguments (String, MatchesRegex)
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\clientdriver\ClientDriverRequest.java:[314,0]
[ERROR] bodyContentMatcher = new MatchesRegex(withBodyContent);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from MatchesRegex to Matcher<? extends String>
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\clientdriver\ClientDriverRequest.java:[328,0]
[ERROR] bodyContentMatcher = new MatchesRegex(withBodyContent);
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from MatchesRegex to Matcher<? extends String>
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\matchers\MatchesRegex.java:[21,0]
[ERROR] import org.hamcrest.TypeSafeMatcher;
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The import org.hamcrest.TypeSafeMatcher cannot be resolved
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\matchers\MatchesRegex.java:[23,0]
[ERROR] public class MatchesRegex extends TypeSafeMatcher {
[ERROR] ^^^^^^^^^^^^^^^
[ERROR] TypeSafeMatcher cannot be resolved to a type
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\matchers\MatchesRegex.java:[32,0]
[ERROR] public final void describeTo(Description description) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The method describeTo(Description) of type MatchesRegex must override or implement a superty
pe method
[ERROR] E:\dev\java\osgi-jax-rs-connector\build\com.eclipsesource.rest.client.driver\com\github\rest
driver\matchers\MatchesRegex.java:[37,0]
[ERROR] protected boolean matchesSafely(String item) {
[ERROR] ^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] The method matchesSafely(String) of type MatchesRegex must override or implement a supertype
method
[ERROR] 8 problems (8 errors)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :com.eclipsesource.jaxrs.consumer.test

erronous requirements in p2 cause eclipse product export to fail

Using buckminster: complains on com.eclipsesource.jaxrs.consumer.source

[ant] !MESSAGE Missing requirement: OSGi - JAX-RS Connector 3.1.0.201309301542 (com.eclipsesource.jaxrs.connector.feature.feature.group 3.1.0.201309301542) requires 'com.eclipsesource.jaxrs.consumer.source [2.1.0.201309301542]' but it could not be found

Using PDE product export: complains on A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0'

Cannot complete the install because one or more required items could not be found.
Software being installed: com.barco.nimbus.main 0.0.0 (com.barco.nimbus.equinox.app.SCApplication 0.0.0)
Missing requirement: OSGi - JAX-RS Connector 3.1.0.201309301542 (com.eclipsesource.jaxrs.connector.feature.feature.group 3.1.0.201309301542) requires 'A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0' but it could not be found
Cannot satisfy dependency:

Component definition missing in com.eclipsesource.jaxrs.provider.moxy

Installing the most recent version using P2 into the target platform and activating the bundle "com.eclipsesource.jaxrs.provider.moxy" generates the following error message on the command line when starting the Equinox container:

!ENTRY com.eclipsesource.jaxrs.provider.moxy 4 0 2013-11-28 10:10:24.886
!MESSAGE [SCR] Component definition XMLs not found in bundle com.eclipsesource.jaxrs.provider.moxy. The component header value is OSGI-INF/provider.xml

Enable support for Jersey Bean Validation JSR 349

Hi,

First of all, thanks for the great Jersey connector. It saves my days.

I try to look for documentation on how to enable support for Jersey Bean Validation JSR349 but no avail. I checked the jersey-all bundle and it seems that this feature is not currently supported. Is there any plan to support JSR 349? Thank you.

p2 repo erronous required capabilities

When using the p2 repo to add it into my target platform, it complains about missing requirement "A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0"

When looking at required capabillities, this is the list - which indeed contains a line that does not look like a capability.

com.eclipsesource.jaxrs.consumer [2.1.0.201309301542]
com.eclipsesource.jaxrs.consumer.source [2.1.0.201309301542]
com.eclipsesource.jaxrs.publisher [3.1.0.201309301542]
com.eclipsesource.jaxrs.jersey.runtime.feature.feature.group [1.0.0.201309301542]
A.PDE.Target.Platform Cannot be installed into the IDE 0.0.0
com.eclipsesource.jaxrs.connector.feature.feature.jar [3.1.0.201309301542]
com.eclipsesource.jaxrs.publisher.source [3.1.0.201309301542]

how to disable default jetty error pages in Felix http service

I'm setting errors in the responses but Felix Http service is showing me the default error html pages for 400s and 500s. Is there an easy way to override this behaviour from our side or any known way to let Felix Http service? I've raised an issue with Felix JIRA as well

Consumer Error with non / pathes

If you annotate an interface or method with @path and no / as first character the consumer will fail to send the request. I think the consumer should be more robust and handle those cases.

Security as Annotations

Right now, the implementation of security with the connector seems to be quite verbose, as it involves implementing a class every time someone registers a JAX-RS annotated service from a bundle. Is it possible to make create annotations instead for authorization, similar to the Spring-Security annotations? Even better, if spring-security support could be added here.

bundle installation order influences detection of @Provider

I have an app containing jackson (8 bundles to take care of json mapping - using 2.2.2 with handcoded manifest fixes).

If the ss lists your com.eclipsesource bundles before the jackson bundles (com.eclipsesource bundles having a lower id than jackson), the @providers in the jackson are NOT active (nor printed under Message Body Readers:/Writers:).

Using an eclipse launch config based on a set of features: If i then uncheck the osgi-jaxrs-connector feature, run, and re-check the osgi-jaxrs-connector feature and run again (to influence the ordering of the bundle resolution), then the jackson providers are found, printed and active. If i do ss now, i see that the 2 com.eclipsesource are at the end of the list, having larger ids than the jackson bundles.

So i conclude that there's some ordering problem.

Note that stop/starting the com.eclipsesource bundles in the first setup does not help: the jackson providers stay undetected: if the system happens to start with com.eclipsesource bundles having a lower id than jackson-bundles, the jackson-providers are not seen.

Is this normal (am i supposed to use start levels to get it under control?), or is it a bug (any ordering should work out - or stop/starting the connector should trigger rescanning all active bundles for providers)?

Create Jersey-all bundle dynamically

Currently the jersey-all bundle needs to be in the p2 directory of the build project. It would be better to create this p2 directory on the fly during a build. This would allow users to build the connector with custom jersey versions

Path parameter (consumer) validation throws ISE when regexp is used

When a regexp is used in a path and I want to use the consumer, a IllegalStateException is thrown:

java.lang.IllegalStateException: Path http://localhost:8080/test/{test: (\w+\.)+\w+} has undefined path parameters: test: (\w+\.)+\w+ at com.eclipsesource.jaxrs.consumer.internal.RequestConfigurer.validatePath(RequestConfigurer.java:110) at com.eclipsesource.jaxrs.consumer.internal.RequestConfigurer.replacePathParams(RequestConfigurer.java:89) at com.eclipsesource.jaxrs.consumer.internal.RequestConfigurer.computeTarget(RequestConfigurer.java:67) at com.eclipsesource.jaxrs.consumer.internal.RequestConfigurer.configure(RequestConfigurer.java:48) at com.eclipsesource.jaxrs.consumer.internal.ResourceInvocationHandler.sendRequest(ResourceInvocationHandler.java:70) at com.eclipsesource.jaxrs.consumer.internal.ResourceInvocationHandler.invoke(ResourceInvocationHandler.java:65) at com.sun.proxy.$Proxy22.createAttributes(Unknown Source)

json serialization not working

I try to marshall an entity (annotated with @XmlRootElement) and no MessageBodyWrite is found:

org.glassfish.jersey.message.internal.MessageBodyProviderNotFoundException: MessageBodyWriter not found for media type=application/json, type=class de.uulm.ic2.entities.IC2Node, genericType=class de.uulm.ic2.entities.IC2Node.

My service is definied like this:

    @GET
    @Path("node")
    @Produces(MediaType.APPLICATION_JSON)
    public IC2Node getNode(){
        return new IC2Node(0, HOSTNAME_KEY, IP_KEY, 0, ASN_KEY, new ASN());
    }

I am including/starting the gson provider bundle

osgi> ss | grep eclipsesource
68  ACTIVE      com.eclipsesource.jaxrs.publisher_3.1.0.201309301542
70  ACTIVE      com.eclipsesource.jaxrs.provider.gson_1.0.0.201309301542

Am I missing something here?

Wrong bundle name in documentation

This is a minor issue, but cost me some minutes.

The documentation says the Jersey bundle is called "com.eclipsesource.jaxrs.jersey.all" but in fact it is called "com.eclipsesource.jaxrs.jersey-all" (dash instead of dot).

Support for Multipart file uploads

I'm looking for a way to upload files. Jersey supports multipart file uploads via the jersey-media-multipart jersey jar. Can this be supported via this connector ?
Feedback is welcome !
Thanks
Dirk

Add functionality to register JAX RS components to the Client (JAX RS consumer)

The JAX RS consumer should provide a functionality to register JAX RS components (e.g. HttpBasicAuthFilter) to the Client.

There are at least two possibilites:

  1. The components can be added to the custom providers array in the ConsumerFactory.
    ResourceInvocationHandler.registerProviders() must not throw IllegalArgumentException. A new method ResourceInvocationHandler.registerComponents() will add the components to the created client.

  2. The CosumerFactory provides a method to create e.g. a ConsumerHolder.
    The ConsumerHolder allows acces to the JAX RS Client and the service proxy.

The first possiblity is quite easy to use but does not allow to register all kind of components (e.g. it is not possible to set the priority).

The second possibility is more flexible, but a bit more complex to use.

Change osgi package import versions

Currently we use:
org.osgi.framework 1.7.0
org.osgi.service.cm 1.4.0

we can decrease them to the indigo version without risking compile issues.

Possiblitity to pre-/post-process outgoing and incoming http request and response

Hello Holger!
We are enthusiastic users of your jax-rs-connector and we love it ;-)

Now we are at a point where we need to post-process the outgoing http REST call, e.g. to include a session-id as http header. We also need to pre-process an incoming REST call, e.g. to check for specific HTTP error codes etc.

I am not sure whether an adaption of your jax-rs-connector is needed or we can do this via Jersey Runtime. What we need is a kind of hook mechanism wherer we can interfere the sending/receiving of REST calls.

Thanks for your help.
Dirk

No Support for @FormDataParam annotation

There is no support for Multi-Part requests using the @FormDataParam annotation.

This does not work:

Interface:

@Path("/jobs")
public interface JobsManager {

    @POST
    @Path("/new")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public abstract Response create(@FormDataParam("inputFile")
              String projectDescription);
}

Publisher:

 publisher.publishConsumers( baseUrl, 
                                new Class<?>[] { JobsManager.class }, 
                                new Object[] {  });

Caller:

String projDesc = "...";
JobsManager jobsMgr = bundleContext.getService( ... );
jobsMgr.create(projDesc);

This works:

Interface:

@Path("/jobs")
public interface JobsManager {

    @POST
    @Path("/new")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    public abstract Response create(FormDataMultiPart 
                     projectDescription);
}

Publisher:

 publisher.publishConsumers( baseUrl, 
                                new Class<?>[] { JobsManager.class }, 
                                new Object[] { new MultiPartFeature() });

Caller:

String projDesc = "...";
JobsManager jobsMgr = bundleContext.getService( ... );
FormDataMultiPart formData = new FormDataMultiPart();
formData.field("inputFile", projDesc, MediaType.TEXT_PLAIN_TYPE);
jobsMgr.create(formData);

Unused package imports in com.eclipsesource.jaxrs.consumer

According to Eclipse's dependency analysis, the following packages are imported in jaxrs.consumer bundle, but not used:

com.google.common.collect
javax.annotation
javax.inject
org.glassfish.hk2.osgiresourcelocator
org.glassfish.hk2.utilities
org.glassfish.hk2.utilities.cache
org.glassfish.jersey.process
org.jvnet.hk2.external.generator

Jersey versions should be 2.5 instaed of 2.5.0 in osgi-jaxrs-connector:3.2.0.pom

The Version should be 2.5 (http://search.maven.org/#artifactdetails%7Corg.glassfish.jersey.core%7Cjersey-common%7C2.5%7Cjar)
Atm I have bad internet reception otherwise I would have contributed a pull request for that, sry ;)

pom:

  <dependencies>
        <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-common</artifactId>
        <version>2.5.0</version>
        </dependency>
        <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-client</artifactId>
        <version>2.5.0</version>
        </dependency>
        <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-common</artifactId>
        <version>2.5.0</version>
        </dependency>
  </dependencies>

Allow annotated interfaces

Currently only the registration of annotated classes works with the connector. but it's perfectly valid to register a class which has an annotated interface. Currently the connector does not accept this as registerable type.

Exception when running connector in karaf and shuting down

When the connector is active in a karaf instance und you type "shutdown -f" into the console the following exception occurs:

java.lang.IllegalStateException: Invalid BundleContext.
    at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
    at org.apache.felix.framework.BundleContextImpl.getBundles(BundleContextImpl.java:197)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl.findEntry1(ResourceFinderImpl.java:67)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinder.findEntry(ResourceFinder.java:71)
    at org.glassfish.jersey.internal.l10n.Localizer.localize(Localizer.java:116)
    at org.glassfish.jersey.server.internal.LocalizationMessages.INIT_MSG(LocalizationMessages.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:295)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:146)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:265)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:210)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:207)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:226)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:207)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:262)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:266)
    at org.glassfish.jersey.servlet.ServletContainer.reload(ServletContainer.java:568)
    at com.eclipsesource.jaxrs.connector.internal.JerseyContext.removeResource(JerseyContext.java:104)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResourcesFromContext(JAXRSConnector.java:176)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.doRemoveResource(JAXRSConnector.java:169)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResource(JAXRSConnector.java:161)
    at com.eclipsesource.jaxrs.connector.internal.ResourceTracker.removedService(ResourceTracker.java:58)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:902)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.deactivateInternal(AbstractComponentManager.java:338)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceRemoved(DependencyManager.java:346)
    at org.apache.felix.scr.impl.manager.DependencyManager.serviceChanged(DependencyManager.java:253)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.disposeInternal(AbstractComponentManager.java:357)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:196)
    at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.disposeComponents(ConfiguredComponentHolder.java:299)
    at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:319)
    at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:340)
    at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:207)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)
    at org.apache.felix.framework.Felix.stopBundle(Felix.java:2351)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
    at java.lang.Thread.run(Thread.java:722)
ERROR: Bundle com.eclipsesource.jaxrs.connector [63] EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
java.lang.IllegalStateException: Invalid BundleContext.
    at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
    at org.apache.felix.framework.BundleContextImpl.getBundles(BundleContextImpl.java:197)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl.findEntry1(ResourceFinderImpl.java:67)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinder.findEntry(ResourceFinder.java:71)
    at org.glassfish.jersey.internal.l10n.Localizer.localize(Localizer.java:116)
    at org.glassfish.jersey.server.internal.LocalizationMessages.INIT_MSG(LocalizationMessages.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:295)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:146)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:265)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:210)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:207)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:226)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:207)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:262)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:266)
    at org.glassfish.jersey.servlet.ServletContainer.reload(ServletContainer.java:568)
    at com.eclipsesource.jaxrs.connector.internal.JerseyContext.removeResource(JerseyContext.java:104)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResourcesFromContext(JAXRSConnector.java:176)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.doRemoveResource(JAXRSConnector.java:169)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResource(JAXRSConnector.java:161)
    at com.eclipsesource.jaxrs.connector.internal.ResourceTracker.removedService(ResourceTracker.java:58)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:902)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.disposeInternal(AbstractComponentManager.java:357)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:196)
    at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.disposeComponents(ConfiguredComponentHolder.java:299)
    at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:319)
    at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:340)
    at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:207)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)
    at org.apache.felix.framework.Felix.stopBundle(Felix.java:2351)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
    at java.lang.Thread.run(Thread.java:722)
ERROR: Bundle com.eclipsesource.jaxrs.connector [63] EventDispatcher: Error during dispatch. (java.lang.IllegalStateException: Invalid BundleContext.)
java.lang.IllegalStateException: Invalid BundleContext.
    at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:514)
    at org.apache.felix.framework.BundleContextImpl.getBundles(BundleContextImpl.java:197)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinderImpl.findEntry1(ResourceFinderImpl.java:67)
    at org.glassfish.hk2.osgiresourcelocator.ResourceFinder.findEntry(ResourceFinder.java:71)
    at org.glassfish.jersey.internal.l10n.Localizer.localize(Localizer.java:116)
    at org.glassfish.jersey.server.internal.LocalizationMessages.INIT_MSG(LocalizationMessages.java:315)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:295)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:146)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:265)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:210)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:207)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:226)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:207)
    at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:262)
    at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:266)
    at org.glassfish.jersey.servlet.ServletContainer.reload(ServletContainer.java:568)
    at com.eclipsesource.jaxrs.connector.internal.JerseyContext.removeResource(JerseyContext.java:104)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResourcesFromContext(JAXRSConnector.java:176)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.doRemoveResource(JAXRSConnector.java:169)
    at com.eclipsesource.jaxrs.connector.internal.JAXRSConnector.removeResource(JAXRSConnector.java:161)
    at com.eclipsesource.jaxrs.connector.internal.ResourceTracker.removedService(ResourceTracker.java:58)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:956)
    at org.osgi.util.tracker.ServiceTracker$Tracked.customizerRemoved(ServiceTracker.java:1)
    at org.osgi.util.tracker.AbstractTracked.untrack(AbstractTracked.java:341)
    at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:902)
    at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:932)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:793)
    at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:543)
    at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:4260)
    at org.apache.felix.framework.Felix.access$000(Felix.java:74)
    at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:390)
    at org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:148)
    at org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:127)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.unregisterComponentService(AbstractComponentManager.java:470)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager$Satisfied.deactivate(AbstractComponentManager.java:1074)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.disposeInternal(AbstractComponentManager.java:357)
    at org.apache.felix.scr.impl.manager.AbstractComponentManager.dispose(AbstractComponentManager.java:196)
    at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.disposeComponents(ConfiguredComponentHolder.java:299)
    at org.apache.felix.scr.impl.BundleComponentActivator.dispose(BundleComponentActivator.java:319)
    at org.apache.felix.scr.impl.Activator.disposeComponents(Activator.java:340)
    at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:207)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:868)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:789)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:514)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4244)
    at org.apache.felix.framework.Felix.stopBundle(Felix.java:2351)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1214)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)
    at java.lang.Thread.run(Thread.java:722)

Add error handling to consumer

Currently the consumer implementation doe snot respect http error codes. It tries to deserialize the body of 5xx and 4xx messages. I think a check should be added that the content should only be parsed when it's 2xx otherwise an exception should be throwed with the message from the body.

Automate deployment process

Currently I do the releases manually. This means the following

  • Build the project
  • Add the p2 repository to the composite repository
  • Update the bndindex (see #11)
  • Upload jars to maven central

The tycho build added with commit 4b2a03d is a great help but there are to many manual steps involved right now. I think we can do better ;)

ServiceFilter of ResourceTracker should be configurable

The ResourceTracker currently tracks all services using objectClass=*. In order to use thte jax-rs-connector only for certain services, this filter must be changable, e.g. to objectClass=com.mycompany.*.

So there must be a possibility to configure this filter from outside, e.g. via service property.

Build fails under windows

... with a strange url auth exception...

Maybe it helps to deploy the jersey p2 repo and acess it via htpp.

Tycho does not support osgi-jax-rs-connector p2 repository on github.io

A build with tycho gives error when referring to the p2 repository:

[WARNING] Failed to access p2 repository http://hstaudacher.github.io/osgi-jax-rs-connector, use local cache. Neither http://hstaudacher.github.io/osgi-jax-rs-connector/content.jar nor http://hstaudacher.github.io/osgi-jax-rs-connector/content.xml found.

Maybe issue is with repository format (composite repo ?) not supported by Tycho.
While the repo is supported by Eclipse update mgr.

Bundles don't start

Hello,

in the bundles com.eclipsesource.jaxrs.consumer, com.eclipsesource.jaxrs.provider.gson and com.eclipsesource.jaxrs.publisher the Manifest-Header 'Bundle-ActivationPolicy' is set to 'lazy'.
As a consumer of these bundles I neither use a class nor a service of these bundles. And because of that they will never get started.

If I remove the lazy flag everything is all right :) Alternatively I could write a bundle to start them...but I think this is less beautiful.
Is there a reason why the 'lazy' flag is needed?

(I'm using them in Felix with the help of bndtools)

Jersey Servlet Container registration is lost when reconfiguring Felix HTTP Service

i use the osgi-jax-rs-connector/publisher in a felix-based OSGi environment, with felix HTTP service.
all works well, my services with @path annotations work as expected.

but when i reconfigure the felix http service the jersey servlet container registration at /services vanishes from the http service registrations (i can see this in the web console at http://localhost:8080/system/console/status-httpservice). when i restart the bundle "com.eclipsesource.jaxrs.publisher" all is well again.

is this a known problem? i started a bit debugging with the publisher sources, it seems that the HttpTracker.addingService method is called on each configuration update, but HttpTracker.removedService is not called. if HttpTracker.addingService is callled the second time after starting the "com.eclipsesource.jaxrs.publisher" bundle the registration is no longer present.

How to configure logging for jersey requests

This might be not related to this project, but I'm trying to debug why a POST-Request (GET works like charm) produces an internal server error.

All I see on my Equinix OSGi console is:

Dez 17, 2013 2:29:17 PM org.glassfish.jersey.server.ApplicationHandler initialize
Information: Initiating Jersey application, version Jersey: 2.3.1 2013-09-27 07:50:09...
Dez 17, 2013 2:29:17 PM org.glassfish.jersey.server.ApplicationHandler initialize
Information: Initiating Jersey application, version Jersey: 2.3.1 2013-09-27 07:50:09...

But I'd like to get some Information about request routing, deserialization errors, etc.

I tried including the org.apache.log4j bundle that comes with Eclise 4.3.1, but won't get any more detailed messages.

Are there any properties I need to set?

My client code looks like this:

    public <T extends Traceroute>  boolean upload(TracerouteResult<T> trace ){
        Trace trc = Trace.fromTracerouteResult(trace);
        WebTarget wtrg = _c.target(URL);
        Response res= wtrg
        .request(MediaType.APPLICATION_XML)
        .cookie(new Cookie("user", USER))
        .cookie(new Cookie("auth", AUTH))
        .post(Entity.entity(trc, MediaType.APPLICATION_XML));
        System.err.println(res.toString());     
        return true;
    }

Trace is an XmlRootElement:

@XmlRootElement
public class Trace {
    private Map<Integer,List<String>> addressesPerHop;
    private String source;
    private String traget;
        /* ... */
}

My server-side method like this;

    @POST
    @Path("paths")
    @RolesAllowed("pobe")
    @Consumes(MediaType.APPLICATION_XML)
    public void addTrace( Trace trace, @Context HttpServletResponse res) {
            System.err.println("Got trace from: " + trace.getSource());
                        ...
        }

Performances issues when adding or removing multiple resources

Hi
I'm currently using JAXRSConnector on an embedded target, such as a Raspberry Pi. This works fine and I'm able to host and use my Rest API through JAXRS.
One problem I'm facing is that as my project is growing, I register more and more Rest Resources. At the beginning the startup time of the publisher bundle was fast, now with around 20 resources, the publisher bundle takes around 40 seconds to start on my embedded target (with CPU to 100%).
After debugging, I saw that this was due to the fact that the ServletContainer.Reload method is called each time a new service is added (or removed) via the ResourceTracker. This Reload method seems quiet CPU intensive, and during start/stop phases, it will be called for each resources although it would only require one call after init.
The same problem exists when stopping the publisher bundle (for the same reason).

Make wrapped Gson instance within GsonProvider configurable

It would be interesting being able to configure the wrapped Gson object within GsonProvider. It is quite possible that default Gson config isn't enough in most cases: in my case, I was looking to register an InstanceCreator.

Clients may fetch the GsonProvider OSGi Service and set the Gson instance through a setter method. Or it could wrap a GsonBuilder, too.

examples don't have all required bundles

If I Import existing project and choose the examples.ds project I get this:
http://screencast.com/t/4eVIyUWXqliP

If I go to Run Configurations and hit "Required Bundles" button, it seems to fix this and it seems to launch successfully (I have a project which has necessary JAX-RS jars)... but if I got to browser and put in localhost:9091/services/product/1 it comes up 404.

I think the MANIFEST.MF needs to include the missing dependencies, but I'm not sure javax.ws.rs is going to be found in a vanilla eclipse (If I remove my project with JAX-RS missing dependencies cannot be resolved), you may have to include it?

I'm a bit new to OSGI so bare with me if I'm overlooking something simple.

Support for SSe

Even if Jersey let us use SSe (as shown here: https://jersey.java.net/documentation/latest/sse.html ) it is not possible to use it with osgi-jax-rs-connector.

The error shown in the console is the following:

MessageBodyWriter not found for media type=text/event-stream, type=class org.glassfish.jersey.media.sse.OutboundEvent, genericType=class org.glassfish.jersey.media.sse.OutboundEvent

And it seems to depend on a not satisfied dependency: on the official Jersey page we can find the following specification

Firstly you need to add a Jersey SSE module dependency to your project as shown in the earlier section and register the SseFeature from this module in your Application or ResourceConfig.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.