Spring Framework MissingServletRequestParameterException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework MissingServletRequestParameterException class.

This code example shows how to use the following methods:getMessage
    protected @ResponseBody ModelAndView handleMissingServletRequestParameter(MissingServletRequestParameterException ex, 
            HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { 
        if (request.getRequestURI().endsWith(".json")) { 
            ModelAndView modelAndView = new ModelAndView(); 
            modelAndView.addObject("status", "error"); 
            modelAndView.addObject("cause", ex.getMessage()); 
            return modelAndView; 
        } 
        return null; 
    } 
 
} 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMessage
	 * @throws IOException potentially thrown from response.sendError() 
	 */ 
	protected ModelAndView handleMissingServletRequestParameter(MissingServletRequestParameterException ex, 
			HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException { 
 
		response.sendError(HttpServletResponse.SC_BAD_REQUEST, ex.getMessage()); 
		return new ModelAndView(); 
	} 
 
	/** 
	 * Handle the case when an unrecoverable binding exception occurs - e.g. required header, required cookie. 
	 * <p>The default implementation sends an HTTP 400 error, and returns an empty {@code ModelAndView}. 
	 * Alternatively, a fallback view could be chosen, or the exception could be rethrown as-is. 
	 * @param ex the exception to be handled 
	 * @param request current HTTP request 
	 * @param response current HTTP response 
	 * @param handler the executed handler 
	 * @return an empty ModelAndView indicating the exception was handled 
	 * @throws IOException potentially thrown from response.sendError() 
	 */ 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getMessage
	@ExceptionHandler 
	@ResponseStatus(HttpStatus.BAD_REQUEST)
	@ResponseBody 
	public VndErrors onMissingServletRequestParameterException(MissingServletRequestParameterException e) {
		String logref = logDebug(e);
		return new VndErrors(logref, e.getMessage());
	} 
 
	/** 
	 * Handles the general error case. Report server-side error. 
	 */ 
	@ExceptionHandler(Exception.class)
	@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
	@ResponseBody 
	public VndErrors onException(Exception e) {
		String logref = logError(e);
		String msg = StringUtils.hasText(e.getMessage()) ? e.getMessage() : e.getClass().getSimpleName();
		return new VndErrors(logref, msg);
	} 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Spring Framework MissingServletRequestParameterException Methods: