2016-07-19 37 views
0

从web.xml中的OSGi的Http白板模式创建束-context.xml的 移动如何通过从下面的web.xml性质jspServletfilter的OSGi:服务性的OSGi的Http白板模式

<jsp-config> 
     <jsp-property-group> 
     <url-pattern>*.jsp</url-pattern> 
     <el-ignored>true</el-ignored> 
     </jsp-property-group> 
</jsp-config> 

下面我试着解决方案,但它不起作用。

<bean id="jspServlet" class="com.test.servlet.web.servlet.TestJSPServlet"/> 

<osgi:service ref="jspServlet" interface="javax.servlet.Servlet" > 
    <osgi:service-properties> 
     <entry key="osgi.http.whiteboard.filter.name" value="JSPServlet" /> 
     <entry key="osgi.http.whiteboard.servlet.pattern" value-ref="jspPatternsList"/> 
     <entry key="osgi.http.whiteboard.context.select" value="(osgi.http.whiteboard.context.name=cb)" /> 
     <entry key="servlet.init.el-ignored" value="true" />  
    </osgi:service-properties> 
</osgi:service> 
+0

您使用哪种OSGi Http白板实现? felix一个? –

+0

是的,apache felix – sandy

回答

0

我只是再检查一次,但如果我没有完全错误,OSGi规范不会以某种方式处理JSP。因此,您在那里尝试执行的操作不适用于Apache Felix实施。

JSP使用Http白板方法的唯一方法是切换到Pax - Web项目。因为它不仅支持白板方法(规范合规仍在进行中,6.0.0-SNAPSHOT),而且现在还有更多规范。

达到你想要什么,以下是需要与大同的Web:

<!-- JSP handling --> 
<service id="jspMapping" interface="org.ops4j.pax.web.extender.whiteboard.JspMapping"> 
    <bean class="org.ops4j.pax.web.extender.whiteboard.runtime.DefaultJspMapping"> 
     <property name="urlPatterns"> 
      <array> 
       <value>/jsp</value> 
      </array> 
     </property> 
    </bean> 
</service> 

一个例子也可以在PAX-web项目的samples找到。

+0

谢谢@Achim Nierbeck,如果有问题,请尝试pax-web – sandy

+0

,最好在ops4j邮件列表中提问:https://groups.google.com/forum/#!forum/ops4j –