Skip to content

Instantly share code, notes, and snippets.

@coderunner
Created September 4, 2011 01:59
Show Gist options
  • Select an option

  • Save coderunner/1192099 to your computer and use it in GitHub Desktop.

Select an option

Save coderunner/1192099 to your computer and use it in GitHub Desktop.

Revisions

  1. coderunner revised this gist Sep 4, 2011. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -45,5 +45,4 @@ public String getBody()
    {
    return body;
    }
    }

    }
  2. coderunner revised this gist Sep 4, 2011. 1 changed file with 22 additions and 0 deletions.
    22 changes: 22 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -25,3 +25,25 @@ public interface Store
    public String get(String key);
    }

    public class HttpResponse
    {
    private final int code;
    private final String body;

    public HttpResponse(int code, String body)
    {
    this.code = code;
    this.body = body;
    }

    public int getCode()
    {
    return code;
    }

    public String getBody()
    {
    return body;
    }
    }

  3. coderunner revised this gist Sep 4, 2011. 1 changed file with 24 additions and 1 deletion.
    25 changes: 24 additions & 1 deletion gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,27 @@
    public interface RequestHandler
    {
    public HttpResponse handle(HttpRequest request, Context context);
    }
    }

    public interface HttpRequest
    {
    public String getPath();
    public Map<String, String> getHeaders();
    }

    public interface Context
    {
    public Monitoring getMonitoring();
    public Store getStore();
    }

    public interface Monitoring
    {
    public void incrementRequestCounter();
    }

    public interface Store
    {
    public String get(String key);
    }

  4. coderunner created this gist Sep 4, 2011.
    4 changes: 4 additions & 0 deletions gistfile1.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    public interface RequestHandler
    {
    public HttpResponse handle(HttpRequest request, Context context);
    }