Search in sources :

Example 1 with MissingVersionParameterException

use of org.n52.shetland.ogc.ows.exception.MissingVersionParameterException in project arctic-sea by 52North.

the class SimpleBinding method checkServiceOperatorKeyTypes.

protected void checkServiceOperatorKeyTypes(OwsServiceRequest request) throws OwsExceptionReport {
    String service = request.getService();
    String version = request.getVersion();
    if (service == null || service.isEmpty()) {
        throw new MissingServiceParameterException();
    } else if (!getServiceOperatorRepository().isServiceSupported(service)) {
        throw new InvalidServiceParameterException(service);
    } else if (request instanceof GetCapabilitiesRequest) {
        GetCapabilitiesRequest gcr = (GetCapabilitiesRequest) request;
        if (gcr.isSetAcceptVersions() && !gcr.getAcceptVersions().stream().anyMatch(v -> isVersionSupported(service, v))) {
            throw new InvalidAcceptVersionsParameterException(gcr.getAcceptVersions());
        }
    } else if (version == null || version.isEmpty()) {
        throw new MissingVersionParameterException();
    } else if (!isVersionSupported(service, version)) {
        throw new VersionNotSupportedException();
    }
}
Also used : GetCapabilitiesRequest(org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest) InvalidServiceParameterException(org.n52.iceland.exception.ows.concrete.InvalidServiceParameterException) MissingVersionParameterException(org.n52.shetland.ogc.ows.exception.MissingVersionParameterException) InvalidAcceptVersionsParameterException(org.n52.iceland.exception.ows.concrete.InvalidAcceptVersionsParameterException) VersionNotSupportedException(org.n52.iceland.exception.ows.concrete.VersionNotSupportedException) MissingServiceParameterException(org.n52.shetland.ogc.ows.exception.MissingServiceParameterException)

Aggregations

InvalidAcceptVersionsParameterException (org.n52.iceland.exception.ows.concrete.InvalidAcceptVersionsParameterException)1 InvalidServiceParameterException (org.n52.iceland.exception.ows.concrete.InvalidServiceParameterException)1 VersionNotSupportedException (org.n52.iceland.exception.ows.concrete.VersionNotSupportedException)1 MissingServiceParameterException (org.n52.shetland.ogc.ows.exception.MissingServiceParameterException)1 MissingVersionParameterException (org.n52.shetland.ogc.ows.exception.MissingVersionParameterException)1 GetCapabilitiesRequest (org.n52.shetland.ogc.ows.service.GetCapabilitiesRequest)1