我正在尝试使用像这样的grizzly 2.3网络服务器将MyHttpHandler映射到自定义网址(应该是RESTfull网址,如/entity/42/attribute
):
HttpServer httpServer = HttpServer.createSimpleServer();
ServerConfiguration config = httpServer.getServerConfiguration();
config.addHttpHandler(new MyHttpHandler(), "/entity/*/attribute");
它不起作用。我怎么能在灰熊中做到这一点?
答案 0 :(得分:1)
对于grizzly-http-server的2.3.17版,我看到addHttpHandler(HttpHandler httpHandler,String ... mappings)从映射字符串创建HttpHandlerRegistration实例:
ServerConfiguration#addHttpHandler (on grepcode.com)
fromString方法的Javadoc提到" *"支持通配符: