@Override public String getMimeType(Object value, Operation operation) throws ServiceException { GetMapRequest request = (GetMapRequest) operation.getParameters()[0]; if (request.getFormat().contains("8")) { return MIME_TYPE_8BIT; } else { return MIME_TYPE; } }
params.put("version", "1.1.1"); params.put("format", req.getFormat());
this.extendedDataEnabled = computeExtendedDataEnabled(); this.kmScore = computeKmScore(); this.networkLinksFormat = KMLMapOutputFormat.NL_KML_MIME_TYPE.equals(request.getFormat()) || KMZMapOutputFormat.NL_KMZ_MIME_TYPE.equals(request.getFormat()); this.kmz = kmz; this.service = wms.getServiceInfo();
/** * 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; }
} else if (!Arrays.asList(KMZMapOutputFormat.OUTPUT_FORMATS).contains(request.getFormat())) { request.setFormat(KMLMapOutputFormat.MIME_TYPE);
public static GetMapRequest autoSetMissingProperties(GetMapRequest getMap) { // set the defaults if (getMap.getFormat() == null) { getMap.setFormat(FORMAT); } if ((getMap.getStyles() == null) || getMap.getStyles().isEmpty()) { // set styles to be the defaults for the specified layers // TODO: should this be part of core WMS logic? is so lets throw // this // into the GetMapKvpRequestReader if ((getMap.getLayers() != null) && (getMap.getLayers().size() > 0)) { ArrayList<Style> styles = new ArrayList<Style>(getMap.getLayers().size()); for (int i = 0; i < getMap.getLayers().size(); i++) { styles.add(getMap.getLayers().get(i).getDefaultStyle()); } getMap.setStyles(styles); } else { getMap.setStyles(STYLES); } } // auto-magic missing info configuration autoSetBoundsAndSize(getMap); return getMap; }
if (NetworkLinkMapOutputFormat.KML_MIME_TYPE.equals(request.getFormat())) { request.setFormat(KMLMapOutputFormat.MIME_TYPE); } else {
mimeType = MimeType.createFromFormat(request.getFormat()); List<MimeType> tileLayerFormats = tileLayer.getMimeTypes(); if (!tileLayerFormats.contains(mimeType)) {
final String format = mapContent.getRequest().getFormat(); boolean animatedGIF = false; if (format.equalsIgnoreCase(IMAGE_GIF_SUBTYPE_ANIMATED)) {
final String format = request.getFormat().split(";")[0];
mimeType = MimeType.createFromFormat(request.getFormat()); List<MimeType> tileLayerFormats = tileLayer.getMimeTypes(); if (!tileLayerFormats.contains(mimeType)) {
if (request.getFormat() == null) { throw new ServiceException("No output map format requested", "InvalidFormat");
if (request.getFormat() == null) { request.setFormat(GIF_ANIMATED_FORMAT);
@Override public RenderedImage call() throws Exception { org.geoserver.wms.WebMap wmsResponse; // Making a shallow copy of the original request and replacing param's values GetMapRequest frameRequest = replaceRequestParams(this.request, this.aparam, this.avalue); // set rest of the wms defaults frameRequest = DefaultWebMapService.autoSetMissingProperties(frameRequest); // Setup Frame OUTputFormat String outFormat = frameRequest.getFormat(); // the capabilities of this produce are actually linked to the map response that is going to // be used, this class just generates a rendered image final Collection<RenderedImageMapResponse> responses = this.wmsConfiguration.getAvailableMapResponses(); for (RenderedImageMapResponse response : responses) { if (response.getOutputFormats().contains(outFormat)) { MapProducerCapabilities cap = response.getCapabilities(outFormat); if (cap != null && cap.getFramesMimeType() != null) { frameRequest.setFormat(cap.getFramesMimeType()); } else { frameRequest.setFormat(GIF_FORMAT); } } } wmsResponse = this.wms.getMap(frameRequest); return ((RenderedImageMap) wmsResponse).getImage(); }
assertEquals(expected, style); assertEquals("image/jpeg", request.getFormat()); assertEquals(600, request.getHeight()); assertEquals(800, request.getWidth());
String srs = request.getSRS(); Envelope bbox = request.getBbox(); String format = request.getFormat(); int width = request.getWidth(); int height = request.getHeight();
String srs = request.getSRS(); Envelope bbox = request.getBbox(); String format = request.getFormat(); int width = request.getWidth(); int height = request.getHeight();
String srs = request.getSRS(); Envelope bbox = request.getBbox(); String format = request.getFormat(); int width = request.getWidth(); int height = request.getHeight();