/** * Return the content type value. */ public String getContentType() { return getHeaderField(ResourceAttributes.CONTENT_TYPE); }
/** * Get object content. */ public Object getContent() throws IOException { if (!connected) connect(); if (resource != null) return getInputStream(); if (collection != null) return collection; if (object != null) return object; throw new FileNotFoundException(); }
/** * Get object content. */ public Object getContent(Class[] classes) throws IOException { Object object = getContent(); for (int i = 0; i < classes.length; i++) { if (classes[i].isInstance(object)) return object; } return null; }
/** * Get object content. */ @Override public Object getContent() throws IOException { if (!connected) connect(); if (resource != null) return getInputStream(); if (collection != null) return collection; if (object != null) return object; throw new FileNotFoundException( getURL() == null ? "null" : getURL().toString()); }
dcUrlConn.setUseCaches(false); String type = dcUrlConn.getHeaderField(ResourceAttributes.TYPE); if (ResourceAttributes.COLLECTION_TYPE.equals(type)) { Enumeration<String> dirs = dcUrlConn.list(); while (dirs.hasMoreElements()) { String dir = dirs.nextElement(); InputStream is = null; try { is = dcUrlConn.getInputStream(); processAnnotationsStream(is); } catch (IOException e) {
connect(); } catch (IOException e) { Attribute attribute = attributes.get(attributeID); if (attribute == null) return null; return getHeaderValueAsString(attribute.get(attribute.size()-1));
/** * Get input stream. */ @Override public InputStream getInputStream() throws IOException { if (!connected) connect(); if (resource == null) { throw new FileNotFoundException( getURL() == null ? "null" : getURL().toString()); } // Reopen resource try { resource = (Resource) context.lookup( URLDecoder.decode(getURL().getFile(), "UTF-8")); } catch (NamingException e) { // Ignore } return (resource.streamContent()); }
/** * Return the last modified date. */ public long getLastModified() { if (!connected) { // Try to connect (silently) try { connect(); } catch (IOException e) { } } if (attributes == null) return 0; Attribute lastModified = attributes.get(ResourceAttributes.LAST_MODIFIED); if (lastModified != null) { try { Date lmDate = (Date) lastModified.get(); return lmDate.getTime(); } catch (Exception e) { } } return 0; }
/** * Return the content length value. */ public int getContentLength() { return getHeaderFieldInt(ResourceAttributes.CONTENT_LENGTH, -1); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ @Override protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
String path = getURL().getFile(); if (context instanceof ProxyDirContext) { ProxyDirContext proxyDirContext =
dcUrlConn.setUseCaches(false); String type = dcUrlConn.getHeaderField(ResourceAttributes.TYPE); if (ResourceAttributes.COLLECTION_TYPE.equals(type)) { Enumeration<String> dirs = dcUrlConn.list(); while (dirs.hasMoreElements()) { String dir = dirs.nextElement(); InputStream is = null; try { is = dcUrlConn.getInputStream(); processAnnotationsStream(is, fragment); } catch (IOException e) {
connect(); } catch (IOException e) { if (attribute == null) return null; Object attrValue = attribute.get(attribute.size()-1); return getHeaderValueAsString(attrValue);
/** * Get input stream. */ @Override public InputStream getInputStream() throws IOException { if (!connected) connect(); if (resource == null) { throw new FileNotFoundException( getURL() == null ? "null" : getURL().toString()); } // Reopen resource try { resource = (Resource) context.lookup( URL_DECODER.convert(getURL().getFile(), false)); } catch (NamingException e) { // Ignore } return (resource.streamContent()); }
/** * Get object content. */ @Override public Object getContent() throws IOException { if (!connected) connect(); if (resource != null) return getInputStream(); if (collection != null) return collection; if (object != null) return object; throw new FileNotFoundException( getURL() == null ? "null" : getURL().toString()); }
/** * Return the last modified date. */ public long getLastModified() { if (!connected) { // Try to connect (silently) try { connect(); } catch (IOException e) { } } if (attributes == null) return 0; Attribute lastModified = attributes.get(ResourceAttributes.LAST_MODIFIED); if (lastModified != null) { try { Date lmDate = (Date) lastModified.get(); return lmDate.getTime(); } catch (Exception e) { } } return 0; }
/** * Return the content length value. */ @Override public int getContentLength() { return getHeaderFieldInt(ResourceAttributes.CONTENT_LENGTH, -1); }
/** * Opens a connection to the object referenced by the <code>URL</code> * argument. */ @Override protected URLConnection openConnection(URL u) throws IOException { DirContext currentContext = this.context; if (currentContext == null) currentContext = get(); return new DirContextURLConnection(currentContext, u); }
String path = getURL().getFile(); if (context instanceof ProxyDirContext) { ProxyDirContext proxyDirContext =
dcUrlConn.setUseCaches(false); String type = dcUrlConn.getHeaderField(ResourceAttributes.TYPE); if (ResourceAttributes.COLLECTION_TYPE.equals(type)) { Enumeration<String> dirs = dcUrlConn.list(); while (dirs.hasMoreElements()) { String dir = dirs.nextElement(); InputStream is = null; try { is = dcUrlConn.getInputStream(); processAnnotationsStream(is, fragment); } catch (IOException e) {