Class Output
- java.lang.Object
-
- org.intermine.webservice.server.output.Output
-
- Direct Known Subclasses:
MemoryOutput
,StreamedOutput
public abstract class Output extends java.lang.Object
Abstract class representing an output of a web service. It depends on the output implementation if the written data are streamed to the user via http or saved in the memory.If the data are saved in memory they can be retrieved later.- Author:
- Jakub Kulaviak
-
-
Field Summary
Fields Modifier and Type Field Description static int
NOT_ACCEPTABLE
Request will only accept content in a format we cannot provide.static int
SC_BAD_REQUEST
Bad request http status code.static int
SC_FORBIDDEN
Forbidden http status code.static int
SC_INTERNAL_SERVER_ERROR
Internal server http status code.static int
SC_NO_CONTENT
No content http status code.static int
SC_NOT_FOUND
Resource not found http status code.static int
SC_OK
OK http status code.static int
SC_UNAUTHORIZED
Request is legal, but requires authentication, which was either not provided, or failed.
-
Constructor Summary
Constructors Constructor Description Output()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
addResultItem(java.util.List<java.lang.String> item)
Adds data to output.abstract void
flush()
Flushes output.protected int
getCode()
Gets the error codeprotected java.lang.String
getError()
Gets the error message.java.util.Map<java.lang.String,java.lang.Object>
getHeaderAttributes()
protected abstract int
getResultsCount()
void
setError(java.lang.String message, int code)
Sets the error messagevoid
setHeaderAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets header attributes that are displayed for example in xml header.
-
-
-
Field Detail
-
SC_BAD_REQUEST
public static final int SC_BAD_REQUEST
Bad request http status code.- See Also:
- Constant Field Values
-
SC_INTERNAL_SERVER_ERROR
public static final int SC_INTERNAL_SERVER_ERROR
Internal server http status code.- See Also:
- Constant Field Values
-
SC_FORBIDDEN
public static final int SC_FORBIDDEN
Forbidden http status code.- See Also:
- Constant Field Values
-
SC_OK
public static final int SC_OK
OK http status code.- See Also:
- Constant Field Values
-
SC_NO_CONTENT
public static final int SC_NO_CONTENT
No content http status code.- See Also:
- Constant Field Values
-
SC_NOT_FOUND
public static final int SC_NOT_FOUND
Resource not found http status code.- See Also:
- Constant Field Values
-
SC_UNAUTHORIZED
public static final int SC_UNAUTHORIZED
Request is legal, but requires authentication, which was either not provided, or failed.- See Also:
- Constant Field Values
-
NOT_ACCEPTABLE
public static final int NOT_ACCEPTABLE
Request will only accept content in a format we cannot provide.- See Also:
- Constant Field Values
-
-
Method Detail
-
setError
public void setError(java.lang.String message, int code)
Sets the error message- Parameters:
message
- The error message.code
- The error code.
-
getError
protected java.lang.String getError()
Gets the error message.- Returns:
- The error message
-
getCode
protected int getCode()
Gets the error code- Returns:
- the HTTP error code
-
addResultItem
public abstract void addResultItem(java.util.List<java.lang.String> item)
Adds data to output.- Parameters:
item
- data
-
flush
public abstract void flush()
Flushes output. What it actually does depends at implementation.
-
setHeaderAttributes
public void setHeaderAttributes(java.util.Map<java.lang.String,java.lang.Object> attributes)
Sets header attributes that are displayed for example in xml header.- Parameters:
attributes
- header attributes
-
getHeaderAttributes
public java.util.Map<java.lang.String,java.lang.Object> getHeaderAttributes()
- Returns:
- header attributes
- See Also:
setHeaderAttributes(Map)
-
getResultsCount
protected abstract int getResultsCount()
- Returns:
- number of written results
-
-