@ExceptionHandler(value = { Exception.class, NullPointerException.class, NoSuchRequestHandlingMethodException.class, RuntimeException.class, ResourceAccessException.class, AccessDeniedException.class, PropertyNotFoundException.class, ConstraintViolationException.class, NestedServletException.class} ) // Don't pass model object here. Seriously was creating issues here. public ModelAndView globalErrorHandler(HttpServletRequest request, Exception e) { System.out.println("comes in exception controller"); ModelAndView mdlViewObj = new ModelAndView("/common/Exception"); logger.error(e.getStackTrace()); return mdlViewObj; //return new ModelAndView("common/Exception"); // Error java.lang.IllegalStateException: No suitable resolver for argument [0] [type=org.springframework.ui.ModelMap] }
@ModelAttribute("dataset") public Dataset getDataset (final @PathVariable("datasetId") long datasetId, final Principal principal, final HttpServletRequest request) throws NoSuchRequestHandlingMethodException, UnauthorizedException { final Dataset dataset = managerDao.getDataSet (datasetId); if (dataset == null) { throw new NoSuchRequestHandlingMethodException (request); } // Check whether the current user has access to the dataset: final Bronhouder bronhouder = dataset.getBronhouder (); final Thema thema = dataset.getDatasetType ().getThema (); final Gebruiker gebruiker = managerDao.getGebruiker (principal.getName ()); final Set<BronhouderThema> authorizedThemas = new HashSet<BronhouderThema> (); final BronhouderThema bronhouderThema = managerDao.getBronhouderThema (bronhouder, thema); for (final GebruikerThemaAutorisatie gta: managerDao.getGebruikerThemaAutorisatie (gebruiker)) { authorizedThemas.add (gta.getBronhouderThema ()); } if (!gebruiker.isSuperuser () && (bronhouderThema == null || !authorizedThemas.contains (bronhouderThema))) { throw new UnauthorizedException (String.format ("Not authorized for dataset %d", datasetId)); } return dataset; }
@Test public void getErrorPageRejectsDirectRequests() throws Exception { // Arrange ErrorPageController target = new ErrorPageController(); Model model = mock(Model.class); HttpServletRequest request = mock(HttpServletRequest.class); when(request.getMethod()).thenReturn("GET"); when(request.getParameterMap()).thenReturn(new HashMap<String, String[]>()); when(request.getContextPath()).thenReturn("/publicsite"); when(request.getRequestURI()).thenReturn("/publicsite/error"); when(request.getAttribute(RequestDispatcher.FORWARD_REQUEST_URI)).thenReturn(null); HttpServletResponse response = mock(HttpServletResponse.class); when(response.getStatus()).thenReturn(0); // Act catchException(target).getErrorPage(model, request, response); // Assert assertThat(caughtException()).isInstanceOf(NoSuchRequestHandlingMethodException.class); }
/** * 404错误 */ @ResponseBody @ExceptionHandler({ NoSuchRequestHandlingMethodException.class }) public ResultResponse noSuchRequestHandlingMethodExceptionHandler(NoSuchRequestHandlingMethodException ex) { logger.error(ResultMessage.F4040.getMessage(), ex); return resultResponse.failure(ResultMessage.F4040); }
@Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { if (ex instanceof NotFoundException) { LOG.error("Requested resource was not found for URI={} method={} message={}", request.getRequestURI(), request.getMethod(), ex.getMessage()); return null; } else if (ex instanceof NoSuchRequestHandlingMethodException || ex instanceof HttpRequestMethodNotSupportedException) { LOG.error("Handler method not found for URI={} method={}", request.getRequestURI(), request.getMethod()); return null; } final ResponseStatus responseStatus = AnnotationUtils.findAnnotation(ex.getClass(), ResponseStatus.class); if (responseStatus != null) { LOG.error("Caught exception with @ResponseStatus {} with message {} for handler {}", ex.getClass().getSimpleName(), ex.getMessage(), getHandlerName(handler)); } else { LOG.error("Handler execution resulted in exception", Throwables.getRootCause(ex)); } return null; }
@Test public void handleNoSuchRequestHandlingMethod() { NoSuchRequestHandlingMethodException ex = new NoSuchRequestHandlingMethodException(request); ModelAndView mav = exceptionResolver.resolveException(request, response, null, ex); assertNotNull("No ModelAndView returned", mav); assertTrue("No Empty ModelAndView returned", mav.isEmpty()); assertEquals("Invalid status code", 404, response.getStatus()); }
/** * 页面找不到404 * @param request * @param e * @return */ @ExceptionHandler({NoSuchRequestHandlingMethodException.class}) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody public JsonResponse noSuchRequestHandlingMethod(HttpServletRequest request, Exception e) { log.error(request.getRequestURI()); Exceptions.printException(e); JsonResponse response = new JsonResponse(); response.setMessage("请求的资源不存在!"); response.setResponseid(0); return response; }
@Override protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod( NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, WebRequest request ) { headers.add( "Content-Type", MediaType.APPLICATION_JSON_VALUE ); return new ResponseEntity<>( MessageUtils.jsonMessage( Integer.toString( status.value() ), ex.getMessage() ), status ); }
@ExceptionHandler({ NoSuchRequestHandlingMethodException.class, ConversionNotSupportedException.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) public String handleResourceNotFound(ModelMap model) { model.put("advancedSearchData", new SearchData()); return "resourceNotFound"; }
@RequestMapping(method = RequestMethod.DELETE, path = "/greeting/{id}") public void delete(@PathVariable Integer id) throws NoSuchRequestHandlingMethodException { try { data.removeGreeting(id); } catch (IndexOutOfBoundsException e) { throw new NoSuchRequestHandlingMethodException("greeting", GreetingController.class); } }
@RequestMapping(method = RequestMethod.PUT, path = "/greeting/{id}") public Greeting add(@PathVariable Integer id, @RequestBody Greeting greeting) throws NoSuchRequestHandlingMethodException { try { return data.updateGreeting(id, greeting); } catch (IndexOutOfBoundsException e) { throw new NoSuchRequestHandlingMethodException("greeting", GreetingController.class); } }
/** * 将spring中的http状态和异常互相对应 参考 spring的defaultExceptionHandler实现类似 * * @return */ private final Map<String, String> createDefaultExceptionMappingDefinitions() { Map<String, String> m = new LinkedHashMap<String, String>(); // 400 applyDef(m, HttpMessageNotReadableException.class, HttpStatus.BAD_REQUEST); applyDef(m, MissingServletRequestParameterException.class, HttpStatus.BAD_REQUEST); applyDef(m, TypeMismatchException.class, HttpStatus.BAD_REQUEST); applyDef(m, "javax.validation.ValidationException", HttpStatus.BAD_REQUEST); // 404 applyDef(m, NoSuchRequestHandlingMethodException.class, HttpStatus.NOT_FOUND); applyDef(m, "org.hibernate.ObjectNotFoundException", HttpStatus.NOT_FOUND); // 405 applyDef(m, HttpRequestMethodNotSupportedException.class, HttpStatus.METHOD_NOT_ALLOWED); // 406 applyDef(m, HttpMediaTypeNotAcceptableException.class, HttpStatus.NOT_ACCEPTABLE); // 409 applyDef(m, "org.springframework.dao.DataIntegrityViolationException", HttpStatus.CONFLICT); // 415 applyDef(m, HttpMediaTypeNotSupportedException.class, HttpStatus.UNSUPPORTED_MEDIA_TYPE); return m; }
/** * {@link NoSuchRequestHandlingMethodException}をハンドリングします。 * @param e {@link NoSuchRequestHandlingMethodException} * @return {@link ErrorMessage} * HTTPステータス 404 でレスポンスを返却します。 */ @ExceptionHandler(NoSuchRequestHandlingMethodException.class) @ResponseBody @ResponseStatus(value = HttpStatus.NOT_FOUND) @Override public ErrorMessage handle(NoSuchRequestHandlingMethodException e) { if (L.isDebugEnabled()) { L.debug(R.getString("D-SPRINGMVC-REST-HANDLER#0001"), e); } ErrorMessage error = createClientErrorMessage(HttpStatus.NOT_FOUND); warn(error, e); return error; }
@Test public void NoSuchRequestHandlingMethodExceptionをハンドリングできる() { NoSuchRequestHandlingMethodException ex = new NoSuchRequestHandlingMethodException("", "", null); ErrorMessage message = this.exceptionHandlerSupport.handle(ex); assertThat(message, notNullValue()); assertThat(message.getStatus(), is(404)); assertThat(message.getMessage(), is("リソースが見つかりません。")); }
/** * Show the error page. * @param model The page template model. * @param request The HTTP request (this is a second request caused by the internal redirection of error pages). * @param response The HTTP response. * @return The page template name. * @throws NoSuchRequestHandlingMethodException 404 if the hit on this RequestMapping is caused by somebody viewing * "/error" instead of by the internal redirect. */ @RequestMapping(value = "/error") public String getErrorPage(Model model, HttpServletRequest request, HttpServletResponse response) throws NoSuchRequestHandlingMethodException { int status = response.getStatus(); preventExternalRequests(request, status); String originalUri = getOriginalServletPath(request); LOGGER.warn(String.format("Showing error page due to %s accessing '%s'.", status, originalUri)); model.addAttribute("status", status); model.addAttribute("uri", originalUri); return "error"; }
private void preventExternalRequests(HttpServletRequest request, int status) throws NoSuchRequestHandlingMethodException { if (status == 0) { // This request mapping is for internal error access (via web.xml <errorpage>) only. If we get a normal hit // on it, throw a 404 (which will end up back here via DefaultHandlerExceptionResolver). throw new NoSuchRequestHandlingMethodException(request); } }
private Map<Class, RestExceptionHandler> getDefaultHandlers() { Map<Class, RestExceptionHandler> map = new HashMap<>(); map.put( NoSuchRequestHandlingMethodException.class, new NoSuchRequestHandlingMethodExceptionHandler() ); map.put( HttpRequestMethodNotSupportedException.class, new HttpRequestMethodNotSupportedExceptionHandler() ); map.put( HttpMediaTypeNotSupportedException.class, new HttpMediaTypeNotSupportedExceptionHandler() ); map.put( MethodArgumentNotValidException.class, new MethodArgumentNotValidExceptionHandler() ); if (ClassUtils.isPresent("javax.validation.ConstraintViolationException", getClass().getClassLoader())) { map.put( ConstraintViolationException.class, new ConstraintViolationExceptionHandler() ); } addHandlerTo( map, HttpMediaTypeNotAcceptableException.class, NOT_ACCEPTABLE ); addHandlerTo( map, MissingServletRequestParameterException.class, BAD_REQUEST ); addHandlerTo( map, ServletRequestBindingException.class, BAD_REQUEST ); addHandlerTo( map, ConversionNotSupportedException.class, INTERNAL_SERVER_ERROR ); addHandlerTo( map, TypeMismatchException.class, BAD_REQUEST ); addHandlerTo( map, HttpMessageNotReadableException.class, UNPROCESSABLE_ENTITY ); addHandlerTo( map, HttpMessageNotWritableException.class, INTERNAL_SERVER_ERROR ); addHandlerTo( map, MissingServletRequestPartException.class, BAD_REQUEST ); addHandlerTo(map, Exception.class, INTERNAL_SERVER_ERROR); // this class didn't exist before Spring 4.0 try { Class clazz = Class.forName("org.springframework.web.servlet.NoHandlerFoundException"); addHandlerTo(map, clazz, NOT_FOUND); } catch (ClassNotFoundException ex) { // ignore } return map; }
@RequestMapping(method = RequestMethod.POST) public String handleRequest(HttpServletRequest request, HttpServletResponse response, Model model) throws XProcException, IOException, URISyntaxException, TransformerException, NoSuchRequestHandlingMethodException { try { // check the white list to see if we want to talk to the counter-party logger.info("If we got this far, the Spring Security whitelist checking has already passed OK..."); SecurityContext ssc = SecurityContextHolder.getContext(); String ridPeerName = ssc.getAuthentication().getName().toString(); if (ridPeerName != null) { logger.info("RID Peer Name is: " + ridPeerName); if (!whiteList.contains(ridPeerName)) { logger.info("RID Peer name not found in whitelist."); logger.info("Edit RIDSystem-servlet.xml if and as appropriate, in order to authorize this peer."); throw new NoSuchRequestHandlingMethodException(request); // results in a 404 Not Found. } logger.info("Local whitelist Checking completed."); logger.info("Incoming WatchList. "+request.getInputStream().toString()); } PipelineInputCache pi = new PipelineInputCache(); // supply HTTP body as the source for the resource Create pipeline pi.setInputPort("source", request.getInputStream()); PipelineOutput output = m_requestHandler.executeOn(pi); model.addAttribute("pipelineOutput", output); return "pipelineOutput"; } finally { ; //TODO add finally handler } }
@Override protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { try { if (ex instanceof NoSuchRequestHandlingMethodException) { return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, request, response, handler); } else if (ex instanceof HttpRequestMethodNotSupportedException) { return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException) ex, request, response, handler); } else if (ex instanceof HttpMediaTypeNotSupportedException) { return handleHttpMediaTypeNotSupported((HttpMediaTypeNotSupportedException) ex, request, response, handler); } else if (ex instanceof HttpMediaTypeNotAcceptableException) { return handleHttpMediaTypeNotAcceptable((HttpMediaTypeNotAcceptableException) ex, request, response, handler); } else if (ex instanceof MissingPathVariableException) { return handleMissingPathVariable((MissingPathVariableException) ex, request, response, handler); } else if (ex instanceof MissingServletRequestParameterException) { return handleMissingServletRequestParameter((MissingServletRequestParameterException) ex, request, response, handler); } else if (ex instanceof ServletRequestBindingException) { return handleServletRequestBindingException((ServletRequestBindingException) ex, request, response, handler); } else if (ex instanceof ConversionNotSupportedException) { return handleConversionNotSupported((ConversionNotSupportedException) ex, request, response, handler); } else if (ex instanceof TypeMismatchException) { return handleTypeMismatch((TypeMismatchException) ex, request, response, handler); } else if (ex instanceof HttpMessageNotReadableException) { return handleHttpMessageNotReadable((HttpMessageNotReadableException) ex, request, response, handler); } else if (ex instanceof HttpMessageNotWritableException) { return handleHttpMessageNotWritable((HttpMessageNotWritableException) ex, request, response, handler); } else if (ex instanceof MethodArgumentNotValidException) { return handleMethodArgumentNotValidException((MethodArgumentNotValidException) ex, request, response, handler); } else if (ex instanceof MissingServletRequestPartException) { return handleMissingServletRequestPartException((MissingServletRequestPartException) ex, request, response, handler); } else if (ex instanceof BindException) { return handleBindException((BindException) ex, request, response, handler); } else if (ex instanceof NoHandlerFoundException) { return handleNoHandlerFoundException((NoHandlerFoundException) ex, request, response, handler); } } catch (Exception handlerException) { if (logger.isWarnEnabled()) { logger.warn("Handling of [" + ex.getClass().getName() + "] resulted in Exception", handlerException); } } return null; }
@Test public void noSuchRequestHandlingMethod() { Exception ex = new NoSuchRequestHandlingMethodException("GET", TestController.class); testException(ex); }
@ExceptionHandler({NoSuchRequestHandlingMethodException.class, HttpRequestMethodNotSupportedException.class, HttpMediaTypeNotSupportedException.class, HttpMediaTypeNotAcceptableException.class, MissingServletRequestParameterException.class, ServletRequestBindingException.class, ConversionNotSupportedException.class, TypeMismatchException.class, HttpMessageNotReadableException.class, HttpMessageNotWritableException.class, MethodArgumentNotValidException.class, MissingServletRequestPartException.class, BindException.class, NoHandlerFoundException.class}) public final ResponseEntity<Object> handleException(Exception ex, HttpServletRequest request) { HttpHeaders headers = new HttpHeaders(); HttpStatus status; if(ex instanceof NoSuchRequestHandlingMethodException) { status = HttpStatus.NOT_FOUND; return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException)ex, headers, status, request); } else if(ex instanceof HttpRequestMethodNotSupportedException) { status = HttpStatus.METHOD_NOT_ALLOWED; return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException)ex, headers, status, request); } else if(ex instanceof HttpMediaTypeNotSupportedException) { status = HttpStatus.UNSUPPORTED_MEDIA_TYPE; return handleHttpMediaTypeNotSupported((HttpMediaTypeNotSupportedException)ex, headers, status, request); } else if(ex instanceof HttpMediaTypeNotAcceptableException) { status = HttpStatus.NOT_ACCEPTABLE; return handleHttpMediaTypeNotAcceptable((HttpMediaTypeNotAcceptableException)ex, headers, status, request); } else if(ex instanceof MissingServletRequestParameterException) { status = HttpStatus.BAD_REQUEST; return handleMissingServletRequestParameter((MissingServletRequestParameterException)ex, headers, status, request); } else if(ex instanceof ServletRequestBindingException) { status = HttpStatus.BAD_REQUEST; return handleServletRequestBindingException((ServletRequestBindingException)ex, headers, status, request); } else if(ex instanceof ConversionNotSupportedException) { status = HttpStatus.INTERNAL_SERVER_ERROR; return handleConversionNotSupported((ConversionNotSupportedException)ex, headers, status, request); } else if(ex instanceof TypeMismatchException) { status = HttpStatus.BAD_REQUEST; return handleTypeMismatch((TypeMismatchException)ex, headers, status, request); } else if(ex instanceof HttpMessageNotReadableException) { status = HttpStatus.BAD_REQUEST; return handleHttpMessageNotReadable((HttpMessageNotReadableException)ex, headers, status, request); } else if(ex instanceof HttpMessageNotWritableException) { status = HttpStatus.INTERNAL_SERVER_ERROR; return handleHttpMessageNotWritable((HttpMessageNotWritableException)ex, headers, status, request); } else if(ex instanceof MethodArgumentNotValidException) { status = HttpStatus.BAD_REQUEST; return handleMethodArgumentNotValid((MethodArgumentNotValidException)ex, headers, status, request); } else if(ex instanceof MissingServletRequestPartException) { status = HttpStatus.BAD_REQUEST; return handleMissingServletRequestPart((MissingServletRequestPartException)ex, headers, status, request); } else if(ex instanceof BindException) { status = HttpStatus.BAD_REQUEST; return handleBindingResult(((BindException) ex).getBindingResult(), (BindException)ex, null, headers, status, request); } else if(ex instanceof NoHandlerFoundException) { status = HttpStatus.NOT_FOUND; return handleNoHandlerFoundException((NoHandlerFoundException)ex, headers, status, request); } else { logger.warn("Unknown exception type: " + ex.getClass().getName()); status = HttpStatus.INTERNAL_SERVER_ERROR; return handleExceptionInternal(ex, (Object)null, headers, status, request); } }
protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, HttpServletRequest request) { pageNotFoundLogger.warn(ex.getMessage()); return handleExceptionInternal(ex, (Object) null, headers, status, request); }
@ExceptionHandler({NoSuchRequestHandlingMethodException.class}) @ResponseStatus(NOT_ACCEPTABLE) public void handleMediaTypeNotAcceptable() { }
@Override protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { super.handleNoSuchRequestHandlingMethod(ex, request, response, handler); return contentNegotiatingModelAndView(createErrorResponse(request, HttpServletResponse.SC_NOT_FOUND, ex)); }
@ExceptionHandler({ NoSuchRequestHandlingMethodException.class, ConversionNotSupportedException.class }) @ResponseStatus(value = HttpStatus.NOT_FOUND) public String handleResourceNotFound() { return "resourceNotFound"; }
@ExceptionHandler({NoSuchRequestHandlingMethodException.class, ConversionNotSupportedException.class}) @ResponseStatus(value = HttpStatus.NOT_FOUND) public String handleResourceNotFound(){ return "resourceNotFound"; }
@Override protected ModelAndView doResolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) { try { if (ex instanceof NoSuchRequestHandlingMethodException) { return handleNoSuchRequestHandlingMethod((NoSuchRequestHandlingMethodException) ex, request, response, handler); } else if (ex instanceof HttpRequestMethodNotSupportedException) { return handleHttpRequestMethodNotSupported((HttpRequestMethodNotSupportedException) ex, request, response, handler); } else if (ex instanceof HttpMediaTypeNotSupportedException) { return handleHttpMediaTypeNotSupported((HttpMediaTypeNotSupportedException) ex, request, response, handler); } else if (ex instanceof HttpMediaTypeNotAcceptableException) { return handleHttpMediaTypeNotAcceptable((HttpMediaTypeNotAcceptableException) ex, request, response, handler); } else if (ex instanceof MissingServletRequestParameterException) { return handleMissingServletRequestParameter((MissingServletRequestParameterException) ex, request, response, handler); } else if (ex instanceof ServletRequestBindingException) { return handleServletRequestBindingException((ServletRequestBindingException) ex, request, response, handler); } else if (ex instanceof ConversionNotSupportedException) { return handleConversionNotSupported((ConversionNotSupportedException) ex, request, response, handler); } else if (ex instanceof TypeMismatchException) { return handleTypeMismatch((TypeMismatchException) ex, request, response, handler); } else if (ex instanceof HttpMessageNotReadableException) { return handleHttpMessageNotReadable((HttpMessageNotReadableException) ex, request, response, handler); } else if (ex instanceof HttpMessageNotWritableException) { return handleHttpMessageNotWritable((HttpMessageNotWritableException) ex, request, response, handler); } else if (ex instanceof MethodArgumentNotValidException) { return handleMethodArgumentNotValidException((MethodArgumentNotValidException) ex, request, response, handler); } else if (ex instanceof MissingServletRequestPartException) { return handleMissingServletRequestPartException((MissingServletRequestPartException) ex, request, response, handler); } else if (ex instanceof BindException) { return handleBindException((BindException) ex, request, response, handler); } } catch (Exception handlerException) { logger.warn("Handling of [" + ex.getClass().getName() + "] resulted in Exception", handlerException); } return null; }
@Override public ResponseEntity<ErrorMessage> handleException(NoSuchRequestHandlingMethodException ex, HttpServletRequest req) { LOG.warn(ex.getMessage()); return super.handleException(ex, req); }
/** * Handle the case where no request handler method was found. * <p>The default implementation logs a warning, sends an HTTP 404 error, and returns * an empty {@code ModelAndView}. Alternatively, a fallback view could be chosen, * or the NoSuchRequestHandlingMethodException could be rethrown as-is. * @param ex the NoSuchRequestHandlingMethodException to be handled * @param request current HTTP request * @param response current HTTP response * @param handler the executed handler, or {@code null} if none chosen * at the time of the exception (for example, if multipart resolution failed) * @return an empty ModelAndView indicating the exception was handled * @throws IOException potentially thrown from response.sendError() */ protected ModelAndView handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { pageNotFoundLogger.warn(ex.getMessage()); response.sendError(HttpServletResponse.SC_NOT_FOUND); return new ModelAndView(); }
/** * Customize the response for NoSuchRequestHandlingMethodException. * <p>This method logs a warning and delegates to {@link #handleExceptionInternal}. * @param ex the exception * @param headers the headers to be written to the response * @param status the selected response status * @param request the current request * @return a {@code ResponseEntity} instance */ protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { pageNotFoundLogger.warn(ex.getMessage()); return handleExceptionInternal(ex, null, headers, status, request); }
/** * Customize the response for NoSuchRequestHandlingMethodException. * This method logs a warning and delegates to * {@link #handleExceptionInternal(Exception, Object, HttpHeaders, HttpStatus, WebRequest)}. * @param ex the exception * @param headers the headers to be written to the response * @param status the selected response status * @param request the current request * @return a {@code ResponseEntity} instance */ protected ResponseEntity<Object> handleNoSuchRequestHandlingMethod(NoSuchRequestHandlingMethodException ex, HttpHeaders headers, HttpStatus status, WebRequest request) { pageNotFoundLogger.warn(ex.getMessage()); return handleExceptionInternal(ex, null, headers, status, request); }
/** * {@link NoSuchRequestHandlingMethodException}をハンドリングします。 * @param e {@link NoSuchRequestHandlingMethodException} * @return 任意の型 */ T handle(NoSuchRequestHandlingMethodException e);