com.groupbyinc.flux.rest.RestController.class Maven / Gradle / Ivy
???? 4# 'com/groupbyinc/flux/rest/RestController 6com/groupbyinc/flux/common/component/AbstractComponent 7com/groupbyinc/flux/http/HttpServerTransport$Dispatcher RestController.java Ccom/groupbyinc/flux/rest/RestController$ResourceHandlingHttpChannel ResourceHandlingHttpChannel +com/groupbyinc/flux/rest/RestRequest$Method $com/groupbyinc/flux/rest/RestRequest
Method ,com/groupbyinc/flux/http/HttpServerTransport
Dispatcher 0com/groupbyinc/flux/common/path/PathTrie$Decoder (com/groupbyinc/flux/common/path/PathTrie Decoder %java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup handlers *Lcom/groupbyinc/flux/common/path/PathTrie; ULcom/groupbyinc/flux/common/path/PathTrie; handlerWrapper "Ljava/util/function/UnaryOperator; JLjava/util/function/UnaryOperator; client ,Lcom/groupbyinc/flux/client/node/NodeClient; circuitBreakerService ;Lcom/groupbyinc/flux/indices/breaker/CircuitBreakerService;
headersToCopy Ljava/util/Set; #Ljava/util/Set; usageService (Lcom/groupbyinc/flux/usage/UsageService; $assertionsDisabled Z ?(Lcom/groupbyinc/flux/common/settings/Settings;Ljava/util/Set;Ljava/util/function/UnaryOperator;Lcom/groupbyinc/flux/client/node/NodeClient;Lcom/groupbyinc/flux/indices/breaker/CircuitBreakerService;Lcom/groupbyinc/flux/usage/UsageService;)V 1(Lcom/groupbyinc/flux/common/settings/Settings;)V . 0
1 "com/groupbyinc/flux/rest/RestUtils 3 REST_DECODER 2Lcom/groupbyinc/flux/common/path/PathTrie$Decoder; 5 6 4 7 5(Lcom/groupbyinc/flux/common/path/PathTrie$Decoder;)V . 9
: < ' ( > * + @ "java/lang/invoke/LambdaMetafactory B metafactory ?(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; D E
C F G &(Ljava/lang/Object;)Ljava/lang/Object; I lambda$new$0 N(Lcom/groupbyinc/flux/rest/RestHandler;)Lcom/groupbyinc/flux/rest/RestHandler; K L
M N L apply $()Ljava/util/function/UnaryOperator; Q R S ,com/groupbyinc/flux/common/settings/Settings U
java/util/Set W java/util/function/UnaryOperator Y *com/groupbyinc/flux/client/node/NodeClient [ 9com/groupbyinc/flux/indices/breaker/CircuitBreakerService ] &com/groupbyinc/flux/usage/UsageService _ ! a # $ c % & e this )Lcom/groupbyinc/flux/rest/RestController; settings .Lcom/groupbyinc/flux/common/settings/Settings; registerAsDeprecatedHandler ?(Lcom/groupbyinc/flux/rest/RestRequest$Method;Ljava/lang/String;Lcom/groupbyinc/flux/rest/RestHandler;Ljava/lang/String;Lcom/groupbyinc/flux/common/logging/DeprecationLogger;)V , - m /com/groupbyinc/flux/rest/DeprecationRestHandler o java/lang/AssertionError q ()V . s
r t q(Lcom/groupbyinc/flux/rest/RestHandler;Ljava/lang/String;Lcom/groupbyinc/flux/common/logging/DeprecationLogger;)V . v
p w registerHandler h(Lcom/groupbyinc/flux/rest/RestRequest$Method;Ljava/lang/String;Lcom/groupbyinc/flux/rest/RestHandler;)V y z
{ method -Lcom/groupbyinc/flux/rest/RestRequest$Method; path Ljava/lang/String; handler &Lcom/groupbyinc/flux/rest/RestHandler; deprecationMessage logger 6Lcom/groupbyinc/flux/common/logging/DeprecationLogger; registerWithDeprecatedHandler ?(Lcom/groupbyinc/flux/rest/RestRequest$Method;Ljava/lang/String;Lcom/groupbyinc/flux/rest/RestHandler;Lcom/groupbyinc/flux/rest/RestRequest$Method;Ljava/lang/String;Lcom/groupbyinc/flux/common/logging/DeprecationLogger;)V java/lang/StringBuilder ?
? t [ ? append -(Ljava/lang/String;)Ljava/lang/StringBuilder; ? ?
? ? name ()Ljava/lang/String; ? ?
? ? ] is deprecated! Use [ ?
] instead. ? toString ? ?
? ? k l
? deprecatedMethod deprecatedPath (com/groupbyinc/flux/rest/BaseRestHandler ? addRestHandler -(Lcom/groupbyinc/flux/rest/BaseRestHandler;)V ? ?
` ? 'com/groupbyinc/flux/rest/MethodHandlers ? i(Ljava/lang/String;Lcom/groupbyinc/flux/rest/RestHandler;[Lcom/groupbyinc/flux/rest/RestRequest$Method;)V . ?
? ? 8(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; ? lambda$registerHandler$1 ?(Lcom/groupbyinc/flux/rest/RestHandler;Lcom/groupbyinc/flux/rest/RestRequest$Method;Lcom/groupbyinc/flux/rest/MethodHandlers;Lcom/groupbyinc/flux/rest/MethodHandlers;)Lcom/groupbyinc/flux/rest/MethodHandlers; ? ?
? ? }(Lcom/groupbyinc/flux/rest/MethodHandlers;Lcom/groupbyinc/flux/rest/MethodHandlers;)Lcom/groupbyinc/flux/rest/MethodHandlers; ? t(Lcom/groupbyinc/flux/rest/RestHandler;Lcom/groupbyinc/flux/rest/RestRequest$Method;)Ljava/util/function/BiFunction; Q ? ? insertOrUpdate F(Ljava/lang/String;Ljava/lang/Object;Ljava/util/function/BiFunction;)V ? ?
? canTripCircuitBreaker (Ljava/util/Optional;)Z lambda$canTripCircuitBreaker$2 ;(Lcom/groupbyinc/flux/rest/RestHandler;)Ljava/lang/Boolean; ? ?
? ? ? ()Ljava/util/function/Function; Q ? ? java/util/Optional ? map 3(Ljava/util/function/Function;)Ljava/util/Optional; ? ?
? ? java/lang/Boolean ? valueOf (Z)Ljava/lang/Boolean; ? ?
? ? orElse ? I
? ? booleanValue ()Z ? ?
? ? ; Ljava/util/Optional; dispatchRequest ?(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/common/util/concurrent/ThreadContext;)V java/lang/Exception ? rawPath ? ?
? /favicon.ico ? java/lang/String ? equals (Ljava/lang/Object;)Z ? ?
? ?
handleFavicon O(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;)V ? ?
? tryAllHandlers ? ?
? *com/groupbyinc/flux/rest/BytesRestResponse ? >(Lcom/groupbyinc/flux/rest/RestChannel;Ljava/lang/Exception;)V . ?
? ? $com/groupbyinc/flux/rest/RestChannel ? sendResponse *(Lcom/groupbyinc/flux/rest/RestResponse;)V ? ? ? ? 8com/groupbyinc/flux/common/util/concurrent/ThreadContext ?
addSuppressed (Ljava/lang/Throwable;)V
? !Lorg/apache/logging/log4j/Logger; ? ,()Lorg/apache/logging/log4j/message/Message; lambda$dispatchRequest$3 R(Lcom/groupbyinc/flux/rest/RestRequest;)Lorg/apache/logging/log4j/message/Message;
get W(Lcom/groupbyinc/flux/rest/RestRequest;)Lorg/apache/logging/log4j/util/MessageSupplier; org/apache/logging/log4j/Logger error G(Lorg/apache/logging/log4j/util/MessageSupplier;Ljava/lang/Throwable;)V inner Ljava/lang/Exception; e request &Lcom/groupbyinc/flux/rest/RestRequest; channel &Lcom/groupbyinc/flux/rest/RestChannel;
threadContext :Lcom/groupbyinc/flux/common/util/concurrent/ThreadContext; dispatchBadRequest ?(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/common/util/concurrent/ThreadContext;Ljava/lang/Throwable;)V java/io/IOException# *com/groupbyinc/flux/ElasticsearchException%
unknown cause' java/lang/Object) ((Ljava/lang/String;[Ljava/lang/Object;)V .+
&, .
&. #com/groupbyinc/flux/rest/RestStatus0 BAD_REQUEST %Lcom/groupbyinc/flux/rest/RestStatus;23 14 c(Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/rest/RestStatus;Ljava/lang/Exception;)V .6
?7 java/lang/Throwable9
$ #failed to send bad request response< warn *(Ljava/lang/String;Ljava/lang/Throwable;)V>?@ INTERNAL_SERVER_ERRORB3 1C text/plain; charset=UTF-8E +com/groupbyinc/flux/common/bytes/BytesArrayG EMPTY -Lcom/groupbyinc/flux/common/bytes/BytesArray;IJ HK k(Lcom/groupbyinc/flux/rest/RestStatus;Ljava/lang/String;Lcom/groupbyinc/flux/common/bytes/BytesReference;)V .M
?N Ljava/io/IOException; cause Ljava/lang/Throwable; ?(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/client/node/NodeClient;Ljava/util/Optional;)Z
hasContentT ?
U content 3()Lcom/groupbyinc/flux/common/bytes/BytesReference;WX
Y /com/groupbyinc/flux/common/bytes/BytesReference[ length ()I]^
\_ lambda$dispatchRequest$4 a(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestHandler;)Ljava/lang/Boolean;ab
cd E(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/util/function/Function; Qf g sendContentTypeErrorMessagei ?
j lambda$dispatchRequest$5l ?
mn ? getXContentType 4()Lcom/groupbyinc/flux/common/xcontent/XContentType;qr
s 0com/groupbyinc/flux/common/xcontent/XContentTypeu JSON 2Lcom/groupbyinc/flux/common/xcontent/XContentType;wx vy SMILE{x v| NOT_ACCEPTABLE~3 1 Content-Type [? -(Ljava/lang/Object;)Ljava/lang/StringBuilder; ??
?? <] does not support stream parsing. Use JSON or SMILE instead? createSimpleErrorResponse ?(Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/rest/RestStatus;Ljava/lang/String;)Lcom/groupbyinc/flux/rest/BytesRestResponse;??
?? isPresent? ?
?? ? ?
? inFlightRequestsBreaker p(Lcom/groupbyinc/flux/indices/breaker/CircuitBreakerService;)Lcom/groupbyinc/flux/common/breaker/CircuitBreaker;??
? ? 1com/groupbyinc/flux/common/breaker/CircuitBreaker? addEstimateBytesAndMaybeBreak (JLjava/lang/String;)D???? addWithoutBreaking (J)J???? e(Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/indices/breaker/CircuitBreakerService;I)V .?
? lambda$dispatchRequest$6? L
?? H(Lcom/groupbyinc/flux/rest/RestController;)Ljava/util/function/Function; Q? ? ()Ljava/lang/Object;?
?? $com/groupbyinc/flux/rest/RestHandler?
handleRequest {(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/client/node/NodeClient;)V???? getValidHandlerMethodSet 7(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/util/Set;??
? size?^ X? /()Lcom/groupbyinc/flux/rest/RestRequest$Method; }?
? contains? ? X? OPTIONS? ~ ? handleUnsupportedHttpMethod ^(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Ljava/util/Set;)V??
? handleOptionsRequest??
? requestHandled wrappedHandler validMethodSet >Ljava/util/Set; mHandler
contentLength I responseChannel hasContentType O(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestHandler;)Z supportsContentStream? ??? Content-Type? header &(Ljava/lang/String;)Ljava/lang/String;??
? java/util/Locale? ROOT Ljava/util/Locale;?? ?? toLowerCase &(Ljava/util/Locale;)Ljava/lang/String;??
?? application/x-ndjson? setXContentType 5(Lcom/groupbyinc/flux/common/xcontent/XContentType;)V??
? lowercaseMediaType restRequest restHandler getAllHeaderValues $(Ljava/lang/String;)Ljava/util/List;??
? Content-Type header is missing? java/util/List? Content-Type header [? "com/groupbyinc/flux/common/Strings? collectionToCommaDelimitedString ((Ljava/lang/Iterable;)Ljava/lang/String;??
?? ] is not supported errorMessage contentTypeHeader $Ljava/util/List; Ljava/util/List; checkErrorTraceParameter O(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;)Z error_trace paramAsBoolean (Ljava/lang/String;Z)Z
detailedErrorsEnabled ? ? iterator ()Ljava/util/Iterator; X java/util/Iterator hasNext ? next? putHeader '(Ljava/lang/String;Ljava/lang/String;)V
?
" 'error traces in responses are disabled.$ getAllHandlers <(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/util/Iterator;&'
(
ofNullable ((Ljava/lang/Object;)Ljava/util/Optional;*+
?, lambda$tryAllHandlers$7 e(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/MethodHandlers;)Ljava/util/Optional;./
01 ?(Lcom/groupbyinc/flux/rest/MethodHandlers;)Ljava/util/Optional;3 g flatMap6 ?
?7 ?S
9 handleBadRequest; ?
<
httpHeader key it ?Ljava/util/Iterator; Ljava/util/Iterator; allHandlers java/util/HashMapD params ()Ljava/util/Map;FG
H (Ljava/util/Map;)V .J
EK getPath :(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/lang/String;MN
O? lambda$getAllHandlers$8 F(Lcom/groupbyinc/flux/rest/RestRequest;Ljava/util/Map;)Ljava/util/Map;RS
TUG T(Lcom/groupbyinc/flux/rest/RestRequest;Ljava/util/Map;)Ljava/util/function/Supplier;X Y retrieveAll E(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/Iterator;[\
] originalParams 5Ljava/util/Map; Ljava/util/Map; METHOD_NOT_ALLOWEDb3 1c Incorrect HTTP method for uri [e urig ?
h ] and method [j ], allowed: l Allown ,p collectionToDelimitedString :(Ljava/lang/Iterable;Ljava/lang/String;)Ljava/lang/String;rs
?t addHeaderv
?w bytesRestResponse ,Lcom/groupbyinc/flux/rest/BytesRestResponse; OK{3 1| newErrorBuilder 7()Lcom/groupbyinc/flux/common/xcontent/XContentBuilder;~ ?? 3com/groupbyinc/flux/common/xcontent/XContentBuilder? startObject?
?? no handler found for uri [? ]? field [(Ljava/lang/String;Ljava/lang/String;)Lcom/groupbyinc/flux/common/xcontent/XContentBuilder;??
?? endObject?
?? ](Lcom/groupbyinc/flux/rest/RestStatus;Lcom/groupbyinc/flux/common/xcontent/XContentBuilder;)V .?
?? $closeResource 1(Ljava/lang/Throwable;Ljava/lang/AutoCloseable;)V??
? builder 5Lcom/groupbyinc/flux/common/xcontent/XContentBuilder; java/util/HashSet?
? t !lambda$getValidHandlerMethodSet$9 M(Ljava/util/Set;Lcom/groupbyinc/flux/rest/MethodHandlers;)Ljava/lang/Boolean;??
?? >(Lcom/groupbyinc/flux/rest/MethodHandlers;)Ljava/lang/Boolean;? .(Ljava/util/Set;)Ljava/util/function/Function; Q? ? validMethods GET? ~ ? getClass ()Ljava/lang/Class;??
*? /config/favicon.ico? java/lang/Class? getResourceAsStream )(Ljava/lang/String;)Ljava/io/InputStream;??
?? java/io/ByteArrayOutputStream?
? t ,com/groupbyinc/flux/core/internal/io/Streams? copy .(Ljava/io/InputStream;Ljava/io/OutputStream;)J??
?? image/x-icon? toByteArray ()[B??
?? <(Lcom/groupbyinc/flux/rest/RestStatus;Ljava/lang/String;[B)V .?
?? java/io/InputStream? FORBIDDEN?3 1? out Ljava/io/ByteArrayOutputStream; restResponse stream Ljava/io/InputStream; in_flight_requests?
getBreaker G(Ljava/lang/String;)Lcom/groupbyinc/flux/common/breaker/CircuitBreaker;??
^? getValidMethods ()Ljava/util/Set;??
?? addAll (Ljava/util/Collection;)Z?? X? mh )Lcom/groupbyinc/flux/rest/MethodHandlers;
java/util/Map? clear? s?? putAll?J??
getHandler C(Lcom/groupbyinc/flux/rest/RestRequest$Method;)Ljava/util/Optional;??
?? Q I Z? h??
? 5org/apache/logging/log4j/message/ParameterizedMessage? ,failed to send failure response for uri [{}]? '(Ljava/lang/String;Ljava/lang/Object;)V .?
?? ? ???
addMethods (Lcom/groupbyinc/flux/rest/RestHandler;[Lcom/groupbyinc/flux/rest/RestRequest$Method;)Lcom/groupbyinc/flux/rest/MethodHandlers;?
? mHandlers newMHandler java/lang/AutoCloseable close s
: x0 x1 Ljava/lang/AutoCloseable;
access$000 desiredAssertionStatus ?
? Signature Code LocalVariableTable LocalVariableTypeTable LineNumberTable
StackMapTable-(Lcom/groupbyinc/flux/common/settings/Settings;Ljava/util/Set;Ljava/util/function/UnaryOperator;Lcom/groupbyinc/flux/client/node/NodeClient;Lcom/groupbyinc/flux/indices/breaker/CircuitBreakerService;Lcom/groupbyinc/flux/usage/UsageService;)V ?(Ljava/util/Optional;)Z
Exceptions ?(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Lcom/groupbyinc/flux/client/node/NodeClient;Ljava/util/Optional;)Z g(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/util/Iterator; ?(Lcom/groupbyinc/flux/rest/RestRequest;Lcom/groupbyinc/flux/rest/RestChannel;Ljava/util/Set;)V f(Lcom/groupbyinc/flux/rest/RestRequest;)Ljava/util/Set; BootstrapMethods
SourceFile InnerClasses ! ! " # $ % &