Package edu.byu.hbll.box.client
Class AbstractHttpBoxClient
- java.lang.Object
-
- edu.byu.hbll.box.client.AbstractHttpBoxClient
-
- All Implemented Interfaces:
BoxClient
- Direct Known Subclasses:
HttpBoxClient
public abstract class AbstractHttpBoxClient extends Object implements BoxClient
A client for communicating with Box through it's web api.- Author:
- Charles Draper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractHttpBoxClient.QueryResponse
-
Constructor Summary
Constructors Constructor Description AbstractHttpBoxClient(URI uri)
Creates a new client.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description QueryResult
collect(BoxQuery query)
Collects and returns all documents found according to the given query.Iterable<BoxDocument>
find(BoxQuery query)
Returns documents found according to the given query in the form of anIterable
.URI
getUri()
Returns the base uri for the box.protected abstract InputStream
send(URI uri)
Sends the request to the Box server and returns the response as an input stream.
-
-
-
Constructor Detail
-
AbstractHttpBoxClient
public AbstractHttpBoxClient(URI uri)
Creates a new client.- Parameters:
uri
- the base uri of the box source (eg, http://localhost:8080/app/box)
-
-
Method Detail
-
collect
public QueryResult collect(BoxQuery query)
Description copied from interface:BoxClient
Collects and returns all documents found according to the given query.
-
find
public Iterable<BoxDocument> find(BoxQuery query)
Description copied from interface:BoxClient
Returns documents found according to the given query in the form of anIterable
.
-
getUri
public URI getUri()
Returns the base uri for the box.- Returns:
- the uri
-
send
protected abstract InputStream send(URI uri)
Sends the request to the Box server and returns the response as an input stream. This can be overridden by subclasses that require different HTTP clients. The input stream will be closed here.- Parameters:
uri
- the full uri to send to box for the query- Returns:
- the response body as an
InputStream
-
-