Java Code Examples for com.linecorp.armeria.server.HttpService#serve()

The following examples show how to use com.linecorp.armeria.server.HttpService#serve() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FirebaseAuthorizer.java    From curiostack with MIT License 6 votes vote down vote up
@Override
public HttpResponse authFailed(
    HttpService delegate, ServiceRequestContext ctx, HttpRequest req, @Nullable Throwable cause)
    throws Exception {
  if (cause != null) {
    logger.warn("Unexpected exception during authorization.", cause);
    return HttpResponse.of(HttpStatus.UNAUTHORIZED);
  }
  if (!config.getIncludedPaths().isEmpty()) {
    if (config.getIncludedPaths().contains(ctx.path())) {
      return HttpResponse.of(HttpStatus.UNAUTHORIZED);
    } else {
      return delegate.serve(ctx, req);
    }
  }
  if (config.getExcludedPaths().contains(ctx.path())) {
    return delegate.serve(ctx, req);
  }
  return HttpResponse.of(HttpStatus.UNAUTHORIZED);
}
 
Example 2
Source File: AnnotatedServiceFactoryTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
public HttpResponse serve(HttpService delegate, ServiceRequestContext ctx,
                          HttpRequest req) throws Exception {
    return delegate.serve(ctx, req);
}
 
Example 3
Source File: AnnotatedServiceFactoryTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
public HttpResponse serve(HttpService delegate, ServiceRequestContext ctx,
                          HttpRequest req) throws Exception {
    return delegate.serve(ctx, req);
}
 
Example 4
Source File: AnnotatedServiceDecorationTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
public HttpResponse serve(
        HttpService delegate, ServiceRequestContext ctx, HttpRequest req) throws Exception {
    AnnotatedServiceTest.validateContextAndRequest(ctx, req);
    return delegate.serve(ctx, req);
}
 
Example 5
Source File: AnnotatedServiceAnnotationAliasTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
public HttpResponse serve(
        HttpService delegate, ServiceRequestContext ctx, HttpRequest req) throws Exception {
    appendAttribute(ctx, " (decorated-1)");
    return delegate.serve(ctx, req);
}
 
Example 6
Source File: AnnotatedServiceAnnotationAliasTest.java    From armeria with Apache License 2.0 4 votes vote down vote up
@Override
public HttpResponse serve(
        HttpService delegate, ServiceRequestContext ctx, HttpRequest req) throws Exception {
    appendAttribute(ctx, " (decorated-2)");
    return delegate.serve(ctx, req);
}