-
Notifications
You must be signed in to change notification settings - Fork 3
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
Shade the jar, adds Main.java entrypoint #3
Conversation
isConnected = false; | ||
} | ||
|
||
private void sendMessage(String message, Map<String, String> headers) { |
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.
move this to RelpConversion
@@ -104,6 +118,7 @@ private FullHttpResponse processMessage() { | |||
final Map<String, String> formattedHeaders = formatHeaders(req.headers()); | |||
final String body = req.content().toString(UTF8_CHARSET); | |||
if (messageHandler.onNewMessage(remoteAddress, formattedHeaders, body)) { | |||
sendMessage(body, formattedHeaders); |
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.
this to RelpConversion
@@ -162,4 +177,90 @@ private Map<String, String> formatHeaders(HttpHeaders headers) { | |||
formattedHeaders.put("http_version", req.protocolVersion().text()); | |||
return formattedHeaders; | |||
} | |||
|
|||
private void connect() { |
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.
this to RelpConversion too, note that copy should create a new Connection too.
private final static Logger LOGGER = LogManager.getLogger(MessageHandler.class); | ||
private final RelpConnection relpConnection; |
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.
to RelpConversion
} | ||
|
||
public boolean onNewMessage(String remoteAddress, Map<String, String> headers, String body) { | ||
sendMessage(body, headers); |
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.
use
boolean rv;
try {
send
rv = true;
}
catch (Exception e) {
LOGGER.error("", e);
rv = false;
}
return rv;
} | ||
|
||
public boolean requiresToken() { | ||
return false; |
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.
make this configureable
} | ||
|
||
public boolean validatesToken(String token) { | ||
return true; |
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.
make this configureable, single string.equals(token)
No description provided.