/** {@inheritDoc} */ protected String getMetadataIdentifier() { return metadataResource.getLocation(); }
/** {@inheritDoc} */ public String getLocation() { return super.getLocation(); }
/** {@inheritDoc} */ public String toString() { return getLocation(); }
/** {@inheritDoc} */ public InputStream getInputStream() throws ResourceException { GetMethod getMethod = getResource(); try { return new ConnectionClosingInputStream(getMethod, applyFilter(getMethod.getResponseBodyAsStream())); } catch (IOException e) { throw new ResourceException("Unable to read response", e); } }
@Override public InputStream getInputStream() throws ResourceException { try { return springDelegate.getInputStream(); } catch (IOException e) { throw new ResourceException(e); } }
/** {@inheritDoc} */ public DateTime getLastModifiedTime() throws ResourceException { try { return super.getLastModifiedTime(); } catch (ResourceException e) { log.warn("HTTP resource '{}' was inaccessible for getLastModifiedTime(), trying backing file '{}'", getLocation(), resourceFile.getAbsolutePath()); long lastModifiedTime = resourceFile.lastModified(); if (lastModifiedTime == 0) { throw new ResourceException("URL resource is not reachable and backing file is not readable"); } return new DateTime(lastModifiedTime, ISOChronology.getInstanceUTC()); } }
/** {@inheritDoc} */ public InputStream getInputStream() throws ResourceException { try { InputStream ins = resource.openStream(); return applyFilter(ins); } catch (IOException e) { throw new ResourceException("Unable to open resource: " + resource); } }
/** {@inheritDoc} */ public InputStream getInputStream() throws ResourceException { try { FileInputStream ins = new FileInputStream(resource); return applyFilter(ins); } catch (FileNotFoundException e) { throw new ResourceException("Resource file does not exist: " + resource.getAbsolutePath()); } }
/** {@inheritDoc} */ public boolean exists() throws ResourceException { boolean httpExists; try { httpExists = super.exists(); } catch (ResourceException e) { log.warn("HTTP resource '{}' was inaccessible for exists(), trying backing file '{}'", getLocation(), resourceFile.getAbsolutePath()); return resourceFile.exists(); } if (httpExists) { return true; } else { log.warn("HTTP resource '{}' did not exist, trying backing file '{}'", getLocation(), resourceFile.getAbsolutePath()); return resourceFile.exists(); } }
/** {@inheritDoc} */ public String toString() { return getLocation(); }
@Override public InputStream getInputStream() throws ResourceException { try { return springDelegate.getInputStream(); } catch (IOException e) { throw new ResourceException(e); } }
/** {@inheritDoc} */ public String toString() { return getLocation(); }
/** {@inheritDoc} */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof FilesystemResource) { return getLocation().equals(((FilesystemResource) o).getLocation()); } return false; } }
/** {@inheritDoc} */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof ClasspathResource) { return getLocation().equals(((ClasspathResource) o).getLocation()); } return false; } }
/** * Constructor. * * @param resourceURI file: URI to the file * * @throws ResourceException thrown if the resource path is null or empty * * @since 1.2.0 */ public FilesystemResource(URI resourceURI) throws ResourceException { super(); if (resourceURI == null) { throw new ResourceException("Resource URL may not be null"); } resource = new File(resourceURI); }
/** {@inheritDoc} */ public boolean equals(Object o) { if (o == this) { return true; } if (o instanceof HttpResource) { return getLocation().equals(((HttpResource) o).getLocation()); } return false; }
/** {@inheritDoc} */ public int hashCode() { return getLocation().hashCode(); }
/** {@inheritDoc} */ public int hashCode() { return getLocation().hashCode(); }
public SpringResourceWrapperOpenSAMLResource(Resource springDelegate) throws ResourceException { this.springDelegate = springDelegate; if (!exists()) { throw new ResourceException("Wrapper resource does not exist: " + springDelegate); } }
/** {@inheritDoc} */ public int hashCode() { return getLocation().hashCode(); }