-
Notifications
You must be signed in to change notification settings - Fork 641
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
[ISSUE #4767] Refactor Admin server http handler. #4768
Conversation
|
In addition to the admin server, HttpCommand is also used in the Processor of the http server. This class should not be deprecated. @xwm1992 |
So |
why not use HttpRequest URL instead of |
Because in addition to the HttpRequest URL , HttpCommand also wraps other information such as http method header. @xwm1992 |
Any more problems with the usage of |
5b3dafb
to
d383da0
Compare
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.
HttpCommand
will be deprecated, we will only use requestURI method for http request, no need to add the requestURI for HttpCommand, you can add the@Deprecated
annotation forHttpCommand
.
I agree. HttpCommand
is not designed to parse web requests, although it is still in use.
@karsonto You may try another way to get requestURI
, or introduce another dto class suitable for parsing web requests.
...test/java/org/apache/eventmesh/runtime/admin/handler/QueryRecommendEventMeshHandlerTest.java
Outdated
Show resolved
Hide resolved
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/HttpCommand.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4768 +/- ##
=============================================
+ Coverage 0 16.20% +16.20%
- Complexity 0 1710 +1710
=============================================
Files 0 857 +857
Lines 0 30883 +30883
Branches 0 2685 +2685
=============================================
+ Hits 0 5005 +5005
- Misses 0 25410 +25410
- Partials 0 468 +468 ☔ View full report in Codecov by Sentry. |
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/http/HttpCommand.java
Outdated
Show resolved
Hide resolved
eventmesh-common/src/main/java/org/apache/eventmesh/common/utils/JsonUtils.java
Outdated
Show resolved
Hide resolved
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
Outdated
Show resolved
Hide resolved
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/EventMeshAdminServer.java
Outdated
Show resolved
Hide resolved
@Pil0tXia All the issues mentioned previously have been resolved. |
...ime/src/main/java/org/apache/eventmesh/runtime/admin/handler/InsertWebHookConfigHandler.java
Outdated
Show resolved
Hide resolved
...sh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
Outdated
Show resolved
Hide resolved
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/boot/AbstractHTTPServer.java
Outdated
Show resolved
Hide resolved
...sh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
Outdated
Show resolved
Hide resolved
...sh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/AbstractHttpHandler.java
Outdated
Show resolved
Hide resolved
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.
LGTM
/** | ||
* Handles requests by redirecting matching clients to a target EventMesh server node. | ||
* | ||
* @param httpExchange the exchange containing the request from the client and used to send the response | ||
* @throws IOException if an I/O error occurs while handling the request | ||
*/ | ||
@Override | ||
public void handle(HttpExchange httpExchange) throws IOException { | ||
public void handle(HttpRequest httpRequest, ChannelHandlerContext ctx) throws Exception { | ||
String result = ""; | ||
try (OutputStream out = httpExchange.getResponseBody()) { | ||
String queryString = httpExchange.getRequestURI().getQuery(); |
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.
May you please add the short description of JavaDoc back?
Fixes #4767
Motivation
Explain the content here.
Explain why you want to make the changes and what problem you're trying to solve.
Modifications
Describe the modifications you've done.
Documentation