-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetApiNs()org.springframework.core.convert.ConversionServicegetMessage(Throwable exception) Returns an error message for the supplied exception and based on this configuration.booleanbooleanbooleanbooleanbooleanbooleanpostProcessRequestUrl(jakarta.servlet.http.HttpServletRequest request, String requestUrlString) voidsetActionNs(String actionNs) Sets the name of the namespace in which the actions will reside.voidsetAlwaysWrapStoreResponse(boolean alwaysWrapStoreResponse) If alwaysWrapStoreResponse is true, responses of STORE_READ and STORE_MODIFY methods are always wrapped in anExtDirectStoreResultobject.voidSets the name of the namespace in which the remotingApiVar variable will reside.voidsetBaseRouterUrl(String baseRouterUrl) If not null theApiControllerdoes not use the url of the request to determine the router url instead he uses the value of this variable as the base and adds /router and /poll.
The fullRouterUrl setting is ignored when this variable is not nullvoidsetBatchedMethodsExecutionPolicy(BatchedMethodsExecutionPolicy batchedMethodsExecutionPolicy) Specifies how batched methods sent from the client should be executed on the server.voidsetBatchedMethodsExecutorService(ExecutorService batchedMethodsExecutorService) Sets the thread pool used for executing batched methods concurrently.voidsetBufferLimit(Integer bufferLimit) The maximum number of requests to batch together.voidsetConversionService(org.springframework.core.convert.ConversionService conversionService) voidsetDefaultExceptionMessage(String defaultExceptionMessage) Changes the default message when an exception occurred and there is no mapping found ingetExceptionToMessage()andisSendExceptionMessage()is false.voidsetEnableBuffer(Object enableBuffer) true or false to enable or disable combining of method calls.voidsetExceptionToMessage(Map<Class<?>, String> exceptionToMessage) Sets the new exception-to-message map.voidsetFrameDomain(String frameDomain) Sets the passed domain to be included in the file upload's temporary frame.voidsetFrameDomainScript(String frameDomainScript) Updates the script that is used to set the domain values on the file upload frame.voidsetFullRouterUrl(boolean fullRouterUrl) Specifies if the router property should contain the full URL including protocol, server name, port number, and server path (true) or only the server path (false)voidsetJsContentType(String jsContentType) Specifies the Content-Type for api.js and api-debug.js.voidsetJsonHandler(JsonHandler jsonHandler) voidsetMaxRetries(Integer maxRetries) Sets the number of times the client will try to send a message to the server before throwing a failure.voidsetPollingUrlsVar(String pollingUrlsVar) Changes the name of the polling urls object variablevoidsetProviderType(String providerType) Sets the type of the provider.voidsetRemotingApiVar(String remotingApiVar) Changes the name of the remoting api variable.voidsetSendExceptionMessage(boolean sendExceptionMessage) Changes the wayBaseResponse.setMessage(String)is called.voidsetSendStacktrace(boolean sendStacktrace) If sendStacktrace is true, the library sends, in case of an exception, the full stacktrace inBaseResponse.setWhere(String)back to the client.voidsetStreamResponse(boolean streamResponse) If streamResponse is true, the JSON response will be directly written into theServletResponse.getOutputStream()without setting the Content-Length header.voidsetSynchronizeOnSession(boolean synchronizeOnSession) If synchronizeOnSession is true, execution of all methods is synchronized on the session object.voidsetTimeout(Integer timeout) Sets the timeout in milliseconds for remote calls.
-
Constructor Details
-
Configuration
public Configuration()
-
-
Method Details
-
getDefaultExceptionMessage
-
setDefaultExceptionMessage
Changes the default message when an exception occurred and there is no mapping found ingetExceptionToMessage()andisSendExceptionMessage()is false.Default value is "Server Error".
This value is set into
BaseResponse.setMessage(String)and sent to the client.- Parameters:
defaultExceptionMessage- new default exception message- See Also:
-
isSendExceptionMessage
public boolean isSendExceptionMessage() -
setSendExceptionMessage
public void setSendExceptionMessage(boolean sendExceptionMessage) Changes the wayBaseResponse.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 ingetExceptionToMessage().Default value is false.
- Parameters:
sendExceptionMessage- new flag- See Also:
-
isSendStacktrace
public boolean isSendStacktrace() -
setSendStacktrace
public void setSendStacktrace(boolean sendStacktrace) If sendStacktrace is true, the library sends, in case of an exception, the full stacktrace inBaseResponse.setWhere(String)back to the client.Should only set to true in development.
Default value is false
- Parameters:
sendStacktrace- new flag
-
getExceptionToMessage
-
setExceptionToMessage
Sets the new exception-to-message map.If there is a mapping for the exception in
getExceptionToMessage()and the value is not null put this value inBaseResponse.setMessage(String).If there is a mapping for the exception in
getExceptionToMessage()and the value is null useThrowable.getMessage().If there is no mapping and
isSendExceptionMessage()is true useThrowable.getMessage().If there is no mapping and
isSendExceptionMessage()is false usegetDefaultExceptionMessage().- Parameters:
exceptionToMessage- new mapping from exception to message- See Also:
-
isAlwaysWrapStoreResponse
public boolean isAlwaysWrapStoreResponse() -
setAlwaysWrapStoreResponse
public void setAlwaysWrapStoreResponse(boolean alwaysWrapStoreResponse) If alwaysWrapStoreResponse is true, responses of STORE_READ and STORE_MODIFY methods are always wrapped in anExtDirectStoreResultobject.- Parameters:
alwaysWrapStoreResponse- new flag
-
isSynchronizeOnSession
public boolean isSynchronizeOnSession() -
setSynchronizeOnSession
public void setSynchronizeOnSession(boolean synchronizeOnSession) If synchronizeOnSession is true, execution of all methods is synchronized on the session object. To serialize parallel invocations from the same client and to prevent concurrency issues if the server accesses global or session resources.Instead of globally enable this it's possible to set the flag on a per method basis with
ExtDirectMethod.synchronizeOnSession().- Parameters:
synchronizeOnSession- new flag
-
getTimeout
-
setTimeout
Sets the timeout in milliseconds for remote calls. This parameter is part of the configuration object api.js sends to the client and configures the timeout property of the RemotingProvider.- Parameters:
timeout- new timeout value
-
getMaxRetries
-
setMaxRetries
Sets the number of times the client will try to send a message to the server before throwing a failure. Default value is 1. This parameter is part of the configuration object api.js sends to the client and configures the maxRetries property of the RemotingProvider.- Parameters:
maxRetries- new number of max retries
-
getEnableBuffer
-
setEnableBuffer
true or false to enable or disable combining of method calls. If a number is specified this is the amount of time in milliseconds to wait before sending a batched request. Calls which are received within the specified timeframe will be concatenated together and sent in a single request, optimizing the application by reducing the amount of round trips that have to be made to the server.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
- Parameters:
enableBuffer- new enableBuffer value
-
getBufferLimit
-
setBufferLimit
The maximum number of requests to batch together. By default, an unlimited number of requests will be batched. This option will allow to wait only for a certain number of Direct method calls before dispatching a request to the server, even ifenableBuffertimeout has not yet expired.Note that this option does nothing if
enableBufferis set to `false`.Defaults to: Number.MAX_VALUE
- Parameters:
bufferLimit- new value for buffer limit
-
getMessage
Returns an error message for the supplied exception and based on this configuration.- Parameters:
exception- the thrown exception- Returns:
- exception message
- See Also:
-
isStreamResponse
public boolean isStreamResponse() -
setStreamResponse
public void setStreamResponse(boolean streamResponse) If streamResponse is true, the JSON response will be directly written into theServletResponse.getOutputStream()without setting the Content-Length header. The old ExtDirectSpring 1.0.x behavior.If false the
RouterControllerwrites the JSON into an internal buffer, sets the Content-Length header inHttpServletResponseand writes the buffer intoServletResponse.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
- Parameters:
streamResponse- new flag
-
setJsContentType
Specifies the Content-Type for api.js and api-debug.js.Until version 1.2.1 extdirectspring sends "application/x-javascript". But according to RFC4329 the official mime type is 'application/javascript'.
Default value is "application/javascript"
- Parameters:
jsContentType- new Content-type
-
getJsContentType
-
getBatchedMethodsExecutionPolicy
-
setBatchedMethodsExecutionPolicy
public void setBatchedMethodsExecutionPolicy(BatchedMethodsExecutionPolicy batchedMethodsExecutionPolicy) Specifies how batched methods sent from the client should be executed on the server.BatchedMethodsExecutionPolicy.SEQUENTIALexecutes methods one after the other.BatchedMethodsExecutionPolicy.CONCURRENTexecutes methods concurrently with the help of a thread pool.Default value is
BatchedMethodsExecutionPolicy.SEQUENTIAL- Parameters:
batchedMethodsExecutionPolicy- new policy- See Also:
-
getBatchedMethodsExecutorService
-
setBatchedMethodsExecutorService
Sets the thread pool used for executing batched methods concurrently.If batchedMethodsExecutionPolicy is set to
BatchedMethodsExecutionPolicy.CONCURRENTbut no batchedMethodsExecutorService is specified the library creates aExecutors.newFixedThreadPool(int)with 5 threads.- Parameters:
batchedMethodsExecutorService- the new thread pool- See Also:
-
getProviderType
-
setProviderType
Sets the type of the provider. The type is sent to the client in the api configuration.Default value is "remoting" and it creates an Ext.direct.RemotingProvider on the client side.
- Parameters:
providerType- new provider type
-
getFrameDomain
-
setFrameDomain
Sets the passed domain to be included in the file upload's temporary frame. This is used to grant the main document access to the POST response on the frame in a cross-domain environment.- Parameters:
frameDomain- the new domain to set the frame to
-
getFrameDomainScript
-
setFrameDomainScript
Updates the script that is used to set the domain values on the file upload frame. This is useful for cross-browser compatibility. If other browsers require a modified script as workaround, frameDomainScript should allow for it.- Parameters:
frameDomainScript- the javascript code used to set the frame domain
-
getApiNs
-
setApiNs
Sets the name of the namespace in which the remotingApiVar variable will reside.Defaults to Ext.app
- Parameters:
apiNs- new namespace
-
getActionNs
-
setActionNs
Sets the name of the namespace in which the actions will reside.Defaults to none
- Parameters:
actionNs- new namespace
-
getRemotingApiVar
-
setRemotingApiVar
Changes the name of the remoting api variable.Defaults to REMOTING_API
- Parameters:
remotingApiVar- new remoting api varaible name
-
getPollingUrlsVar
-
setPollingUrlsVar
Changes the name of the polling urls object variableDefaults to POLLING_URLS
- Parameters:
pollingUrlsVar- new polling urls object variable name
-
isFullRouterUrl
public boolean isFullRouterUrl() -
setFullRouterUrl
public void setFullRouterUrl(boolean fullRouterUrl) Specifies if the router property should contain the full URL including protocol, server name, port number, and server path (true) or only the server path (false)Defaults to false
- Parameters:
fullRouterUrl- new flag value
-
getBaseRouterUrl
-
setBaseRouterUrl
If not null theApiControllerdoes not use the url of the request to determine the router url instead he uses the value of this variable as the base and adds /router and /poll.
The fullRouterUrl setting is ignored when this variable is not nullDefaults to null.
- Parameters:
baseRouterUrl- new base router url
-
getConversionService
public org.springframework.core.convert.ConversionService getConversionService() -
setConversionService
public void setConversionService(org.springframework.core.convert.ConversionService conversionService) -
getJsonHandler
-
setJsonHandler
-
postProcessRequestUrl
-