-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add WebServiceHandler interface. #416
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many classes, including some tests, have methods unnecessarily reordered. My comment ask for them to be put back into the correct places.
I will review the code properly after this is done.
components/proxy/src/main/java/com/hotels/styx/admin/AdminServerBuilder.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/MetricsHandler.java
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/OriginsInventoryHandler.java
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/PluginToggleHandler.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/StyxConfigurationHandler.java
Outdated
Show resolved
Hide resolved
components/proxy/src/test/java/com/hotels/styx/admin/handlers/StyxConfigurationHandlerTest.java
Outdated
Show resolved
Hide resolved
components/server/src/main/java/com/hotels/styx/server/handlers/ClassPathResourceHandler.java
Outdated
Show resolved
Hide resolved
b15a633
to
0263f11
Compare
components/common/src/main/java/com/hotels/styx/common/http/handler/HttpStreamer.java
Outdated
Show resolved
Hide resolved
components/common/src/main/java/com/hotels/styx/common/http/handler/HttpStreamer.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/AdminServerBuilder.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/PluginToggleHandler.java
Outdated
Show resolved
Hide resolved
components/proxy/src/main/java/com/hotels/styx/admin/handlers/StyxConfigurationHandler.java
Outdated
Show resolved
Hide resolved
components/common/src/main/java/com/hotels/styx/common/http/handler/HttpAggregator.java
Show resolved
Hide resolved
* a single {@link HttpResponse} value. | ||
*/ | ||
@FunctionalInterface | ||
public interface WebServiceHandler { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don´t know if this "Web service" describes the functionality correctly. The handler does not have to be used to implement web services, and a webservice might need to stream the body of the request. I guess we should describe that´s a handler that works in a non-streaming fashion.
However I am also wondering if this is the best way to fix the issue... couldn´t it appear in cases in which we cannot use a WebserviceHandler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @dvlato.
-
I'm not 100% happy with this name either. Seems contrived. However it hints at most likely usage: web service endpoints which usually deal with finite sized objects. Should we consider naming it to
StaticHttpHandler
or something similar? WDYT? -
You are correct. There are cases where an
HttpRequest
can trigger a streamingLiveHttpRequest
, and this interface won't help there. However being pragmatic, just look at our admin interface. This new interface caters for pretty every admin interface use case. Also going forward we need to improve the bridging betweenHttpHandler
andWebServiceHandler
. Please share any other ideas :-) -
Also worth noticing I'm not attempting to solve every content body issue in this PR. Just trying getting the admin interface (low hanging fruit) sorted. I still need to do more follow on work to cover the rest.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
StaticHttpHandler could be ok in this case.
Convert admin interface to use the new WebServiceHandler. Refactor MetricsHandler.
f514e6d
to
bf35ead
Compare
* Convert admin interface to use the new WebServiceHandler. * Refactor MetricsHandler.
Summary
Adds a new interface
WebServiceHandler
into Styx API.It is a handler for HTTP static HTTP requests, useful for implementing "web service" endpoints with fixed content payload.
This prevents unintended errors where live HTTP message bodies are not properly consumed, and thus leaving the underlying TCP connection engaged.
Other changes are:
MetricsHandler
WebServiceHandler
WebServiceHandler
andHttpHandler
interfaces