/** * Allows the delegate to specify the output format given the object to encode and the * * @param value * @param coverageId * @param format * @return */ default String getFileName(GridCoverage2D value, String coverageId, String format) { return coverageId + "." + getFileExtension(format); } }
@Override public String getAttachmentFileName(Object value, Operation operation) { // grab the format GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0]; String format = getCoverage.getFormat(); if (format == null) { format = "image/tiff"; } // grab the delegate and thus the extension CoverageResponseDelegate delegate = responseFactory.encoderFor(format); // collect the name of the coverages that have been requested String extension = delegate.getFileExtension(format); return delegate.getFileName((GridCoverage2D) value, getCoverage.getCoverageId(), format); } }
@Override public String getAttachmentFileName(Object value, Operation operation) { if (!(operation.getParameters()[0] instanceof GetCoverageType)) throw new WcsException( "Cannot handle object of type: " + operation.getParameters()[0].getClass()); GetCoverageType getCoverage = (GetCoverageType) operation.getParameters()[0]; String outputFormat = getCoverage.getOutput().getFormat().getValue(); CoverageResponseDelegate delegate = getResponseDelegate(outputFormat); return getCoverage.getSourceCoverage() + "." + delegate.getFileExtension(outputFormat); }
+ getCoverage.getCoverageId() + "." + delegate.getFileExtension(format);
+ System.nanoTime() + "." + delegate.getFileExtension(outputFormat)); if (!Resources.exists(coverageFile)) break;