Package ej.rest.web
Class TextResource
- java.lang.Object
-
- ej.rest.web.Resty
-
- ej.rest.web.AbstractResource
-
- ej.rest.web.TextResource
-
public class TextResource extends AbstractResource
This is a text/* representation of a resource.
-
-
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 Stringtext-
Fields inherited from class ej.rest.web.AbstractResource
inputStream, urlConnection
-
Fields inherited from class ej.rest.web.Resty
DEFAULT_USER_AGENT, MOZILLA, userAgent
-
-
Constructor Summary
Constructors Constructor Description TextResource(Resty.Option... options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAcceptedTypes()Get charset for this content type.protected StringreadTextFromStream(InputStream aTextStream)StringtoString()Kinda obvious, but, yes, it parses the inputStream with the proper charset and returns the content as String-
Methods inherited from class ej.rest.web.AbstractResource
getUrlConnection, http, location, printResponseHeaders, status, stream
-
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
-
text
protected String text
-
-
Constructor Detail
-
TextResource
public TextResource(Resty.Option... options)
-
-
Method Detail
-
toString
public String toString()
Kinda obvious, but, yes, it parses the inputStream with the proper charset and returns the content as String
-
readTextFromStream
protected String readTextFromStream(InputStream aTextStream)
-
getAcceptedTypes
public String getAcceptedTypes()
Get charset for this content type. Parses charset= attribute of content type or falls back to a default- Specified by:
getAcceptedTypesin classAbstractResource- Returns:
- the charset to use when parsing this content
-
-