问题
I'm trying to make a REST call (using the Restlet framework) from Google App Engine to a JasperReports server that I have running on Google Compute Engine. To use the JasperReports REST interface you need to first login by sending a POST request (with no body) and username/password query params.
http:///jasperserver/rest/login?j_username=&j_password=
The JasperReports server will respond by adding a "Set-Cookie" request header attribute. The attribute value contains a session ID that you use for any subsequent requests, thereby preserving session state across multiple requests. An example of this attribute is
Set-Cookie: JSESSIONID=488AAF4E493E1FE5BEA25F6D71C025F3; Path=/jasperserver; HttpOnly
When I use a stand-alone Apache HTTP client, everything works fine. The JR server returns the Set-Cookie attribute and I insert it back into the header of any subsequent requests (report executions, report status, details, etc.).
However, when I try to do the same using the Restlet framework on Google App Engine (which uses the URLFetchService under the hood) the "Set-Cookie" attribute never appears in the response header even though the JasperReports server returns a 200 OK status for the login POST request.
Does anyone have experience with URLFetchService removing (custom) response header attributes?
Any help would be much appreciated!
回答1:
Removing (custom) response header attributes would be an Google App Engine bug because the documentation states;
https://cloud.google.com/appengine/docs/standard/java/outbound-requests
来源:https://stackoverflow.com/questions/45163680/jasperreports-server-login-not-working-from-google-app-engine-due-to-missing-h