I'm looking for a Java library that evaluates REST-style URLs. Something like:
public Result evaluate(String url, String pattern);
The pattern would be something like:
/users/{userId}/photos/{photoId}.html
The result must include:
Can anyone help, please?
By "evaluate", do you mean some kind of unification or pattern matching by which the url
string is matched against the pattern
string, mapping the placeholders in the pattern to the corresponding substrings in the URL?
If so, the Restlet library's Template
class may suffice. In particular, look at Template#parse(String, Map<String, Object>)
. That looks close to fitting your needs, though the documentation is a little vague as to what constitutes the input and output.
You might already know about this, but JBoss RestEasy http://jboss.org/resteasy project handles such cases and should have classes to deal with such cases. I believe its open source and therefore you can see if its helpful
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With