cpr.protocols.Submission
Submission.
Control to communicate with the server.
Index
Event |
Description |
before-send |
Fired just before the send function is called after the XMLHttpRequest is opened. |
before-submit |
Occurs before communication starts. |
error-status |
It occurs when an HTTP status code classified as an error is received from the server. |
receive |
Occurs when all data is received from the server. |
receive-json |
Occurs when the JSON string received from the server is successfully parsed into JSONObject when the response protocol is json. |
submit-done |
It always occurs last, regardless of communication error or success. |
submit-error |
Called when an error occurs in communication. |
submit-load-progress |
Occurs when data received from the server is partially loaded into the response data control. |
submit-progress |
Occurs when a certain size of data is transmitted from the server. |
submit-success |
Occurs after all data has been received from the server and the data has been processed in the data set and data map of the response data of the submission. |
submit-timeout |
This event is called when Timeout occurs during communication. |
submit-upload-progress |
It occurs when data of a certain size is transmitted to the server in the case of multipart/form-data. |
Name |
Type |
Description |
METHOD_POST |
String |
HTTP Post Method. |
METHOD_GET |
String |
HTTP Get Method. |
METHOD_DELETE |
String |
HTTP Delete Method. |
METHOD_HEAD |
String |
HTTP Head Method. |
METHOD_OPTIONS |
String |
HTTP Options Method. |
METHOD_PATCH |
String |
HTTP Patch Method. |
METHOD_PUT |
String |
HTTP Put Method. |
MEDIA_URLENCODED |
String |
Submission application/x-www-form-urlencoded Media Type. |
MEDIA_URLENCODED_SIMPLE |
String |
Submission application/x-www-form-urlencoded;simple Media Type. |
MEDIA_URLENCODED_MASS |
String |
Submission application/x-www-form-urlencoded;massdata Media Type. |
MEDIA_JSON |
String |
Submission application/json Media Type. |
MEDIA_JSON_MASS |
String |
Submission application/json;massdata Media Type. |
MEDIA_SCRIPT |
String |
Submission application/javascript HTTP Response ContentType. |
MEDIA_MULTIPART_JSON |
String |
Submission multipart/form-data;encoding=json Media Type. |
MEDIA_MULTIPART |
String |
Submission multipart/form-data Media Type. |
MEDIA_MULTIPART_SIMPLE |
String |
Submission multipart/form-data;simple Media Type. |
MEDIA_TSV |
String |
Submission text/tab-separated-values HTTP Response ContentType. |
action |
String |
Returns the url to send data. |
async |
Boolean |
Returns the value of whether it is asynchronous. |
contextPath |
String |
Returns a ContextPath of server URLs that are set up separately. |
disposed |
Boolean |
Returns whether the control should be removed. |
encoding |
String |
Returns the character encoding value of content-type in http. |
fallbackContentType |
String |
Returns the default content type to use when the server's response Content-Type cannot be identified. |
id |
String |
Returns the ID of the control. |
mediaType |
String |
Returns the value of media-type of content-type in http. |
method |
String |
Returns the value of the specified http request method. |
responseType |
String |
Returns the response data type specified in the submission. |
status |
String |
Returns the communication status value of the submission. |
timeout |
Number |
Returns the timeout value of the submission. |
type |
ControlType |
Returns the signature string of the Control's unique Type that can distinguish the Control. |
uuid |
String |
Returns the unique ID of the control. |
withCredentials |
Boolean |
Whether to send credential information upon request of Cross Domain. |
xhr |
XMLHttpRequest |
Returns the XMLHttpRequest object used for communication. |
Constructor
Creates a submission.
name |
type |
description |
idoptional
|
String |
Submission id. |
Events
CSubmissionEvent Fired just before the send function is called after the XMLHttpRequest is opened.
CSubmissionEvent It occurs when an HTTP status code classified as an error is received from the server.
CSubmissionEvent Occurs when the JSON string received from the server is successfully parsed into JSONObject when the response protocol is json.
CSubmissionEvent It always occurs last, regardless of communication error or success.
CSubmissionEvent Occurs when data received from the server is partially loaded into the response data control.
CSubmissionEvent Occurs when a certain size of data is transmitted from the server. It can only be used when operating with Async and can occur multiple times for one response.
CSubmissionEvent Occurs after all data has been received from the server and the data has been processed in the data set and data map of the response data of the submission.
CSubmissionEvent This event is called when Timeout occurs during communication. Available only when working with Async.
CSubmissionEvent It occurs when data of a certain size is transmitted to the server in the case of multipart/form-data.
Properties
type
|
String |
|
HTTP Post Method.
|
type
|
String |
|
HTTP Get Method.
|
type
|
String |
|
HTTP Delete Method.
|
type
|
String |
|
HTTP Head Method.
|
type
|
String |
|
HTTP Options Method.
|
type
|
String |
|
HTTP Patch Method.
|
type
|
String |
|
HTTP Put Method.
|
type
|
String |
|
Submission application/x-www-form-urlencoded Media Type.
|
type
|
String |
|
Submission application/x-www-form-urlencoded;simple Media Type.
|
type
|
String |
|
Submission application/x-www-form-urlencoded;massdata Media Type.
|
type
|
String |
|
Submission application/json Media Type.
|
type
|
String |
|
Submission application/json;massdata Media Type.
|
type
|
String |
|
Submission application/javascript HTTP Response ContentType.
|
type
|
String |
|
Submission multipart/form-data;encoding=json Media Type.
|
type
|
String |
|
Submission multipart/form-data Media Type.
|
type
|
String |
|
Submission multipart/form-data;simple Media Type.
|
type
|
String |
|
Submission text/tab-separated-values HTTP Response ContentType.
|
declaring type
|
AbstractSubmission |
type
|
String |
get
|
Returns the url to send data.
|
set
|
Specify the url to send data. ex) "/action_data.do"
|
declaring type
|
AbstractSubmission |
type
|
Boolean |
get
|
Returns the value of whether it is asynchronous.
|
set
|
Specifies the value of asynchronous.
|
declaring type
|
AbstractSubmission |
type
|
String |
get
|
Returns a ContextPath of server URLs that are set up separately.
|
set
|
Sets the ContextPath of the configured server URLs.
|
declaring type
|
Control |
type
|
Boolean |
readonly
|
Returns whether the control should be removed.
|
declaring type
|
AbstractSubmission |
type
|
String |
readonly
|
Returns the character encoding value of content-type in http.
|
type
|
String |
get
|
Returns the default content type to use when the server's response Content-Type cannot be identified.
The default is application/json.
If set to None, the response is not processed when the Content-Type cannot be identified.
|
set
|
Sets the default content type to use when the server's response Content-Type cannot be identified.
The default is application/json.
If set to None, the response is not processed when the Content-Type cannot be identified.
|
declaring type
|
Control |
type
|
String |
readonly
|
Returns the ID of the control.
|
declaring type
|
AbstractSubmission |
type
|
String |
get
|
Returns the value of media-type of content-type in http.
|
set
|
Specifies the value of media-type of content-type in http.
|
declaring type
|
AbstractSubmission |
type
|
String |
get
|
Returns the value of the specified http request method.
|
set
|
Specifies the value of http request method.
|
declaring type
|
AbstractSubmission |
type
|
String |
get
|
Returns the response data type specified in the submission.
|
set
|
Specifies the response data type specified in the submission.
|
declaring type
|
AbstractSubmission |
type
|
String |
readonly
|
Returns the communication status value of the submission.
A submission can have three states (IDLE, SENDING, DONE).
|
declaring type
|
AbstractSubmission |
type
|
Number |
get
|
Returns the timeout value of the submission.
|
set
|
If the specified time is exceeded, it is aborted and a timeout event occurs. The input value is received in ms (Millisecond).
|
declaring type
|
Control |
type
|
ControlType |
readonly
|
Returns the signature string of the Control's unique Type that can distinguish the Control.
Please refer to ControlType for available constant values.
For UDC controls, each unique type name is returned. Example: udc.MyUDC
|
declaring type
|
Control |
type
|
String |
readonly
|
Returns the unique ID of the control.
|
declaring type
|
AbstractSubmission |
type
|
Boolean |
get
|
Whether to send credential information upon request of Cross Domain.
|
set
|
Specify whether to send credential information when requesting Cross Domain.
|
declaring type
|
AbstractSubmission |
type
|
XMLHttpRequest |
readonly
|
Returns the XMLHttpRequest object used for communication.
|
Methods
Add listeners by EventType to the control.
Add a listener to the control to handle when a specific event occurs.
var button = new cpr.controls.Button("btn01");
button.addEventListener("click", function(e) {
// event code...
});
name |
type |
description |
type
|
String |
Event type. |
listener
|
(e: cpr.events.CEvent)=>Void |
Event listeners. |
Add a listener to the control that will run only once per EventType.
Add a listener to the control to handle when a specific event occurs.
The added listener is automatically deleted after running once.
Since the object of the added listener is changed, when the listener is deleted
It is an object returned after calling addEventListenerOnce and can be deleted.
var button = new cpr.controls.Button("btn01");
button.addEventListenerOnce("click", function(e) {
// event code...
});
name |
type |
description |
type
|
String |
Event type. |
listener
|
(e: cpr.events.CEvent)=>Void |
Event listeners. |
return
|
(e: cpr.events.CEvent)=>Void |
The modified Listener object. |
Add a file to the parameters.
name |
type |
description |
name
|
String |
Parameter name |
file
|
File |
Object in file |
Adds additional parameters to be passed on during transmission.
name |
type |
description |
name
|
String |
The name of the parameter |
value
|
String |
The value of the parameter |
name |
type |
description |
reqData
|
DataMap |
|
name |
type |
description |
reqData
|
DataMap |
|
alias
|
String |
|
name |
type |
description |
reqData
|
DataSet |
|
name |
type |
description |
reqData
|
DataSet |
|
alias
|
String |
|
Add the data control to request.
name |
type |
description |
reqData
|
DataSet |
Dataset or data map |
alias
|
String |
A server-identifiable random key (default: ID of the data control) |
payloadTypeoptional
|
PayloadType |
Set whether to send changed data or all data in the dataset or all. Options: ["modified", "all"] (default modified) |
Add a data collection to store the response data.
name |
type |
description |
data
|
DataMap |
Dataset or data map |
isadd
|
Boolean |
Dataset options Whether to append or delete existing data in the set dataset |
aliasoptional
|
String |
defaultnull
|
|
Bind that property.
name |
type |
description |
propertyName
|
#bindable-property_name |
The attribute name to bind. |
Removes all FileParameters and RequestObjects added to the submission.
Forwards specific events.
name |
type |
description |
e
|
CEvent |
event |
return
|
Boolean |
Successful event delivery. |
Discards the information contained in the object, and also deletes the object.
Returns the app instance to which the control belongs.
return
|
AppInstance |
The app instance the control belongs to. |
Returns the bind context.
Returns the bind property information for the control.
name |
type |
description |
propertyName
|
#bindable-property_name |
The name of the attribute being bound. |
Returns the names of the parameters registered in the file.
return
|
String[] |
An array of file names. |
Returns the file of the parameter.
name |
type |
description |
name
|
String |
The name of the parameter |
return
|
File[] |
File arrangement. |
Returns the value of the request header.
name |
type |
description |
name
|
String |
The name of the header. |
return
|
String |
The value of the header. |
Returns the names of the specified request headers.
return
|
String[] |
An array of header names. |
Returns the value of the metadata received from the server as a result of the previous submission.
name |
type |
description |
key
|
String |
The metadata name. |
return
|
Object |
Metadata value. |
Returns the key values of metadata received from the server as a result of the previous submission.
return
|
String[] |
Meta data key value string array. |
Among the data received from the server, it returns the basic data without data binding.
name |
type |
description |
key
|
String |
The key value received from the server. |
return
|
Number | String | false | true |
Data (string or Number) received from the server. |
Returns the names of the parameters.
return
|
String[] |
An array of parameter names. |
Returns the value of the parameter.
name |
type |
description |
name
|
String |
The name of the parameter |
return
|
String[] |
An array of parameters. |
Returns the full URL information to be requested to the server that is initialized whenever a submission request is completed.
If the result value is null, the contextPath value set in the environment variable (protocol.submission in default.js) when the Submission is sent
The action value set in Submission is automatically set as the combined URL.
return
|
String |
The full URL to send to the server. |
Returns the data collection you are requesting.
name |
type |
description |
index
|
Number |
The index of the data. |
Returns the data collection you are requesting.
name |
type |
description |
dataId
|
String |
ID or Alias of the data |
Returns the number of data controls to pass to the server.
return
|
Number |
Number of requested data. |
Returns the set request object.
return
|
Object |
requdest object. |
Returns a data collection object that stores response data.
name |
type |
description |
index
|
Number |
Index of data |
Returns a data collection object that stores response data.
name |
type |
description |
dataId
|
String |
ID or Alias of the data |
Returns the number of data collections that store response data.
return
|
Number |
Number of response data. |
Returns data collection objects that store response data.
name |
type |
description |
alias
|
String |
|
Returns all custom attribute names.
return
|
String[] |
An array of all custom attribute names. |
Returns whether the queried property is bindable and the binding has been configured to obtain a valid value.
Even if no binding is configured and a simple value is specified, it is treated as configured so that a valid value is obtained.
For example, binding to a row index that does not exist in the DataSet is an invalid binding.
name |
type |
description |
propertyName
|
#bindable-property_name |
Property name to check whether binding is valid. |
Make sure it is a bindable property.
name |
type |
description |
propertyName
|
#bindable-property_name |
Attribute name |
return
|
Boolean |
Confirmation. |
Returns whether the previous submission was successful.
The default value is true.
Removes all event listeners for the control.
Removes all parameters registered as a file.
Removes all specified headers.
Removes all specified data collections.
Removes all data collection that stores response data.
Delete all custom attributes.
Remove Listener for each EventType in the control.
control.removeEventListener ('click', listener); code> pre>
name |
type |
description |
type
|
String |
Event type. |
listener
|
(e: cpr.events.CEvent)=>Void |
Event listeners. |
Remove all EventType listeners from the control.
control.removeEventListeners ('click'); code> pre>
name |
type |
description |
type
|
String |
Event type. |
Removes the parameter registered as a file.
name |
type |
description |
name
|
String |
The name of the parameter |
return
|
File[] |
File arrangement. |
Removes the header with the specified name.
name |
type |
description |
name
|
String |
Name of header |
return
|
String |
The value of the removed header. |
Deletes all values corresponding to the parameter name.
name |
type |
description |
name
|
String |
The name of the parameter |
return
|
String[] |
An array of parameter values that have been removed. |
Delete request data.
name |
type |
description |
index
|
Number |
The index of the data. |
Delete request data.
name |
type |
description |
dataId
|
String |
ID or Alias of the data |
Delete response data.
name |
type |
description |
index
|
Number |
Index of data |
Delete response data.
name |
type |
description |
dataId
|
String |
ID or Alias of the data |
Removes user-defined attributes for a specific attribute name.
name |
type |
description |
key
|
String |
The custom attribute name to remove. |
Transfer the data. It will not run if you are already submitting to the same submission.
return
|
Promise<cpr.events.CSubmissionEvent> |
|
Registers a handler that can process data to be transmitted with HTTPRequest for each row of DataSet.
submission.setDataRowHandler(function(rowdata) {
var additionalData = {};
var columnValue = rowdata.getValue("columnName");
additionalData['param'] = columnValue;
return additionalData;
});
name |
type |
description |
dataRowHandler
|
(rowdata: cpr.protocols.DataSetRow)=>{[key:string]: String} |
Handler for individual rows in the DataSet. |
handleDataMapoptional
|
Boolean |
defaultfalse
|
|
Set the file to the parameter. You can enter one or several parameters.
name |
type |
description |
name
|
String |
The name of the parameter |
value
|
File |
Objects in the file |
Specifies the value of the request header.
name |
type |
description |
name
|
String |
Name of header |
value
|
String |
The value of the header |
Sets the additional parameters to be transmitted during transmission.
name |
type |
description |
name
|
String |
The name of the parameter |
value
|
String | String[] |
The values of the parameter |
Set the complete URL information to request to the server that is initialized whenever a submission request is completed.
If the setting value is null, the contextPath value set in the environment variable (protocol.submission in default.js) when the Submission is sent
The action value set in Submission is automatically set as the combined URL.
If the setting value is not null, it communicates with the server using the URL set when the Submission is sent.
The set URL is initialized to null whenever a submission request is completed.
var submission = app.lookup ("sub_main");
submission.setRequestActionUrl ("http://test.exbuilder.co.kr/" + submission.action);
submission.send ();
code> pre>
name |
type |
description |
action
|
String |
Full URL to request to the server. |
Register a function that can encode data sent to the server in a separate format.
var sms1 = app.lookup("sms1");
sms1.setRequestEncoder(function(submission, data){
return {key: "key1", content: data, contentType: "application/json"}
});
name |
type |
description |
requestEncoder
|
(submission: cpr.protocols.Submission, data: Object)=>cpr.protocols.EncodingResult |
A callback function that takes the submission and data as arguments and creates an encoding result in EncodingResult format. |
usingBuildDataoptional
|
Boolean |
Whether the encoding process requires built-in request data for operation. |
Register a function that can encode data sent to the server in a separate format.
var sms1 = app.lookup("sms1");
sms1.setRequestEncoder(function(submission, data){
return {key: "key1", content: data, contentType: "application/json"}
});
name |
type |
description |
requestEncoder
|
(submission: cpr.protocols.Submission, data: Object)=>Promise<cpr.protocols.EncodingResult> |
Asynchronous callback function that takes submission and data as arguments and creates an encoding result promise in EncodingResult format. |
usingBuildDataoptional
|
Boolean |
|
Set request data in JSONObject format.
name |
type |
description |
obj
|
Object |
The object to transfer |
Randomly set the ContentType to interpret server response data.
If a non-null value is set, the Content-Type in the server response header is ignored and the server response data is interpreted with the set ContentType.
name |
type |
description |
contentType
|
String |
cpr.protocol.Submission.MEDIA_JSON
cpr.protocol.Submission.MEDIA_JSON
cpr.protocol.Submission.MEDIA_SCRIPT
cpr.protocol.Submission.MEDIA_TSV |
Register a Decoding function that can convert data in a format not supported by eXBuilder6 received from the server into a format supported by eXBuilder6 or process it on its own.
Submissions with ResponseDecoder registered do not fire the “submit-load-progress” event.
var sms1 = app.lookup("sms1");
sms1.setResponseDecoder(function(submission, data){
return {content: data, contentType: "application/json"}
});
name |
type |
description |
responseDecoder
|
(submission: cpr.protocols.Submission, data: String)=>cpr.protocols.DecodingResult |
A callback function that decodes the response data string and returns DecodingResult. |
Register a Decoding function that can convert data in a format not supported by eXBuilder6 received from the server into a format supported by eXBuilder6 or process it on its own.
Submissions with ResponseDecoder registered do not fire the “submit-load-progress” event.
var sms1 = app.lookup("sms1");
sms1.setResponseDecoder(function(submission, data){
return {content: data, contentType: "application/json"}
});
name |
type |
description |
responseDecoder
|
(submission: cpr.protocols.Submission, data: String)=>Promise<cpr.protocols.DecodingResult> |
An asynchronous callback function that decodes the response data string and returns a DecodingResult promise. |
Unbind that property.
name |
type |
description |
propertyName
|
#bindable-property_name |
Attribute name to unbind. |
Specifies custom properties.
name |
type |
description |
key
|
String |
The attribute name to assign |
value
|
String |
The attribute value to specify. |
Returns a user-defined property.
name |
type |
description |
key
|
String |
The attribute name to get. |
return
|
String |
Custom properties. |
Specify multiple custom properties at once.
name |
type |
description |
values
|
{[key:string]: String} |
A JSON object containing custom attribute keys/values. |
Get all custom properties in the form of a map.
return
|
{[key:string]: String} |
|
Specifies custom data. Unlike user-defined attributes, you can use arbitrary types in addition to strings.
When the control is dispose, all custom data is removed.
name |
type |
description |
key
|
String |
The key of the data to be specified. |
value
|
Object |
Data to specify. |
get custom data
name |
type |
description |
key
|
String |
The key of the data to get. |
Specifies multiple user-defined data.
name |
type |
description |
override
|
{[key:string]: Object} |
A JSON object containing user-defined data. |
Get all your custom data.
return
|
{[key:string]: Object} |
|
Returns a user-defined property.
return
|
Object |
Custom properties. |