List of usage examples for java.net URLConnection getExpiration
public long getExpiration()
From source file:org.wso2.carbon.mediation.registry.MicroIntegratorRegistry.java
@Override public RegistryEntry getRegistryEntry(String key) { // get information from the actual resource MediationRegistryEntryImpl entryEmbedded = new MediationRegistryEntryImpl(); try {/*from w w w. ja v a 2 s. co m*/ URL url = new URL(resolveRegistryPath(key)); if ("file".equals(url.getProtocol())) { try { url.openStream(); } catch (IOException e) { log.error("Error occurred while accessing registry resource: " + key, e); return null; } } URLConnection urlc = url.openConnection(); entryEmbedded.setKey(key); entryEmbedded.setName(url.getFile()); entryEmbedded.setType(ESBRegistryConstants.FILE); entryEmbedded.setDescription("Resource at : " + url.toString()); entryEmbedded.setLastModified(urlc.getLastModified()); entryEmbedded.setVersion(urlc.getLastModified()); if (urlc.getExpiration() > 0) { entryEmbedded.setCachableDuration(urlc.getExpiration() - System.currentTimeMillis()); } else { entryEmbedded.setCachableDuration(getCachableDuration()); } } catch (MalformedURLException e) { handleException("Invalid URL reference " + resolveRegistryPath(key), e); } catch (IOException e) { handleException("IO Error reading from URL " + resolveRegistryPath(key), e); } return entryEmbedded; }