File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/main/java/com/jaspersoft/jasperserver/jaxrs/client/core Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 2525import com .jaspersoft .jasperserver .jaxrs .client .core .exceptions .handling .DefaultErrorHandler ;
2626import com .jaspersoft .jasperserver .jaxrs .client .filters .BasicAuthenticationFilter ;
2727import com .jaspersoft .jasperserver .jaxrs .client .filters .SessionOutputFilter ;
28- import org .glassfish .jersey .client .ClientProperties ;
29-
3028import javax .ws .rs .client .Entity ;
3129import javax .ws .rs .client .WebTarget ;
3230import javax .ws .rs .core .Form ;
3331import javax .ws .rs .core .MediaType ;
3432import javax .ws .rs .core .Response ;
33+ import org .glassfish .jersey .client .ClientProperties ;
3534
3635public class JasperserverRestClient {
3736 private final RestClientConfiguration configuration ;
@@ -72,7 +71,9 @@ protected void login(SessionStorage storage) {
7271 .property (ClientProperties .FOLLOW_REDIRECTS , Boolean .FALSE );
7372 Response response = target .request ().post (Entity .entity (form , MediaType .APPLICATION_FORM_URLENCODED_TYPE ));
7473 String sessionId = null ;
75- if (response .getStatus () == ResponseStatus .FOUND ) {
74+ String location = response .getLocation ().toString ();
75+
76+ if (response .getStatus () == ResponseStatus .FOUND && !location .matches ("^(https?)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*?error=1$" )) {
7677 sessionId = response .getCookies ().get ("JSESSIONID" ).getValue ();
7778 storage .setSessionId (sessionId );
7879 } else {
You can’t perform that action at this time.
0 commit comments