Skip to content

Commit

Permalink
GERONIMO-6602 ensure to use the right spi for SseEventSource.Builder …
Browse files Browse the repository at this point in the history
…and defaulting to cxf impl instead of the api which can't be used

git-svn-id: https://svn.apache.org/repos/asf/geronimo/specs/trunk@1827276 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
rmannibucau committed Mar 20, 2018
1 parent 4ca1c22 commit 63b4a80
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface SseEventSource extends AutoCloseable {

abstract class Builder {

public static final String JAXRS_DEFAULT_SSE_BUILDER_PROPERTY = "javax.ws.rs.sse.SseEventSource.Builder";
public static final String JAXRS_DEFAULT_SSE_BUILDER_PROPERTY = "org.apache.cxf.jaxrs.sse.client.SseEventSourceBuilderImpl";

protected Builder() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class SseFinder {

private static final Logger LOGGER = Logger.getLogger(SseFinder.class.getName());

private static final String FACTORY_ID = SseEventSource.Builder.class.getName().replace('$', '.');
private static final String FACTORY_ID = SseEventSource.Builder.class.getName();

private static final String SERVICE_ID = "META-INF/services/" + FACTORY_ID;

Expand All @@ -49,12 +49,20 @@ static Object find(final String defaultClazz) throws ClassNotFoundException {
return delegate;
}

InputStream is;
InputStream is = null;
if (classLoader == null) {
is = ClassLoader.getSystemResourceAsStream(SERVICE_ID);
} else {
is = classLoader.getResourceAsStream(SERVICE_ID);
}
if (is == null) {
final String dottedId = SERVICE_ID.replace('$', '.');
if (classLoader == null) {
is = ClassLoader.getSystemResourceAsStream(dottedId);
} else {
is = classLoader.getResourceAsStream(dottedId);
}
}

if (is != null) {
final BufferedReader rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
Expand Down

0 comments on commit 63b4a80

Please sign in to comment.