Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
how to use rest generated via service-builder to get to request
hi
i try use new feture of Lifer 7.4.2, integration Chatwoot.
it's work fine.
but new i want to use webhook of Chatwoot to auto feedback mesasge to user. webhook of Chatwoot will send a POST request with the payload to the configured URL.
i'd like to know how to use rest generated via service-builder to get to request and retruen a json. but i do not know how to get the request.
for now, i use a dynamic web project and generate a WAR, deploy to liferay's tomcat, and use jsp to get the request.
<%@ page import="java.io.*"%>
<%
String payloadBody = null;
StringBuilder stringBuilder = new StringBuilder();
BufferedReader bufferedReader = null;
try {
InputStream inputStream = request.getInputStream();
if (inputStream != null) {
bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
char[] charBuffer = new char[128];
int bytesRead = -1;
while ((bytesRead = bufferedReader.read(charBuffer)) > 0) {
stringBuilder.append(charBuffer, 0, bytesRead);
}
} else {
stringBuilder.append("");
}
} catch (IOException ex) {
throw ex;
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (IOException ex) {
throw ex;
}
}
}
%>
after get the request, i call my rest with the message.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™