Skip to content

Commit

Permalink
fix(rest): revert api HeaderFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
oxsean committed May 22, 2024
1 parent 1a9d770 commit edf9363
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
@SPI(scope = ExtensionScope.FRAMEWORK)
public interface HeaderFilter {

void invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException;
RpcInvocation invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Activate
public class TokenHeaderFilter implements HeaderFilter {
@Override
public void invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException {
public RpcInvocation invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException {
String token = invoker.getUrl().getParameter(TOKEN_KEY);
if (ConfigUtils.isNotEmpty(token)) {
Class<?> serviceType = invoker.getInterface();
Expand All @@ -46,5 +46,6 @@ public void invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcExcep
+ ", consumer incorrect token is " + remoteToken);
}
}
return invocation;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@
public abstract class RestHeaderFilterAdapter implements HeaderFilter {

@Override
public void invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException {
public RpcInvocation invoke(Invoker<?> invoker, RpcInvocation invocation) throws RpcException {
if (TripleConstant.TRIPLE_HANDLER_TYPE_REST.equals(invocation.get(TripleConstant.HANDLER_TYPE_KEY))) {
HttpRequest request = (HttpRequest) invocation.get(TripleConstant.HTTP_REQUEST_KEY);
HttpResponse response = (HttpResponse) invocation.get(TripleConstant.HTTP_RESPONSE_KEY);
invoke(invoker, invocation, request, response);
}
return invocation;
}

protected abstract void invoke(
Expand Down

0 comments on commit edf9363

Please sign in to comment.