added better error notification for timeouts, and work with longer
request timout limits
This commit is contained in:
parent
7de512d7fe
commit
def31a4669
5 changed files with 21 additions and 1 deletions
|
@ -76,7 +76,7 @@ public class ClientHttpRequestFactoryService {
|
|||
final ClientCredentialService clientCredentialService,
|
||||
@Value("${sebserver.http.client.connect-timeout:15000}") final int connectTimeout,
|
||||
@Value("${sebserver.http.client.connection-request-timeout:20000}") final int connectionRequestTimeout,
|
||||
@Value("${sebserver.http.client.read-timeout:10000}") final int readTimeout) {
|
||||
@Value("${sebserver.http.client.read-timeout:60000}") final int readTimeout) {
|
||||
|
||||
this.environment = environment;
|
||||
this.clientCredentialService = clientCredentialService;
|
||||
|
|
|
@ -281,6 +281,10 @@ public interface PageContext {
|
|||
*
|
||||
* @param error the original error */
|
||||
default void notifyUnexpectedError(final Exception error) {
|
||||
if (error instanceof PageMessageException) {
|
||||
publishInfo(((PageMessageException) error).getMessageKey());
|
||||
return;
|
||||
}
|
||||
notifyError(UNEXPECTED_ERROR_KEY, error);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.springframework.http.MediaType;
|
|||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
import org.springframework.web.client.RestClientResponseException;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
@ -46,11 +47,15 @@ import ch.ethz.seb.sebserver.gbl.model.Page;
|
|||
import ch.ethz.seb.sebserver.gbl.model.PageSortOrder;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Result;
|
||||
import ch.ethz.seb.sebserver.gbl.util.Utils;
|
||||
import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey;
|
||||
import ch.ethz.seb.sebserver.gui.service.page.PageMessageException;
|
||||
|
||||
public abstract class RestCall<T> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RestCall.class);
|
||||
|
||||
public static final LocTextKey REQUEST_TIMEOUT_MESSAGE = new LocTextKey("sebserver.overall.message.requesttimeout");
|
||||
|
||||
public enum CallType {
|
||||
UNDEFINED,
|
||||
GET_SINGLE,
|
||||
|
@ -161,6 +166,11 @@ public abstract class RestCall<T> {
|
|||
}
|
||||
|
||||
return Result.ofError(restCallError);
|
||||
} catch (final ResourceAccessException rae) {
|
||||
if (rae.getMessage().contains("Read timed out")) {
|
||||
return Result.ofError(new PageMessageException(REQUEST_TIMEOUT_MESSAGE));
|
||||
}
|
||||
return Result.ofError(rae);
|
||||
} catch (final Exception e) {
|
||||
final RestCallError restCallError = new RestCallError("Unexpected error while rest call", e);
|
||||
restCallError.errors.add(APIMessage.ErrorMessage.UNEXPECTED.of(
|
||||
|
|
|
@ -23,6 +23,11 @@ sebserver.gui.http.webservice.port=8080
|
|||
sebserver.gui.http.webservice.contextPath=${server.servlet.context-path}
|
||||
sebserver.gui.entrypoint=/gui
|
||||
|
||||
|
||||
sebserver.http.client.connect-timeout=60000
|
||||
sebserver.http.client.connection-request-timeout=100000
|
||||
sebserver.http.client.read-timeout=200000
|
||||
|
||||
sebserver.gui.webservice.apipath=${sebserver.webservice.api.admin.endpoint}
|
||||
# defines the polling interval that is used to poll the webservice for client connection data on a monitored exam page
|
||||
sebserver.gui.webservice.poll-interval=2000
|
||||
|
|
|
@ -9,6 +9,7 @@ sebserver.overall.help=Documentation
|
|||
sebserver.overall.help.link=https://seb-server.readthedocs.io/en/latest/index.html
|
||||
|
||||
sebserver.overall.message.leave.without.save=You have unsaved changes!<br/>Are you sure you want to leave the page? The changes will be lost.
|
||||
sebserver.overall.message.requesttimeout=There was a request timeout. If this is a search please try to narrow down your search by using the filter above and try again.
|
||||
sebserver.overall.upload=Please select a file
|
||||
sebserver.overall.upload.unsupported.file=This file type is not supported. Supported files are: {0}
|
||||
sebserver.overall.action.modify.cancel=Cancel
|
||||
|
|
Loading…
Reference in a new issue