Using the request URI, creates a query instance capable of handling the given request. @param tsdb the TSDB instance we are running within @param request the incoming HTTP request @param chan the Channel the request came in on. @return a subclass of AbstractHttpQuery @throws BadReque
(final TSDB tsdb,
final HttpRequest request,
final Channel chan)
| 171 | * can be detected early, here. |
| 172 | */ |
| 173 | private AbstractHttpQuery createQueryInstance(final TSDB tsdb, |
| 174 | final HttpRequest request, |
| 175 | final Channel chan) |
| 176 | throws BadRequestException { |
| 177 | final String uri = request.getUri(); |
| 178 | if (Strings.isNullOrEmpty(uri)) { |
| 179 | throw new BadRequestException("Request URI is empty"); |
| 180 | } else if (uri.charAt(0) != '/') { |
| 181 | throw new BadRequestException("Request URI doesn't start with a slash"); |
| 182 | } else if (rpc_manager.isHttpRpcPluginPath(uri)) { |
| 183 | http_plugin_rpcs_received.incrementAndGet(); |
| 184 | return new HttpRpcPluginQuery(tsdb, request, chan); |
| 185 | } else { |
| 186 | http_rpcs_received.incrementAndGet(); |
| 187 | HttpQuery builtinQuery = new HttpQuery(tsdb, request, chan); |
| 188 | return builtinQuery; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Helper method to apply CORS configuration to a request, either a built-in |
no test coverage detected