protected AbstractMapResponse( final Class<? extends WebMap> responseBinding, Set<String> outputFormats) { // Call Response superclass constructor with the kind of request we can handle // Make sure the output format comparison in canHandle is case insensitive super(responseBinding, caseInsensitiveOutputFormats(outputFormats)); }
/** * Evaluates whether this response can handle the given operation by checking if the operation's * request is a {@link GetMapRequest} and the requested output format is contained in {@link * #getOutputFormatNames()}. * * <p>NOTE: requested MIME Types may come with parameters, like, for example: {@code * image/png;param1=value1}. This default canHandle implementation performs and exact match * check against the requested and supported format names. Subclasses may feel free to override * if needed. * * @see org.geoserver.ows.Response#canHandle(org.geoserver.platform.Operation) */ @Override public boolean canHandle(final Operation operation) { GetMapRequest request; Object[] parameters = operation.getParameters(); request = (GetMapRequest) OwsUtils.parameter(parameters, GetMapRequest.class); if (request == null) { return false; } Set<String> outputFormats = getOutputFormats(); if (outputFormats.size() == 0) { // rely only on response binding return true; } String outputFormat = request.getFormat(); boolean match = outputFormats.contains(outputFormat); return match; }