-
Notifications
You must be signed in to change notification settings - Fork 102
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
There is no JSESSIONID in the content of HTTP response after a bad request. #318
Comments
Could you provide us with your code? from HTTP is not completely clear, what is going on. in short words, you can not get JSESSIONID from any request, you have to get object "session" after login. Or attach Base64 encoded credentials as header, but in this case you don't need JSESSIONID at all(each request works in separate session). |
Thank you for you reply. Code(1112 is an exsiting role): public static void test() {
HTTP log: 2017-10-18 12:29:47.356 INFO SessionStorage:155 - 1 * Client response received on thread Thread-9 2017-10-18 12:29:47.495 INFO SessionStorage:155 - 1 * Sending client request on thread Thread-9 2017-10-18 12:29:47.535 INFO SessionStorage:155 - 1 * Client response received on thread Thread-9 2017-10-18 12:29:52.589 INFO SessionStorage:155 - 1 * Sending client request on thread Thread-9 2017-10-18 12:29:52.890 INFO SessionStorage:155 - 1 * Client response received on thread Thread-9 Looking forward for your reply. |
Hello,
thanks for your great work to apply such an useful API.
I found an issue when using the API.
Firstly I used the API to make a mistake on purpose, for example, I added a role which already exsited on the server.
After that whatever API I used, there is no JSESSIONID in the content of HTTP response.
So that I cann't use SPRING authenticate type to connect with sever after a http error.
In the JasperserverRestClient class, if AuthenticationType is SPRING, the follwing codes will work:
String sessionId;
if (!location.matches("[^?]+\?([^&]&)error=1(&[^&])$")) {
sessionId = response.getCookies().get("JSESSIONID").getValue();
storage.setSessionId(sessionId);
} else {
throw new AuthenticationFailedException("Invalid credentials supplied. Could not login to JasperReports Server.");
}
This will cause NullPointerException.
HTTP Logs :
2017-10-17 14:50:36.195 INFO SessionStorage:155 - 1 * Sending client request on thread Thread-12
1 > PUT http://localhost:8080/jasperserver-pro/rest_v2/roles/1112
1 > Accept: application/json
1 > Content-Type: application/json
{"name":"1112","externallyDefined":false}
2017-10-17 14:50:36.266 INFO SessionStorage:155 - 1 * Client response received on thread Thread-12
1 < 400
1 < Cache-Control: private
1 < Connection: close
1 < Content-Type: application/json
1 < Date: Tue, 17 Oct 2017 06:50:36 GMT
1 < Expires: Thu, 01 Jan 1970 08:00:00 CST
1 < P3P: CP="ALL"
1 < Server: Apache-Coyote/1.1
1 < Transfer-Encoding: chunked
{"message":"resource 1112 already exists。","errorCode":"resource.already.exists","parameters":["1112"]}
2017-10-17 14:50:36.311 INFO SessionStorage:155 - 1 * Sending client request on thread Thread-12
1 > GET http://localhost:8080/jasperserver-pro/rest_v2/organizations?includeParents=true
1 > Accept: application/json
2017-10-17 14:50:36.321 INFO SessionStorage:155 - 1 * Client response received on thread Thread-12
1 < 200
1 < Cache-Control: private
1 < Content-Type: application/json
1 < Date: Tue, 17 Oct 2017 06:50:36 GMT
1 < Expires: Thu, 01 Jan 1970 08:00:00 CST
1 < P3P: CP="ALL"
1 < Result-Count: 5
1 < Server: Apache-Coyote/1.1
1 < Start-Index: 0
1 < Total-Count: 5
1 < Transfer-Encoding: chunked
Could you please tell me what's the reason of this problem?
Looking forward for your reply.
The text was updated successfully, but these errors were encountered: