0
我已經部署在Apache Karaf
2個OSGi
束。 A
和B
。我的A
OSGi
捆綁包作爲基本身份驗證處理程序。我已經建立了我的安全處理程序,它工作正常:共享對象的OSGi bundle之間
<bean id="securityHandler" class="org.eclipse.jetty.security.ConstraintSecurityHandler">
<property name="authenticator">
<bean class="org.eclipse.jetty.security.authentication.BasicAuthenticator"/>
</property>
<property name="constraintMappings">
<list>
<ref bean="constraintMapping"/>
</list>
</property>
<property name="loginService" ref="loginService"/>
<property name="strict" value="false"/>
<property name="identityService" ref="identityService"/>
</bean>
此處理程序捆綁A
。我需要做的是將此處理程序作爲OSGi
服務供其他軟件包使用,在這種情況下,請使用軟件包B
。我不能實現任何接口到ConstraintSecurityHandler
類,因爲它是從org.eclipse.jetty.security
包。
我試圖創建自己的處理程序類,然後擴展ConstraintSecurityHandler
和執行我的接口。所以OSGi
服務是這樣的:
<osgi:service ref="securityHandler" interface="my.company.MyInterface" />
這是不行的,我得到異常:
org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route1: Route[[From[jetty:http://0.0.0.0:8019/TARGETjobs/Indeed?hand... because of Failed to resolve endpoint: jetty://http://0.0.0.0:8019/TARGETjobs/Indeed?handlers=securityHandler&matchOnUriPrefix=true due to: null
所以,問題是我怎麼能做出這種securityHandler
bean作爲一個OSGi
的服務提供給其他OSGi
捆綁?