Hi all,
I am struggling with a pb using RPC:
When I use the service to create and store my objects in my DB (Neo4J) using remote service, all is Fine.
When I try to load my objects all is ok in my service class and in Neo4J as well. But at the last line of the method
public static void writeResponse(ServletContext servletContext, HttpServletResponse response, String responseContent, boolean gzipResponse) throws IOException {
I have an exception.
Here is the method of com.google.gwt.user.server.rpc.RPCServletUtils
public static void writeResponse(ServletContext servletContext,
HttpServletResponse response, String responseContent, boolean gzipResponse)
throws IOException {
byte[] responseBytes = responseContent.getBytes(CHARSET_UTF8);
if (gzipResponse) {
// Compress the reply and adjust headers.
//
ByteArrayOutputStream output = null;
GZIPOutputStream gzipOutputStream = null;
Throwable caught = null;
try {
output = new ByteArrayOutputStream(responseBytes.length);
gzipOutputStream = new GZIPOutputStream(output);
gzipOutputStream.write(responseBytes);
gzipOutputStream.finish();
gzipOutputStream.flush();
setGzipEncodingHeader(response);
responseBytes = output.toByteArray();
} catch (IOException e) {
caught = e;
} finally {
if (null != gzipOutputStream) {
gzipOutputStream.close();
}
if (null != output) {
output.close();
}
}
if (caught != null) {
servletContext.log("Unable to compress response", caught);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
}
// Send the reply.
//
response.setContentLength(responseBytes.length);
response.setContentType(CONTENT_TYPE_APPLICATION_JSON_UTF8);
response.setStatus(HttpServletResponse.SC_OK);
response.setHeader(CONTENT_DISPOSITION, ATTACHMENT);
response.getOutputStream().write(responseBytes);
}
And the return message on my console is:
200 - POST /spotgwt/spotData (127.0.0.1) 501 bytes
Request headers
Host:
127.0.0.1:8887 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0
Accept: */*
Accept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Content-Type: text/x-gwt-rpc; charset=utf-8
X-GWT-Permutation: A082E84D087467DED16699006D694A7B
X-GWT-Module-Base:
http://127.0.0.1:8887/spotgwt/ Content-Length: 228
Origin:
http://127.0.0.1:8887 DNT: 1
Connection: keep-alive
Referer:
http://127.0.0.1:8887/SpotGWT.html Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
Response headers
Date: Tue, 12 Oct 2021 16:57:51 GMT
Content-Encoding: gzip
Content-Length: 501
Content-Type: application/json; charset=utf-8
Content-Disposition: attachment
Can you help me.
Thanks a lot
Antonio