import org.osgi.service.http.HttpWhiteboardConstants;
@Component(service = Servlet.class, property = {
HttpWhiteboardConstants.HTTP_WHITEBOARD_SERVLET_PATTERN + "=/myendpoint"
})
public class MyEndpointServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
}
}
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0">
<implementation class="com.example.MyEndpointServlet" />
<service>
<provide interface="javax.servlet.Servlet" />
</service>
</scr:component>