我想過濾的OSGi Apache的菲利克斯裏面的碼頭HTTP服務器的網絡資源。菲利克斯的OSGi的Servlet /資源篩選不會過濾
我已經註冊了一個過濾器作爲一個框架組件的OSGi:
@Component(property = { "osgi.http.whiteboard.filter.name=MyFilter",
"osgi.http.whiteboard.filter.regex=.*" },
scope = ServiceScope.PROTOTYPE)
public class MyFilter implements Filter {
...
@Override
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain) {
...
// some logging
}
...
}
當我啓動Felix框架,並通過瀏覽器訪問的資源和servlet,該Filter#doFilter(...)
方法不會被調用。
的資源和servlet一直在使用org.osgi.service.http.HttpService#registerServlet(...)
和org.osgi.service.http.HttpService#registerResources(...)
註冊。
我敢肯定,過濾器被初始化,因爲Filter#init(...)
被調用:
這裏該組件的費利克斯SCR信息:
Component Description:
Name: org.myCompany.MyFilter
Implementation Class: org.myCompany.MyFilter
Default State: enabled
Activation: delayed
Configuration Policy: optional
Activate Method: activate
Deactivate Method: deactivate
Modified Method: -
Configuration Pid: [org.myCompany.MyFilter]
Services:
javax.servlet.Filter
Service Scope: prototype
Component Description Properties:
osgi.http.whiteboard.filter.name = MyFilter
osgi.http.whiteboard.filter.regex = .*
Component Configuration:
ComponentId: 7
State: active
Component Configuration Properties:
component.id = 7
component.name = org.myCompany.MyFilter
osgi.http.whiteboard.filter.name = MyFilter
osgi.http.whiteboard.filter.regex = .*
- 內是否菲利克斯資源/ servlet的過濾工作,碼頭和OSGi?
- 我註冊了過濾器嗎?
在此期間,感謝您的關注和參與。
OSGi提供基於正則表達式過濾??這在Servlet規範中不受支持。 btw:(正則表達式)'。*'==(servlet)'/ *' –