class DispatchRenderer implements Renderer {

    @Override
    public void render(String path, Request request) throws IOException {
        if (path == null) {
            throw new CannotRenderException("Cannot dispatch a null path");
        }
        DispatchRequest dispatchRequest = getDispatchRequest(request);
        if (dispatchRequest == null) {
            throw new CannotRenderException("Cannot dispatch outside of a web environment");
        }

        dispatchRequest.dispatch(path);
    }

}