I want to make the request parameter optional in the path of the rest Call method. Suppose the service descriptor is
public interface UserService extends Service {
ServiceCall<NotUsed, PSequence<User>> getUsers(String filter);
@Override
default Descriptor descriptor() {
return Service.named("user-service").withCalls(
Service.restCall(Method.GET, "/api/users",
this::getUsers)
).withAutoAcl(true);
}
}
I want to use the the same handler for two different urls, one with request param and one without request param.
For example:
/api/users
(for this, the string filter in the handler should be null or empty)/api/users?filter=abc
(for this, the value of filter should be abc).
Is this possible?