Skip to content

Remove requirement to specify path with per-HTTP-method methods. #64

@garretwilson

Description

@garretwilson

I see that Condition has convenience methods for specific HTTP methods, such as Condition.get(String uri). That's fine if I want to specify an exact path. But what if I want to use that in conjunction with Condition.matchesUri(Pattern p)? Why isn't there a Condition.get() method I can use like this?

whenHttp(server).matches(get(), matchesUri(Pattern.compile("a?b+c*")))…

Why can't I just use get() by itself, to combine it with any matcher I want?

You might say I could just use Condition.method(Method m), but as explained in #22 that forces me to use the Glassfish API --- and there's no need for that. If there is a Condition.get() method at all, why is it tied to a URI, when I could simply say matches(get(), uri("foo")) to do the same thing as matches(get("foo"))?

Yes, I understand that get(String uri) is a convenience method, but convenience methods should allow the long, more flexible form as well. Put another way, it is more flexible to allow matches(get(), uri("foo")), and provide matches(get("foo")) as an additional convenience. Only providing the latter without the former makes the API less flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions