public RevalidateTagResponse(Response delegate) { super(delegate.getBinding()); this.delegate = delegate; }
public boolean canHandle(Operation operation) { return delegate.canHandle(operation); }
public String getMimeType(Object value, Operation operation) throws ServiceException { return delegate.getMimeType(value, operation); }
Response response = (Response) itr.next(); Class binding = response.getBinding(); || !response.canHandle(opDescriptor)) { itr.remove(); Set outputFormats = response.getOutputFormats(); Response r2 = (Response) responses.get(1); if (r1.getBinding().equals(r2.getBinding())) { String msg = "Multiple responses: (" + result.getClass() + "): " + r1 + ", " + r2; String mimeType = response.getMimeType(result, opDescriptor); String charset = response.getCharset(opDescriptor); if (charset != null) { req.getHttpResponse().setCharacterEncoding(charset); response.write(result, output, opDescriptor);
final Class<?> webMapClass = metaTileMap.getClass(); for (Response r : extensions) { if (r.getBinding().isAssignableFrom(webMapClass) && r.canHandle(operation)) { synchronized (cachedTileEncoders) { cachedTileEncoders.put(mimeType, r);
void setHeaders(Request req, Operation opDescriptor, Object result, Response response) { String disposition = response.getPreferredDisposition(result, opDescriptor); String filename = response.getAttachmentFileName(result, opDescriptor); String[][] headers = response.getHeaders(result, opDescriptor); boolean contentDispositionProvided = false; if (headers != null) {
/** * Returns a selection of supported formats for a given response object * * <p>TODO: this should be moved in a more central place, as it's of general utility (maybe the * filtering part could be made customizable via a lambda) * * @return A list of MIME types */ public static List<String> getAvailableFormats(Class responseType) { Set<String> formatNames = new LinkedHashSet<>(); Collection responses = GeoServerExtensions.extensions(Response.class); for (Iterator i = responses.iterator(); i.hasNext(); ) { Response format = (Response) i.next(); if (!responseType.isAssignableFrom(format.getBinding())) { continue; } // TODO: get better collaboration from content Set<String> formats = format.getOutputFormats(); if (formats.isEmpty()) { continue; } // try to get a MIME type, otherwise pick the first available formats.stream().filter(f -> f.contains("/")).forEach(f -> formatNames.add(f)); } return new ArrayList<>(formatNames); }
private Response findSourceResponse(Operation sourceOperation, TransformInfo info) { for (Response r : responses) { if (r.getOutputFormats().contains(info.getSourceFormat()) && r.canHandle(sourceOperation)) { return r; } } return null; }
public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { delegate.write(value, output, operation); }
public String getCharset(Operation operation) { return delegate.getCharset(operation); } }
public String getPreferredDisposition(Object value, Operation operation) { return delegate.getPreferredDisposition(value, operation); }
public String getAttachmentFileName(Object value, Operation operation) { return delegate.getAttachmentFileName(value, operation); }
/** * See if we have to add cache control headers. Won't alter them if the response already set * them. */ public String[][] getHeaders(Object value, Operation operation) throws ServiceException { String[][] headers = delegate.getHeaders(value, operation); if (headers == null) { // if no headers at all, add and exit return new String[][] {{HttpHeaders.CACHE_CONTROL, "max-age=0, must-revalidate"}}; } else { // will add only if not already there Map<String, String> map = (Map) ArrayUtils.toMap(headers); map.putIfAbsent(HttpHeaders.CACHE_CONTROL, "max-age=0, must-revalidate"); headers = new String[map.size()][2]; int i = 0; for (Map.Entry<String, String> entry : map.entrySet()) { headers[i][0] = entry.getKey(); headers[i][1] = entry.getValue(); i++; } } return headers; }
public VersionedXmlSchemaEncoder(XmlSchemaEncoder delegate) { super(VersionedDescribeResults.class, delegate.getOutputFormats()); this.delegate = delegate; }
final Class<?> webMapClass = metaTileMap.getClass(); for (Response r : extensions) { if (r.getBinding().isAssignableFrom(webMapClass) && r.canHandle(operation)) { synchronized (cachedTileEncoders) { cachedTileEncoders.put(mimeType, r);
@Override public void write(Object value, OutputStream output, Operation operation) throws IOException, ServiceException { response.write(value, output, operation); }
@Override public String getCharset(Operation operation) { return response.getCharset(operation); } }
@Override public String getPreferredDisposition(Object value, Operation operation) { return response.getPreferredDisposition(value, operation); }
@Override public String getAttachmentFileName(Object value, Operation operation) { return response.getAttachmentFileName(value, operation); }
@Override public String[][] getHeaders(Object value, Operation operation) throws ServiceException { return response.getHeaders(value, operation); }