public class Configuration extends Object
| Constructor and Description |
|---|
Configuration() |
| Modifier and Type | Method and Description |
|---|---|
String |
getDefaultExceptionMessage() |
Object |
getEnableBuffer() |
Map<Class<?>,String> |
getExceptionToMessage() |
Integer |
getMaxRetries() |
String |
getMessage(Throwable exception)
Returns an error message for the supplied exception and based on this
configuration.
|
Integer |
getTimeout() |
boolean |
isAlwaysWrapStoreResponse() |
boolean |
isSendExceptionMessage() |
boolean |
isSendStacktrace() |
boolean |
isStreamResponse() |
boolean |
isSynchronizeOnSession() |
void |
setAlwaysWrapStoreResponse(boolean alwaysWrapStoreResponse)
If alwaysWrapStoreResponse is true, responses of STORE_READ and
STORE_MODIFY methods are always wrapped in an
ExtDirectStoreResponse object. |
void |
setDefaultExceptionMessage(String defaultExceptionMessage)
Changes the default message when an exception occurred and there is no
mapping found in
getExceptionToMessage() and
isSendExceptionMessage() is false. |
void |
setEnableBuffer(Object enableBuffer)
true or false to enable or disable combining of method calls.
|
void |
setExceptionToMessage(Map<Class<?>,String> exceptionToMessage)
Sets the new exception-to-message map.
|
void |
setMaxRetries(Integer maxRetries)
Sets the number of times the client will try to send a message to the
server before throwing a failure.
|
void |
setSendExceptionMessage(boolean sendExceptionMessage)
Changes the way
BaseResponse.setMessage(String) is called. |
void |
setSendStacktrace(boolean sendStacktrace)
If sendStacktrace is true, the library sends, in case of an exception,
the full stacktrace in
BaseResponse.setWhere(String) back to the
client. |
void |
setStreamResponse(boolean streamResponse)
If streamResponse is true, the JSON response will be directly written
into the
ServletResponse.getOutputStream() without setting
the Content-Length header. |
void |
setSynchronizeOnSession(boolean synchronizeOnSession)
If synchronizeOnSession is true, execution of all methods is synchronized
on the session object.
|
void |
setTimeout(Integer timeout)
Sets the timeout in milliseconds for remote calls.
|
public String getDefaultExceptionMessage()
public void setDefaultExceptionMessage(String defaultExceptionMessage)
getExceptionToMessage() and
isSendExceptionMessage() is false.
Default value is "Server Error".
This value is set into BaseResponse.setMessage(String) and
sent to the client.
defaultExceptionMessage - new default exception messagesetExceptionToMessage(Map),
setDefaultExceptionMessage(String)public boolean isSendExceptionMessage()
public void setSendExceptionMessage(boolean sendExceptionMessage)
BaseResponse.setMessage(String) is called.
If this flag is set to true and an exception occurred instead of
getDefaultExceptionMessage() Throwable.getMessage() is
put into the message field of the response. Only if there is no mapping
found in getExceptionToMessage().
Default value is false.
sendExceptionMessage - new flagsetExceptionToMessage(Map),
setDefaultExceptionMessage(String)public boolean isSendStacktrace()
public void setSendStacktrace(boolean sendStacktrace)
BaseResponse.setWhere(String) back to the
client.
Should only set to true in development.
Default value is false
sendStacktrace - new flagpublic void setExceptionToMessage(Map<Class<?>,String> exceptionToMessage)
If there is a mapping for the exception in
getExceptionToMessage() and the value is not null put this value
in BaseResponse.setMessage(String).
If there is a mapping for the exception in
getExceptionToMessage() and the value is null use
Throwable.getMessage().
If there is no mapping and isSendExceptionMessage() is true use
Throwable.getMessage().
If there is no mapping and isSendExceptionMessage() is false use
getDefaultExceptionMessage().
exceptionToMessage - new mapping from exception to messagesetDefaultExceptionMessage(String),
setSendExceptionMessage(boolean)public boolean isAlwaysWrapStoreResponse()
public void setAlwaysWrapStoreResponse(boolean alwaysWrapStoreResponse)
ExtDirectStoreResponse object.alwaysWrapStoreResponse - new flagpublic boolean isSynchronizeOnSession()
public void setSynchronizeOnSession(boolean synchronizeOnSession)
Instead of globally enable this it's possible to set the flag on a per
method basis with ExtDirectMethod.synchronizeOnSession().
synchronizeOnSession - new flagpublic Integer getTimeout()
public void setTimeout(Integer timeout)
timeout - new timeout valuepublic Integer getMaxRetries()
public void setMaxRetries(Integer maxRetries)
maxRetries - new number of max retriespublic Object getEnableBuffer()
public void setEnableBuffer(Object enableBuffer)
This parameter is part of the configuration object api.js sends to the client and configures the enableBuffer property of the RemotingProvider.
Defaults to: 10
enableBuffer - new enableBuffer valuepublic String getMessage(Throwable exception)
exception - the thrown exceptionsetDefaultExceptionMessage(String),
setSendExceptionMessage(boolean),
setExceptionToMessage(Map)public boolean isStreamResponse()
public void setStreamResponse(boolean streamResponse)
ServletResponse.getOutputStream() without setting
the Content-Length header. The old ExtDirectSpring 1.0.x behavior.
If false the RouterController writes the JSON into an internal
buffer, sets the Content-Length header in HttpServletResponse and
writes the buffer into ServletResponse.getOutputStream().
Instead of globally enable this it's possible to set the flag on a per
method basis with ExtDirectMethod.streamResponse().
Default value is false
streamResponse - new flagCopyright © 2010-2012. All Rights Reserved.