Skip to content
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

Merged
merged 5 commits into from
Jun 4, 2019

Conversation

mikkokar
Copy link
Contributor

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:

  • Refactor MetricsHandler
  • Convert admin interface endpoints to implement WebServiceHandler
  • Adapters for bridging between WebServiceHandler and HttpHandler interfaces

@mikkokar mikkokar requested review from kvosper and dvlato May 22, 2019 13:28
Copy link
Contributor

@kvosper kvosper left a 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.

@mikkokar mikkokar force-pushed the web-service-handler branch from b15a633 to 0263f11 Compare May 24, 2019 16:26
* a single {@link HttpResponse} value.
*/
@FunctionalInterface
public interface WebServiceHandler {
Copy link
Contributor

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?

Copy link
Contributor Author

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 streaming LiveHttpRequest, 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 between HttpHandler and WebServiceHandler. 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.

Copy link
Contributor

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.

@mikkokar mikkokar force-pushed the web-service-handler branch from f514e6d to bf35ead Compare June 4, 2019 07:35
@mikkokar mikkokar merged commit 6bedc63 into ExpediaGroup:master Jun 4, 2019
@mikkokar mikkokar deleted the web-service-handler branch June 4, 2019 09:02
dvlato pushed a commit that referenced this pull request Jul 3, 2019
* Convert admin interface to use the new WebServiceHandler.
* Refactor MetricsHandler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants