Class AbstractRequestContext
- java.lang.Object
-
- org.symphonyoss.s2.canon.runtime.http.AbstractRequestContext
-
- All Implemented Interfaces:
IRequestContext
- Direct Known Subclasses:
ServletRequestContext
public abstract class AbstractRequestContext extends Object implements IRequestContext
-
-
Field Summary
-
Fields inherited from interface org.symphonyoss.s2.canon.runtime.http.IRequestContext
FORM_CONTENT_TYPE, JSON_CONTENT_TYPE
-
-
Constructor Summary
Constructors Constructor Description AbstractRequestContext(HttpMethod method, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace, IModelRegistry modelRegistry)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BooleanasBoolean(String parameterName, String value)org.symphonyoss.s2.common.immutable.ImmutableByteArrayasImmutableByteArray(String parameterName, String value)IntegerasInteger(String parameterName, String value)LongasLong(String parameterName, String value)StringasString(String parameterName, String value)voiderror(String message)voiderror(String format, Object... args)voiderror(Throwable t)protected abstract StringgetCookie(String name)protected abstract StringgetHeader(String name)HttpMethodgetMethod()protected abstract StringgetParameter(String name)BooleangetParameterAsBoolean(String name, ParameterLocation location, boolean required)org.symphonyoss.s2.common.immutable.ImmutableByteArraygetParameterAsImmutableByteArray(String name, ParameterLocation location, boolean required)IntegergetParameterAsInteger(String name, ParameterLocation location, boolean required)LonggetParameterAsLong(String name, ParameterLocation location, boolean required)StringgetParameterAsString(String name, ParameterLocation location, boolean required)org.symphonyoss.s2.fugue.core.trace.ITraceContextgetTrace()<E extends IEntity>
List<E>parseListPayload(Class<E> type)<M> List<M>parseListPayload(org.symphonyoss.s2.common.type.provider.IValueProviderBuilder<M> builder)<E extends IEntity>
EparsePayload(String typeId, Class<E> type)<M,T>
MparsePayload(TypeDefBuilder<M,T> builder)<M> MparsePayload(org.symphonyoss.s2.common.type.provider.IValueProviderBuilder<M> builder)booleanpreConditionsAreMet()voidsendErrorResponse(int statusCode)voidsendOKResponse()voidsendOKResponse(List<? extends IBaseEntity> response)voidsendOKResponse(IBaseEntity response)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.symphonyoss.s2.canon.runtime.http.IRequestContext
getPathInfo, getReader, getWriter, sendError, setContentType, setStatus
-
-
-
-
Constructor Detail
-
AbstractRequestContext
public AbstractRequestContext(HttpMethod method, org.symphonyoss.s2.fugue.core.trace.ITraceContext trace, IModelRegistry modelRegistry)
-
-
Method Detail
-
getMethod
public HttpMethod getMethod()
- Specified by:
getMethodin interfaceIRequestContext
-
getTrace
public org.symphonyoss.s2.fugue.core.trace.ITraceContext getTrace()
- Specified by:
getTracein interfaceIRequestContext
-
getParameterAsBoolean
@Nullable public Boolean getParameterAsBoolean(String name, ParameterLocation location, boolean required)
- Specified by:
getParameterAsBooleanin interfaceIRequestContext
-
getParameterAsLong
@Nullable public Long getParameterAsLong(String name, ParameterLocation location, boolean required)
- Specified by:
getParameterAsLongin interfaceIRequestContext
-
getParameterAsInteger
public Integer getParameterAsInteger(String name, ParameterLocation location, boolean required)
- Specified by:
getParameterAsIntegerin interfaceIRequestContext
-
getParameterAsImmutableByteArray
public org.symphonyoss.s2.common.immutable.ImmutableByteArray getParameterAsImmutableByteArray(String name, ParameterLocation location, boolean required)
- Specified by:
getParameterAsImmutableByteArrayin interfaceIRequestContext
-
asString
@Nullable public String asString(String parameterName, String value)
- Specified by:
asStringin interfaceIRequestContext
-
asBoolean
@Nullable public Boolean asBoolean(String parameterName, String value)
- Specified by:
asBooleanin interfaceIRequestContext
-
asLong
@Nullable public Long asLong(String parameterName, String value)
- Specified by:
asLongin interfaceIRequestContext
-
asInteger
@Nullable public Integer asInteger(String parameterName, String value)
- Specified by:
asIntegerin interfaceIRequestContext
-
asImmutableByteArray
@Nullable public org.symphonyoss.s2.common.immutable.ImmutableByteArray asImmutableByteArray(String parameterName, String value)
- Specified by:
asImmutableByteArrayin interfaceIRequestContext
-
getParameterAsString
public String getParameterAsString(String name, ParameterLocation location, boolean required)
- Specified by:
getParameterAsStringin interfaceIRequestContext
-
preConditionsAreMet
public boolean preConditionsAreMet()
- Specified by:
preConditionsAreMetin interfaceIRequestContext
-
sendOKResponse
public void sendOKResponse()
- Specified by:
sendOKResponsein interfaceIRequestContext
-
sendOKResponse
public void sendOKResponse(IBaseEntity response) throws IOException
- Specified by:
sendOKResponsein interfaceIRequestContext- Throws:
IOException
-
sendOKResponse
public void sendOKResponse(List<? extends IBaseEntity> response) throws IOException
- Specified by:
sendOKResponsein interfaceIRequestContext- Throws:
IOException
-
sendErrorResponse
public void sendErrorResponse(int statusCode)
- Specified by:
sendErrorResponsein interfaceIRequestContext
-
error
public void error(String message)
- Specified by:
errorin interfaceIRequestContext
-
error
public void error(String format, Object... args)
- Specified by:
errorin interfaceIRequestContext
-
error
public void error(Throwable t)
- Specified by:
errorin interfaceIRequestContext
-
parsePayload
public <E extends IEntity> E parsePayload(String typeId, Class<E> type)
- Specified by:
parsePayloadin interfaceIRequestContext
-
parsePayload
public <M,T> M parsePayload(TypeDefBuilder<M,T> builder)
- Specified by:
parsePayloadin interfaceIRequestContext
-
parsePayload
public <M> M parsePayload(org.symphonyoss.s2.common.type.provider.IValueProviderBuilder<M> builder)
- Specified by:
parsePayloadin interfaceIRequestContext
-
parseListPayload
public <E extends IEntity> List<E> parseListPayload(Class<E> type)
- Specified by:
parseListPayloadin interfaceIRequestContext
-
parseListPayload
public <M> List<M> parseListPayload(org.symphonyoss.s2.common.type.provider.IValueProviderBuilder<M> builder)
- Specified by:
parseListPayloadin interfaceIRequestContext
-
-