java - Jersey resource that matches any path -
i using jersey v1.x , guice servlet. i'm trying bind jersey resource matches any @path, such can use jersey respond 404.
i'm looking this, since servlet consists of different components (e.g. rest api lives under /api, , web ui lives under /. in guice terms, means have several servletmodules each set 1 part of servlet:
- in
apiservletmodule:serve("/api").with(guicecontainer.class, conf) - in
webuiservletmodule:serve("/").with(guicecontainer.class, conf)
in setup, want define 404 response body looks each part of webapp (/api or /) codebase of each subproject responsible, without having reimplement jersey
so far have tried bind resource match @path("/"), @path("*") , @path("/*"), none of these seem picked when request /some/path/that/doesnt/exist
you need use regex format of path expression, i.e.
@path("{any: .*}") you inject list<pathsegment> @ segments if need them.
public response getsomething(@pathparam("any") list<pathsegment> segments)
Comments
Post a Comment