Java Code Examples for org.springframework.http.HttpStatus#REQUEST_TIMEOUT

The following examples show how to use org.springframework.http.HttpStatus#REQUEST_TIMEOUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractRestExceptionHandler.java    From kaif with Apache License 2.0 5 votes vote down vote up
@ExceptionHandler({ QueryTimeoutException.class })
@ResponseBody
public ResponseEntity<E> handleQueryTimeoutException(final QueryTimeoutException ex,
    final WebRequest request) {
  final HttpStatus status = HttpStatus.REQUEST_TIMEOUT;
  final E errorResponse = createErrorResponse(status,
      i18n(request, "rest-error.QueryTimeoutException"));
  logException(ex, errorResponse, request);
  return new ResponseEntity<>(errorResponse, status);
}
 
Example 2
Source File: LoginController.java    From spring-data-rest-acl with Apache License 2.0 5 votes vote down vote up
@RequestMapping(method = RequestMethod.GET, value = "/all/invalid_session")
public @ResponseBody
ResponseEntity<String> handleInvalidSession(HttpServletRequest request,
		HttpServletResponse response) {
	return new ResponseEntity<>("Logged in from a different device",
			HttpStatus.REQUEST_TIMEOUT);
}
 
Example 3
Source File: ExceptionHandlers.java    From studio with GNU General Public License v3.0 4 votes vote down vote up
@ExceptionHandler(CmisTimeoutException.class)
@ResponseStatus(HttpStatus.REQUEST_TIMEOUT)
public ResponseBody handleCmisTimeoutException(HttpServletRequest request, CmisTimeoutException e) {
    ApiResponse response = new ApiResponse(ApiResponse.CMIS_TIMEOUT);
    return handleExceptionInternal(request, e, response);
}
 
Example 4
Source File: GlobalExceptionHandler.java    From heimdall with Apache License 2.0 3 votes vote down vote up
/**
 * Method that captures all the {@link SocketTimeoutException} exceptions.
 * 
 * @param response
 * {@link HttpServletResponse}
 * @param request
 * {@link HttpServletRequest}
 * @param exception
 * {@link Exception}
 * @return {@link ErroInfo}.
 */
@ResponseStatus(HttpStatus.REQUEST_TIMEOUT)
@ExceptionHandler(SocketTimeoutException.class)
public @ResponseBody ErroInfo handleExceptionTimeout(HttpServletResponse response, HttpServletRequest request, Exception exception) {

     TimeoutException exceptionPIER = new TimeoutException(ExceptionMessage.GLOBAL_TIMEOUT);
     ErroInfo erroInfo = new ErroInfo(LocalDateTime.now(), exceptionPIER.getMsgEnum().getHttpCode(), exceptionPIER.getClass().getSimpleName(), exceptionPIER.getMessage(), UrlUtil.getCurrentUrl(request));
     return erroInfo;

}
 
Example 5
Source File: NotificationController.java    From pacbot with Apache License 2.0 2 votes vote down vote up
/**
 * 
 * @param mailDetails
 * @return
 */
public ResponseEntity<Void> sendTextMailFallBack(final @RequestBody Map<String, Object> mailDetails) {
	return new ResponseEntity<>(HttpStatus.REQUEST_TIMEOUT);
}
 
Example 6
Source File: RequestTimeoutException.java    From sinavi-jfw with Apache License 2.0 2 votes vote down vote up
/**
 * コンストラクタです。
 * @param responseHeaders レスポンスヘッダー情報
 * @param responseBody レスポンスボディ情報
 * @param responseCharset レスポンスキャラセット
 */
public RequestTimeoutException(HttpHeaders responseHeaders, byte[] responseBody, Charset responseCharset) {
    super(HttpStatus.REQUEST_TIMEOUT, HttpStatus.REQUEST_TIMEOUT.name(), responseHeaders, responseBody, responseCharset);
}