Package ej.rest.web
Class AbstractResource
- java.lang.Object
-
- ej.rest.web.Resty
-
- ej.rest.web.AbstractResource
-
- Direct Known Subclasses:
BinaryResource,JSONResource,TextResource
public abstract class AbstractResource extends Resty
Abstract base class for all resource handlers you want to use with Resty. It gives access to the underlying URLConnection and the current inputStream
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ej.rest.web.Resty
Resty.Option, Resty.Timeout
-
-
Field Summary
Fields Modifier and Type Field Description protected InputStreaminputStreamprotected URLConnectionurlConnection-
Fields inherited from class ej.rest.web.Resty
DEFAULT_USER_AGENT, MOZILLA, userAgent
-
-
Constructor Summary
Constructors Constructor Description AbstractResource(Resty.Option... options)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract StringgetAcceptedTypes()URLConnectiongetUrlConnection()HttpURLConnectionhttp()URIlocation()Get the location header as URI.StringprintResponseHeaders()Print out the response headers for this resource.booleanstatus(int responseCode)Check if the URLConnection has returned the specified responseCodeInputStreamstream()-
Methods inherited from class ej.rest.web.Resty
addAdditionalHeaders, addStandardHeaders, bytes, bytes, bytes, bytes, chunked, chunked, content, content, content, content, createBinaryResource, createJSONResource, createTextResource, data, data, delete, doGET, dontSend, doPOSTOrPUT, fillResourceFromURL, form, form, getAdditionalHeaders, identifyAsMozilla, identifyAsResty, json, json, json, json, openConnection, path, put, setOptions, text, text, text, text, withHeader
-
-
-
-
Field Detail
-
urlConnection
protected URLConnection urlConnection
-
inputStream
protected InputStream inputStream
-
-
Constructor Detail
-
AbstractResource
public AbstractResource(Resty.Option... options)
-
-
Method Detail
-
getAcceptedTypes
protected abstract String getAcceptedTypes()
-
getUrlConnection
public URLConnection getUrlConnection()
-
http
public HttpURLConnection http()
-
stream
public InputStream stream()
-
status
public boolean status(int responseCode)
Check if the URLConnection has returned the specified responseCode- Parameters:
responseCode-- Returns:
-
location
public URI location()
Get the location header as URI. Returns null if there is no location header.
-
printResponseHeaders
public String printResponseHeaders()
Print out the response headers for this resource.- Returns:
-
-