public String putBlob(String container, Blob blob) { try { String name = FilenameUtils.getName(blob.getMetadata().getName()); String path = FilenameUtils.getPathNoEndSeparator(blob.getMetadata().getName()); service.uploadInputStream( blob.getPayload().getInput(), container, path, name, blob.getPayload().getContentMetadata().getContentLength()); return null; } catch (UploadException e) { e.printStackTrace(); return null; } catch (MethodNotSupportedException e) { e.printStackTrace(); return null; } catch (FileNotExistsException e) { e.printStackTrace(); return null; } }
@Override public IResourceNameIterator newResourceNameIterator( String path, Locale locale, String style, String variation, String extension, boolean strict) { Iterable<String> extensions = null; // if the resource under the geoserver or wicket namespace? if (path.startsWith("org/geoserver") || path.startsWith("org/apache/wicket")) { String ext = extension; if (ext == null) { // no extension passed in, strip it from the path ext = FilenameUtils.getExtension(path); } if (ext != null) { // we have an extension, look it up in the whitelist extensions = PREFIXES.get(ext); } } if (extensions != null) { // ensure the path doesn't contain the extension, sometimes this method is called with // extension == null, // in which case the extension is usually in the path path = FilenameUtils.getPathNoEndSeparator(path) + "/" + FilenameUtils.getBaseName(path); return new ResourceNameIterator(path, style, variation, null, extensions, false); } // couldn't optimize, just pass through to parent return super.newResourceNameIterator(path, locale, style, variation, extension, strict); }