Skip to content

Commit

Permalink
Rename process to handle (#9385)
Browse files Browse the repository at this point in the history
Renamed Request.Processor to Request.Handler
Renamed Handler.process to Handler.handle
Renamed Rule.Processor to Rule.Handler.
Renamed accordingly methods and variable.
Updated comments accordingly.

Signed-off-by: Simone Bordet <[email protected]>
Co-authored-by: Simone Bordet <[email protected]>
  • Loading branch information
gregw and sbordet authored Feb 16, 2023
1 parent a6b1de5 commit 0ca6295
Show file tree
Hide file tree
Showing 255 changed files with 986 additions and 987 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class HandlerDocs
public static class HelloHandler0 extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand All @@ -51,7 +51,7 @@ public boolean process(Request request, Response response, Callback callback) th
public static class HelloHandler1 extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand All @@ -63,7 +63,7 @@ public boolean process(Request request, Response response, Callback callback)
public static class HelloHandler2 extends Handler.Abstract.NonBlocking
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand All @@ -75,7 +75,7 @@ public boolean process(Request request, Response response, Callback callback)
public static class HelloHandler3 extends Handler.Abstract.NonBlocking
{
@Override
public boolean process(Request request, Response response, Callback callback) throws IOException
public boolean handle(Request request, Response response, Callback callback) throws IOException
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand All @@ -98,7 +98,7 @@ public boolean process(Request request, Response response, Callback callback) th
public static class HelloHandler4 extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws IOException
public boolean handle(Request request, Response response, Callback callback) throws IOException
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand All @@ -119,7 +119,7 @@ public boolean process(Request request, Response response, Callback callback) th
public static class HelloHandler5 extends Handler.Abstract.NonBlocking
{
@Override
public boolean process(Request request, Response response, Callback callback) throws IOException
public boolean handle(Request request, Response response, Callback callback) throws IOException
{
response.setStatus(200);
response.getHeaders().add(HttpHeader.CONTENT_LENGTH, "text/plain");
Expand Down Expand Up @@ -160,7 +160,7 @@ public void cancel()
public static class DiscriminatingGreeterHandler extends Handler.Abstract.NonBlocking
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
if (!HttpMethod.GET.is(request.getMethod()) || !"greeting".equals(Request.getPathInContext(request)))
return false;
Expand All @@ -175,7 +175,7 @@ public boolean process(Request request, Response response, Callback callback)
public static class EchoHandler extends Handler.Abstract.NonBlocking
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.setStatus(200);
response.getHeaders().put(HttpHeader.CONTENT_TYPE, request.getHeaders().get(HttpHeader.CONTENT_TYPE));
Expand All @@ -192,7 +192,7 @@ public boolean process(Request request, Response response, Callback callback)
public static class RootHandler extends Handler.Sequence
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
final StringBuilder index = new StringBuilder();
index.append("<h2>Handler Demos</h2>\n<ul>\n");
Expand All @@ -202,7 +202,7 @@ public boolean process(Request request, Response response, Callback callback) th
String name = handler.getClass().getSimpleName().replace("Handler", "");
String path = "/" + name;
if (Request.getPathInContext(request).equals(name))
return handler.process(request, response, callback);
return handler.handle(request, response, callback);

index.append("<li><a href=\"")
.append(URIUtil.addPaths(request.getContext().getContextPath(), path))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void simple() throws Exception
server.setHandler(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
// Succeed the callback to write the response.
callback.succeeded();
Expand Down Expand Up @@ -478,7 +478,7 @@ public void handlerTree()
class LoggingHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
callback.succeeded();
return true;
Expand All @@ -488,7 +488,7 @@ public boolean process(Request request, Response response, Callback callback) th
class App1Handler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
callback.succeeded();
return true;
Expand All @@ -498,7 +498,7 @@ public boolean process(Request request, Response response, Callback callback) th
class App2Handler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
callback.succeeded();
return true;
Expand All @@ -525,7 +525,7 @@ class MyHandler extends Handler.Abstract
{
@Override
// tag::handlerAPI[]
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
return true;
}
Expand All @@ -539,7 +539,7 @@ public void handlerHello() throws Exception
class HelloWorldHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.setStatus(200);
response.getHeaders().put(HttpHeader.CONTENT_TYPE, "text/html; charset=UTF-8");
Expand Down Expand Up @@ -576,7 +576,7 @@ public void handlerFilter() throws Exception
class HelloWorldHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
return true;
}
Expand All @@ -586,7 +586,7 @@ public boolean process(Request request, Response response, Callback callback)
class FilterHandler extends Handler.Wrapper
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
String path = Request.getPathInContext(request);
if (path.startsWith("/old_path/"))
Expand All @@ -608,7 +608,7 @@ public HttpURI getHttpURI()
}

// Forward to the next Handler.
return super.process(request, response, callback);
return super.handle(request, response, callback);
}
}

Expand All @@ -631,7 +631,7 @@ public void contextHandler() throws Exception
class ShopHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
// Implement the shop, remembering to complete the callback.
return true;
Expand Down Expand Up @@ -660,7 +660,7 @@ public void contextHandlerCollection() throws Exception
class ShopHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
// Implement the shop, remembering to complete the callback.
return true;
Expand All @@ -670,7 +670,7 @@ public boolean process(Request request, Response response, Callback callback) th
class RESTHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
// Implement the REST APIs, remembering to complete the callback.
return true;
Expand Down Expand Up @@ -849,7 +849,7 @@ public void contextGzipHandler() throws Exception
class ShopHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
// Implement the shop, remembering to complete the callback.
return true;
Expand All @@ -859,7 +859,7 @@ public boolean process(Request request, Response response, Callback callback) th
class RESTHandler extends Handler.Abstract
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
// Implement the REST APIs, remembering to complete the callback.
return true;
Expand Down
6 changes: 3 additions & 3 deletions inceptionDates.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2929,7 +2929,7 @@ jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/RequestTest.java,
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ResourceListingTest.java, 2022-09-27
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/LatencyRecordingHandlerTest.java, 2023-01-19
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/GracefulHandlerTest.java, 2023-01-23
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorProcessorTest.java, 2016-07-18
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ErrorHandlerTest.java, 2016-07-18
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestFixture.java, 2010-07-13
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/HttpServerTestBase.java, 2009-03-24
jetty-core/jetty-server/src/test/java/org/eclipse/jetty/server/ForwardedRequestCustomizerTest.java, 2016-08-11
Expand Down Expand Up @@ -2997,7 +2997,7 @@ jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ForwardedRequestC
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/ResourceListing.java, 2022-08-02
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/DelayedHandler.java, 2022-05-03
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/GracefulHandler.java, 2023-01-23
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ReHandlingErrorProcessor.java, 2022-10-24
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ReHandlingErrorHandler.java, 2022-10-24
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/jmx/ContextHandlerMBean.java, 2009-03-24
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/jmx/AbstractHandlerMBean.java, 2009-06-30
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/jmx/package-info.java, 2012-11-02
Expand Down Expand Up @@ -3031,7 +3031,7 @@ jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHa
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/package-info.java, 2012-11-02
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextResponse.java, 2022-05-03
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ContextHandler.java, 2009-03-24
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorProcessor.java, 2022-05-03
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java, 2022-05-03
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/IdleTimeoutHandler.java, 2013-11-08
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/StatisticsHandler.java, 2009-03-24
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/SecuredRedirectHandler.java, 2014-09-30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void startServer() throws Exception
server.setHandler(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public void testClientNotSupportingALPNServerSpeaksDefaultProtocol() throws Exce
startServer(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
Expand Down Expand Up @@ -133,7 +133,7 @@ public void testClientSupportingALPNServerSpeaksNegotiatedProtocol() throws Exce
startServer(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testClientSupportingALPNCannotNegotiateProtocol() throws Exception
startServer(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
callback.succeeded();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testClientConnectionCloseServerConnectionCloseClientClosesAfterExcha
start(scenario, new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
Content.Source.consumeAll(request);

Expand Down Expand Up @@ -99,7 +99,7 @@ public void testClientConnectionCloseServerDoesNotRespondClientIdleTimeout(Scena
start(scenario, new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
// Do not respond.
return true;
Expand Down Expand Up @@ -142,7 +142,7 @@ public void testClientConnectionCloseServerPartialResponseClientIdleTimeout(Scen
start(scenario, new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
Content.Source.consumeAll(request);

Expand Down Expand Up @@ -204,7 +204,7 @@ public void testClientConnectionCloseServerNoConnectionCloseClientCloses(Scenari
start(scenario, new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback) throws Exception
public boolean handle(Request request, Response response, Callback callback) throws Exception
{
response.getHeaders().putLongField(HttpHeader.CONTENT_LENGTH, 0);
Content.Sink.write(response, false, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void testMaxUsage() throws Exception
start(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.getHeaders().put(HttpHeader.CONTENT_TYPE, "text/plain");
Content.Sink.write(response, true, String.valueOf(Request.getRemotePort(request)), callback);
Expand Down Expand Up @@ -108,7 +108,7 @@ public void testMaxUsageSetToSmallerValue() throws Exception
start(new Handler.Abstract()
{
@Override
public boolean process(Request request, Response response, Callback callback)
public boolean handle(Request request, Response response, Callback callback)
{
response.getHeaders().put(HttpHeader.CONTENT_TYPE, "text/plain");
Content.Sink.write(response, true, String.valueOf(Request.getRemotePort(request)), callback);
Expand Down
Loading

0 comments on commit 0ca6295

Please sign in to comment.