Skip to content

Commit

Permalink
Deprecate CommandHandler
Browse files Browse the repository at this point in the history
We're moving towards just using HttpHandler for everything
but getting there in one go is a loooong journey. We begin
by deprecating CommandHandler and letting us use them as
HttpHandlers as required.
  • Loading branch information
shs96c committed Jul 3, 2019
1 parent 9754373 commit 951f9f4
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions java/server/src/org/openqa/selenium/grid/web/CommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,27 @@

package org.openqa.selenium.grid.web;

import org.openqa.selenium.remote.http.HttpHandler;
import org.openqa.selenium.remote.http.HttpRequest;
import org.openqa.selenium.remote.http.HttpResponse;

import java.io.IOException;
import java.io.UncheckedIOException;

@Deprecated
@FunctionalInterface
public interface CommandHandler {
void execute(HttpRequest req, HttpResponse resp) throws IOException;
public interface CommandHandler extends HttpHandler {
void execute(HttpRequest req, HttpResponse res) throws IOException;

@SuppressWarnings("FunctionalInterfaceMethodChanged")
@Override
default HttpResponse execute(HttpRequest req) {
HttpResponse res = new HttpResponse();
try {
execute(req, res);
return res;
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
}

0 comments on commit 951f9f4

Please sign in to comment.