Wildcards in grizzly HttpHandler's mappings

末鹿安然 提交于 2019-12-25 07:04:52

问题


I'm trying to map MyHttpHandler to custom url using grizzly 2.3 web server like this (that should be RESTfull url, like /entity/42/attribute):

HttpServer httpServer = HttpServer.createSimpleServer();
ServerConfiguration config = httpServer.getServerConfiguration();
config.addHttpHandler(new MyHttpHandler(), "/entity/*/attribute");

It does not work. How can I do it in grizzly?


回答1:


For version 2.3.17 of grizzly-http-server, I see that addHttpHandler(HttpHandler httpHandler, String... mappings) creates HttpHandlerRegistration instances from the mapping Strings:

ServerConfiguration#addHttpHandler (on grepcode.com)

The Javadoc of the fromString method mentions that "*" wildcards are supported:

HttpHandlerRegistration#fromString (on grepcode.com)



来源:https://stackoverflow.com/questions/25309244/wildcards-in-grizzly-httphandlers-mappings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!