@Override public Optional<Object> attribute(String name) { return this.delegate.attribute(name); }
@Override public Throwable getError(ServerRequest request) { return (Throwable) request.attribute(ERROR_ATTRIBUTE) .orElseThrow(() -> new IllegalStateException( "Missing exception attribute in ServerWebExchange")); }
@Test public void attribute() { String name = "foo"; String value = "bar"; when(mockRequest.attribute(name)).thenReturn(Optional.of(value)); assertEquals(Optional.of(value), wrapper.attribute(name)); }
Mono<ServerResponse> retrieveExceptionInfo(ServerRequest serverRequest) { String exceptionName = serverRequest.attribute(HYSTRIX_EXECUTION_EXCEPTION_ATTR) .map(exception -> exception.getClass().getName()) .orElse(""); return ServerResponse.ok().header(RETRIEVED_EXCEPTION, exceptionName) .build(); } }
@Override public <T> Optional<T> attribute(String name) { return this.request.attribute(name); }
@Override public <T> Optional<T> attribute(String name) { return this.request.attribute(name); }