List of usage examples for org.springframework.web.bind ServletRequestBindingException ServletRequestBindingException
public ServletRequestBindingException(String msg)
From source file:com.hmsinc.epicenter.webapp.map.StyleParameters.java
/** * @param request//from w w w.j av a 2 s.co m * @param params * @param dto * @param user */ StyleParameters(HttpServletRequest request, AnalysisParameters params, final AnalysisParametersDTO queryParams, EpiCenterUser user) throws ServletRequestBindingException { this.parameters = params; // Workaround for http://jira.codehaus.org/browse/GEOS-1872 try { this.algorithmName = codec.decode(queryParams.getAlgorithmName()); } catch (DecoderException e) { throw new ServletRequestBindingException(e.getMessage()); } this.algorithmProperties = queryParams.getAlgorithmProperties(); this.parameters.setSecondaryFilter( SpatialSecurity.isGlobalAdministrator(user) ? null : user.getVisibleRegion().getGeometry()); // If we're analyzing by facility, we need to strip out AGGREGATE_ONLY regions if (AnalysisLocation.FACILITY.equals(params.getLocation())) { for (Organization org : user.getOrganizations()) { for (AuthorizedRegion ar : org.getAuthorizedRegions()) { if (Visibility.AGGREGATE_ONLY.equals(SpatialSecurity.getVisibility(user, ar.getGeography()))) { this.parameters.setSecondaryFilter( this.parameters.getSecondaryFilter().difference(ar.getGeography().getGeometry())); } } } } double minLng = ServletRequestUtils.getRequiredDoubleParameter(request, "min_lng"); double minLat = ServletRequestUtils.getRequiredDoubleParameter(request, "min_lat"); double maxLng = ServletRequestUtils.getRequiredDoubleParameter(request, "max_lng"); double maxLat = ServletRequestUtils.getRequiredDoubleParameter(request, "max_lat"); this.geographyClass = GeographyType .valueOf(ServletRequestUtils.getRequiredStringParameter(request, "feature").toUpperCase()) .getGeoClass(); this.parameters.setFilter(new Envelope(minLng, maxLng, minLat, maxLat)); this.labelFeatures = ServletRequestUtils.getBooleanParameter(request, "labelFeatures", false); }
From source file:base.resolver.JsonModelResolver.java
protected void handleMissingValue(String paramName, MethodParameter parameter) throws ServletException { String paramType = parameter.getParameterType().getName(); throw new ServletRequestBindingException( "Missing request json parameter '" + paramName + "' for method parameter type [" + paramType + "]"); }
From source file:cn.javass.spring.mvc.method.annotation.RequestJsonParamMethodArgumentResolver.java
@Override protected void handleMissingValue(String paramName, MethodParameter parameter) throws ServletException { String paramType = parameter.getParameterType().getName(); throw new ServletRequestBindingException( "Missing request json parameter '" + paramName + "' for method parameter type [" + paramType + "]"); }
From source file:com.qq.common.WrappedController.java
protected void validate(Object bean, Class<?>... groups) throws ServletRequestBindingException { ValidatorFactory validatorFactory = Validation.buildDefaultValidatorFactory(); Validator validator = validatorFactory.getValidator(); Set<ConstraintViolation<Object>> constraintViolations = validator.validate(bean, groups); if (!constraintViolations.isEmpty()) { StringBuilder sb = new StringBuilder(); for (ConstraintViolation<Object> constraint : constraintViolations) { sb.append(String.format("%s %s\n", constraint.getPropertyPath(), constraint.getMessage())); }//from www .j a v a2 s. c om throw new ServletRequestBindingException(sb.toString()); } }
From source file:com.monarchapis.driver.spring.rest.ApiErrorResponseEntityExceptionHandlerTest.java
@Test public void testServletRequestBindingException() { performTest(// new ServletRequestBindingException("test"), // 400, // "bindingException"); }