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.
request handler interface
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);
}
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;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment