Class ResolvedResourceImpl
- java.lang.Object
-
- org.xmlresolver.ResolvedResource
-
- org.xmlresolver.ResolvedResourceImpl
-
- All Implemented Interfaces:
ResolverResourceInfo
public class ResolvedResourceImpl extends ResolvedResource
-
-
Constructor Summary
Constructors Constructor Description ResolvedResourceImpl(java.net.URI resolvedURI, java.net.URI localURI, java.io.InputStream stream, int status, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
ResolvedResourceImpl(java.net.URI resolvedURI, java.net.URI localURI, java.io.InputStream stream, java.lang.String contentType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getContentType()
The content type of the resource.java.lang.String
getHeader(java.lang.String headerName)
Get the value of a header field.java.util.Map<java.lang.String,java.util.List<java.lang.String>>
getHeaders()
The headers.java.io.InputStream
getInputStream()
The input stream.java.net.URI
getLocalURI()
The local URI.java.net.URI
getResolvedURI()
The resolved URI.int
getStatusCode()
The status code.
-
-
-
Constructor Detail
-
ResolvedResourceImpl
public ResolvedResourceImpl(java.net.URI resolvedURI, java.net.URI localURI, java.io.InputStream stream, java.lang.String contentType)
-
ResolvedResourceImpl
public ResolvedResourceImpl(java.net.URI resolvedURI, java.net.URI localURI, java.io.InputStream stream, int status, java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers)
-
-
Method Detail
-
getResolvedURI
public java.net.URI getResolvedURI()
Description copied from class:ResolvedResource
The resolved URI.This is the URI that should be reported as the resolved URI.
- Specified by:
getResolvedURI
in interfaceResolverResourceInfo
- Specified by:
getResolvedURI
in classResolvedResource
- Returns:
- The resolved URI.
-
getLocalURI
public java.net.URI getLocalURI()
Description copied from class:ResolvedResource
The local URI.This is the URI that was used to retrieve the resource (to open the input stream). This is usually, but not necessarily always, the same as the resolved URI.
- Specified by:
getLocalURI
in classResolvedResource
- Returns:
- The local URI.
-
getInputStream
public java.io.InputStream getInputStream()
Description copied from class:ResolvedResource
The input stream.This is the input stream containing the resolved resource. This may return null, in which case it is the application's responsibily to access the resource through its resolved URI.
- Specified by:
getInputStream
in classResolvedResource
- Returns:
- The input stream that will return the content of the resolved resource.
-
getContentType
public java.lang.String getContentType()
Description copied from class:ResolvedResource
The content type of the resource.If the resolver knows the content type of the resource (for example
application/xml
), it will be provided here.- Specified by:
getContentType
in classResolvedResource
- Returns:
- The content type, possibly null.
-
getStatusCode
public int getStatusCode()
Description copied from class:ResolvedResource
The status code.This is the status code for this resource. For http: requests, it should be the code returned. For other resource types, it defaults to 200 for convenience.
- Specified by:
getStatusCode
in interfaceResolverResourceInfo
- Overrides:
getStatusCode
in classResolvedResource
- Returns:
- The status code of the (final) request.
-
getHeaders
public java.util.Map<java.lang.String,java.util.List<java.lang.String>> getHeaders()
Description copied from class:ResolvedResource
The headers.This is the set of headers returned for the resolved resource. This may be empty, for example, if the URI was a file: URI. The headers are returned unchanged from the
URLConnection
, so accessing them has to consider the case-insensitive nature of header names.- Specified by:
getHeaders
in interfaceResolverResourceInfo
- Overrides:
getHeaders
in classResolvedResource
- Returns:
- The headers associated with a resource.
-
getHeader
public java.lang.String getHeader(java.lang.String headerName)
Description copied from interface:ResolverResourceInfo
Get the value of a header field.Returns the first value of a header witht he specified name. This is a convenience method because header names have to be compared without case sensitivity. If the header has more than one value, only the first is returned.
- Parameters:
headerName
- the name of the header whose value should be returned.- Returns:
- the (first value) of the named header.
-
-