Package com.linkedin.r2.transport.http.server

Examples of com.linkedin.r2.transport.http.server.HttpServer


      // N.B. since QueryParamMockCollection is implemented using the synchronous rest.li interface,
      // RestLiServer.handleRequest() will invoke the application resource *and* the callback
      // *synchronously*, ensuring that the all instances of the callback are invoked before the
      // loop terminates.
      server.handleRequest(restRequest, new RequestContext(), new Callback<RestResponse>()
      {
        @Override
        public void onError(Throwable e)
        {
          Assert.fail();
View Full Code Here


  private void executeRequestThroughParseqDebugHandler(URI uri, Callback<RestResponse> callback)
  {
    ParseqTraceDebugRequestHandler requestHandler = new ParseqTraceDebugRequestHandler();
    RestRequestBuilder requestBuilder = new RestRequestBuilder(uri);
    RestRequest request = requestBuilder.build();
    RequestContext requestContext = new RequestContext();

    requestHandler.handleRequest(request,
                                  requestContext,
                                  new RestLiDebugRequestHandler.ResourceDebugRequestHandler()
                                  {
View Full Code Here

    // create the load balancer
    SimpleLoadBalancer loadBalancer = new SimpleLoadBalancer(state);

    final TransportClient tc = loadBalancer.getClient(new URIRequest("d2://browsemaps/52"),
                                                      new RequestContext());
    final Client c = new TransportClientAdapter(tc);
    c.restRequest(null);
  }
View Full Code Here

                }
            }

        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
                if(exception.getResponse().getStatus() == NOT_FOUND.getCode()) {
                    return false;
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

                    logger.debug("Did not get any response!");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

            RestResponse response = fetchGetResponse(rb, FETCH_SCHEMA_TIMEOUT_MS);
            return response.getEntity().asString("UTF-8");
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

                    logger.debug("Empty response !");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

                int httpErrorStatus = exception.getResponse().getStatus();
                if(httpErrorStatus == BAD_REQUEST.getCode()) {
                    throw new VoldemortException("Bad request: " + e.getMessage(), e);
                } else if(httpErrorStatus == PRECONDITION_FAILED.getCode()) {
                    throw new ObsoleteVersionException(e.getMessage());
                } else if(httpErrorStatus == REQUEST_TIMEOUT.getCode()
View Full Code Here

                    }
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

                    logger.debug("Did not get any response!");
                }
            }
        } catch(ExecutionException e) {
            if(e.getCause() instanceof RestException) {
                RestException exception = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST EXCEPTION STATUS : " + exception.getResponse().getStatus());
                }

            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
View Full Code Here

    }

    private void handleRequestAndResponseException(Exception e) {
        if(e instanceof ExecutionException) {
            if(e.getCause() instanceof RestException) {
                RestException re = (RestException) e.getCause();
                if(logger.isDebugEnabled()) {
                    logger.debug("REST Exception Status: " + re.getResponse().getStatus());
                }
            } else {
                throw new VoldemortException("Unknown HTTP request execution exception: "
                                             + e.getMessage(), e);
            }
View Full Code Here

TOP

Related Classes of com.linkedin.r2.transport.http.server.HttpServer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.