public RevalidateTagResponse(Response delegate) { super(delegate.getBinding()); this.delegate = delegate; }
public int compare(Object o1, Object o2) { Class c1 = ((Response) o1).getBinding(); Class c2 = ((Response) o2).getBinding(); if (c1.equals(c2)) { return 0; } if (c1.isAssignableFrom(c2)) { return 1; } return -1; } });
Response response = (Response) itr.next(); Class binding = response.getBinding(); Response r2 = (Response) responses.get(1); if (r1.getBinding().equals(r2.getBinding())) { String msg = "Multiple responses: (" + result.getClass() + "): " + r1 + ", " + r2;
public ResponseWrapper(Response response, String mimeType) { super(response.getBinding(), mimeType); this.response = response; this.mimeType = mimeType; }
@Override public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { // find all the responses we could use as a source List<Response> all = GeoServerExtensions.extensions(Response.class, applicationContext); responses = new ArrayList<Response>(); for (Response response : all) { if (response.getBinding().equals(FeatureCollectionResponse.class) && response != this) { responses.add(response); } } }
/** * @return {@code "text/xml"} * @see org.geoserver.ows.Response#getMimeType(java.lang.Object, * org.geoserver.platform.Operation) */ @Override public String getMimeType(final Object value, final Operation operation) throws ServiceException { if (value.getClass().isAssignableFrom(super.getBinding())) { return mime; } throw new IllegalArgumentException( value == null ? "null" : value.getClass().getName() + "/" + operation.getId()); } }
/** * 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); }
final Class<?> webMapClass = metaTileMap.getClass(); for (Response r : extensions) { if (r.getBinding().isAssignableFrom(webMapClass) && r.canHandle(operation)) { synchronized (cachedTileEncoders) { cachedTileEncoders.put(mimeType, r);
final Class<?> webMapClass = metaTileMap.getClass(); for (Response r : extensions) { if (r.getBinding().isAssignableFrom(webMapClass) && r.canHandle(operation)) { synchronized (cachedTileEncoders) { cachedTileEncoders.put(mimeType, r);