mirror of https://github.com/grpc/grpc-java.git
Add an authority header to HandlerRegistry.lookupMethod
This commit is contained in:
parent
2aecb6f02b
commit
28d51c5e3e
|
|
@ -45,9 +45,23 @@ public abstract class HandlerRegistry {
|
|||
* Lookup a {@link ServerMethodDefinition} by its fully-qualified name.
|
||||
*
|
||||
* @param methodName to lookup {@link ServerMethodDefinition} for.
|
||||
* @param authority the authority for the desired method (to do virtual hosting). If {@code null}
|
||||
* the first matching method will be returned.
|
||||
* @return the resolved method or {@code null} if no method for that name exists.
|
||||
*/
|
||||
@Nullable
|
||||
public abstract ServerMethodDefinition<?, ?> lookupMethod(String methodName);
|
||||
public abstract ServerMethodDefinition<?, ?> lookupMethod(
|
||||
String methodName, @Nullable String authority);
|
||||
|
||||
/**
|
||||
* Lookup a {@link ServerMethodDefinition} by its fully-qualified name.
|
||||
*
|
||||
* @param methodName to lookup {@link ServerMethodDefinition} for.
|
||||
* @return the resolved method or {@code null} if no method for that name exists.
|
||||
*/
|
||||
@Nullable
|
||||
public final ServerMethodDefinition<?, ?> lookupMethod(String methodName) {
|
||||
return lookupMethod(methodName, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,9 +60,12 @@ public final class MutableHandlerRegistryImpl extends MutableHandlerRegistry {
|
|||
return services.remove(service.getName(), service);
|
||||
}
|
||||
|
||||
/**
|
||||
* Note: This does not actually honor the authority provided. It will, eventually in the future.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public ServerMethodDefinition<?, ?> lookupMethod(String methodName) {
|
||||
public ServerMethodDefinition<?, ?> lookupMethod(String methodName, @Nullable String authority) {
|
||||
String serviceName = MethodDescriptor.extractFullServiceName(methodName);
|
||||
if (serviceName == null) {
|
||||
return null;
|
||||
|
|
|
|||
Loading…
Reference in New Issue