protected void checkReservedCharacter(String value, String parameterName) throws OwsExceptionReport { if (value != null && value.contains(",")) { throw new InvalidParameterValueException(parameterName, value) .withMessage("The value '%s' contains the reserved parameter ','", value); } }
public InvalidParameterValueException(final String parameterName, final String value) { super(OwsExceptionCode.InvalidParameterValue); withMessage("The value '%s' of the parameter '%s' is invalid", value, parameterName).at(parameterName); setStatus(HTTPStatus.BAD_REQUEST); }
public InvalidParameterValueException(final String parameterName, final String value) { super(OwsExceptionCode.InvalidParameterValue); withMessage("The value '%s' of the parameter '%s' is invalid", value, parameterName).at(parameterName); setStatus(HTTPStatus.BAD_REQUEST); }
private OwsExceptionReport toOwsExceptionReport(Throwable ex) { if (ex instanceof OwsExceptionReport) { return (OwsExceptionReport) ex; } Throwable cause = ex.getCause(); if (cause instanceof OwsExceptionReport) { return (OwsExceptionReport) cause; } if (ex instanceof CompositeException) { return toOwsExceptionReport((CompositeException) ex); } if (cause instanceof CompositeException) { return toOwsExceptionReport((CompositeException) cause); } String location = null; if (ex instanceof LocationHintException) { location = ((LocationHintException) ex).getLocation().orElse(null); } else if (cause instanceof LocationHintException) { location = ((LocationHintException) cause).getLocation().orElse(null); } return new InvalidParameterValueException().withMessage(ex.getMessage()).causedBy(ex).at(location); } }
if (service.isPresent()) { throw new InvalidParameterValueException(OWSConstants.GetCapabilitiesParams.service, service.get()) .withMessage("The service '%s' is not supported.", service); } else { throw new MissingParameterValueException(OWSConstants.GetCapabilitiesParams.service) .withMessage("No decoder found for incoming message " + "based on derived decoder key: %s\nMessage: %s", key, xmlString);
protected void checkTemporalFilter(TemporalFilter temporalFilter) throws CodedException { if (temporalFilter.getTime() instanceof TimePeriod) { TimePeriod tp = (TimePeriod) temporalFilter.getTime(); if (tp.isEmpty()) { throw new InvalidParameterValueException(SosConstants.Filter.TimePeriod, tp.toString()) .withMessage("Begin/end time is missing!"); } if (tp.getStart().isEqual(tp.getEnd())) { throw new InvalidParameterValueException(SosConstants.Filter.TimePeriod, tp.toString()).withMessage( "It is not allowed that begin and end time are equal! Begin '%s' == End '%s'", tp.getStart(), tp.getEnd()); } if (tp.getStart().isAfter(tp.getEnd())) { throw new InvalidParameterValueException(SosConstants.Filter.TimePeriod, tp.toString()).withMessage( "It is not allowed that begin time is after end time! Begin '%s' > End '%s'", tp.getStart(), tp.getEnd()); } } }
/** * Parse and decode the incoming EXI encoded {@link InputStream} * * @param request * {@link HttpServletRequest} with EXI encoded * {@link InputStream} * @return {@link OwsServiceRequest} from EXI encoded {@link InputStream} * @throws OwsExceptionReport * If an error occurs during parsing */ protected OwsServiceRequest parseRequest(HttpServletRequest request) throws OwsExceptionReport { XmlObject doc = decode(request); if (LOGGER.isDebugEnabled()) { LOGGER.debug("EXI-REQUEST: {}", doc.xmlText()); } Decoder<OwsServiceRequest, XmlObject> decoder = getDecoder(CodingHelper.getDecoderKey(doc)); try { return decoder.decode(doc).setRequestContext(getRequestContext(request)); } catch (OwsDecodingException ex) { throw ex.getCause(); } catch (DecodingException ex) { throw new InvalidParameterValueException().withMessage(ex.getMessage()).causedBy(ex) .at(ex.getLocation().orElse(null)); } }
offerings.add(dataset.getOffering()); if (!daos.dataset().checkObservationType(dataset, observationType, session)) { throw new InvalidParameterValueException().withMessage( "The requested observationType (%s) is invalid for procedure = %s, observedProperty = %s and offering = %s! The valid observationType is '%s'!", observationType, observation.getDataset().getProcedure().getIdentifier(),
offerings.add(dataset.getOffering()); if (!daos.dataset().checkObservationType(dataset, observationType, session)) { throw new InvalidParameterValueException().withMessage( "The requested observationType (%s) is invalid for procedure = %s, observedProperty = %s and offering = %s! The valid observationType is '%s'!", observationType, observation.getDataset().getProcedure().getIdentifier(),
request.getService(), request.getVersion()) .contains(request.getResponseFormat())) { throw new InvalidParameterValueException().withMessage( "The requested resultType {} is not valid for the responseFormat {}!", request.getResultModel(), request.getResponseFormat());
request.getService(), request.getVersion()) .contains(request.getResponseFormat())) { throw new InvalidParameterValueException().withMessage( "The requested resultType {} is not valid for the responseFormat {}!", request.getResultModel(), request.getResponseFormat());