Package org.ardverk.dht.storage.message

Examples of org.ardverk.dht.storage.message.Response


   
    if (context == null) {
      return ResponseFactory.notFound();
    }
   
    return new Response(StatusLine.OK, context);
  }
View Full Code Here


    File contentFile = mkContentFile(key, valueId, false);
    if (!contentFile.exists()) {
      return null;
    }
   
    return new Response(StatusLine.OK, context,
        new FileValue(contentFile));
  }
View Full Code Here

      in = value.getContent();
     
      Request request = Request.valueOf(in);
      Method method = request.getMethod();
     
      Response response = null;
      switch (method) {
        case PUT:
          response = handlePut(src, key, request, in);
          break;
        case GET:
          response = handleGet(src, key, request, in);
          break;
        case DELETE:
          response = handleDelete(src, key, request, in);
          break;
        case HEAD:
          response = handleHead(src, key, request, in);
          break;
        default:
          throw new IllegalArgumentException("method=" + method);
      }
     
      if (response == null) {
        throw new IllegalStateException();
      }
     
      return response.commit();
     
    } catch (Exception err) {
      LOG.error("Exception", err);
      return ResponseFactory.commit(ResponseFactory.error(err));
    } finally {
View Full Code Here

      Request request, InputStream in) throws IOException;
 
  protected Response handleGet(Contact src, Key key,
      Request request, InputStream in) throws IOException {
   
    Response response = handleGet(src, key, true);
    if (response == null) {
      response = ResponseFactory.notFound();
    }
   
    return response;
View Full Code Here

      Request request, InputStream in) throws IOException;
 
  @Override
  public Value get(Contact src, Key key) {
    try {
      Response response = handleGet(src, key, false);
      if (response != null) {
        return response.commit();
      }
    } catch (Exception err) {
      LOG.error("Exception", err);
      return ResponseFactory.commit(ResponseFactory.error(err));
    }
View Full Code Here

TOP

Related Classes of org.ardverk.dht.storage.message.Response

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.