public class ContentFetcher
extends java.lang.Object
This class fetches documents from the conentbase and writes
their serialized contents to a provided
OutputStream
.
Click here for the source code for this class
Constructor and Description |
---|
ContentFetcher(java.net.URI serverUri)
Construct an instance that may be used to fetch
documents.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Command-line main() method to fetch a
document.
|
void |
setRequestOptions(RequestOptions options)
Set (or clear) the
RequestOptions
instance to associate with submitted queries. |
public ContentFetcher(java.net.URI serverUri) throws XccConfigException
serverUri
- A URI identifying a ContentSource
, in
the format expected by
ContentSourceFactory.newContentSource(java.net.URI)
.XccConfigException
- Thrown if a Session
cannot be created. This usually indicates that the host/port or
user credentials are incorrect.public void setRequestOptions(RequestOptions options)
Set (or clear) the RequestOptions
instance to associate with submitted queries.
Note: It's a good idea to set CachedResult=false. Since the data
is being written straight out to an OutputStream
there
is no need to buffer the document first. Streaming will also
accommodate arbitrarily large documents without running out of
memory. Setting an options value of null will use defaults, which
includes cached result mode.
options
- An instance of RequestOptions
or
null.public static void main(java.lang.String[] args) throws java.lang.Exception
args
- Arg 1: A server URL as per
ContentSourceFactory.newContentSource(java.net.URI)
.
Arg 2: A document URI. Optional Args 3&4: "-o
outputfilename"java.lang.Exception
- No exceptions are handled,
anything that goes wrong will spew out a stack trace and exit.
Copyright © 2024 MarkLogic
Corporation
Complete online documentation for MarkLogic Server,
XQuery and related components may
be found at
developer.marklogic.com