Как я могу настроить сервлет osgi http whiteboard для HTTPS?
Я создал интерфейс REST через шаблон сервлет http доски в OSGI
@Component(service = RestComponentImpl.class)
@JaxrsResource
@HttpWhiteboardResource(pattern = "/rest/*", prefix = "static")
public class RestComponentImpl {
@Path("test")
@PUT
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public TestObject getTest(TestObject testo) {
return testo;
}
}
Я настроил Jetty для HTTPS через OSGI конфигурации, переданные как JSON при запуске
{
"org.apache.felix.http": {
"org.apache.felix.http.enable": "true",
"org.apache.felix.https.enable": "true",
"org.osgi.service.http.port.secure": "8443",
"org.apache.felix.https.keystore": "src/main/resources/jetty_key/keystore",
"org.apache.felix.https.keystore.password": "mostsecurepasswordever",
}
}
мой Bndrun выглядит как
index: target/index.xml;name="rest-app"
-standalone: ${index}
-runrequires:
osgi.identity;filter:='(osgi.identity=resttest.rest-services)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.metatype)',\
osgi.identity;filter:='(osgi.identity=org.apache.johnzon.core)',\
-runfw: org.eclipse.osgi
-runee: JavaSE-1.8
-runbundles: \
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\
org.apache.aries.jax.rs.whiteboard;version='[1.0.0,1.0.1)',\
org.apache.felix.configadmin;version='[1.9.2,1.9.3)',\
org.apache.felix.http.jetty;version='[4.0.0,4.0.1)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.felix.scr;version='[2.1.0,2.1.1)',\
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
org.osgi.util.promise;version='[1.1.0,1.1.1)',\
slf4j.api;version='[1.7.25,1.7.26)',\
org.apache.servicemix.specs.json-api-1.1;version='[2.9.0,2.9.1)',\
org.osgi.util.converter;version='[1.0.0,1.0.1)',\
org.apache.felix.metatype;version='[1.2.0,1.2.1)',\
resttest.rest-app;version='[0.0.1,0.0.2)',\
org.apache.felix.configurator;version='[1.0.0,1.0.1)',\
org.apache.johnzon.core;version='[1.1.0,1.1.1)'
Без конфигурации https, представленной выше, сервлет работает без сбоев через http://localhost:8080/test. С этой конфигурацией у меня все еще есть доступ к статическому контенту, такому как index.html, который находится в статическом, через https://localhost:8443/rest/index.html С конфигурацией https служба даже не запускается:
Component #0 resttest.rest.RestComponentImpl, state satisfied
И я не могу подключиться к https://localhost:8443/test, получая:
HTTP ERROR 404
Problem accessing /test. Reason:
Not Found
Веб-консоль Apache Felix работает безупречно в обеих конфигурациях через http://localhost:8080/system/console/ или https://localhost:8443/system/console/
У кого-нибудь есть идея или предложение? Или какие-то другие идеи, чтобы быстро построить REST-решение, развернутое в osgi-контексте с сериализацией json, без лишних проблем с более широкой структурой? Благодарю.