📄 rpcmanager.js
字号:
//// Overrides RPCManager.defaultTimeout for this request only. If you're using queuing, note// that the timeout setting derived from the last request in the queue is used for the entire// queue. If you want to override the timeout for the queue, make sure to set your override at// least on the last request in the queue.//// @see classAttr:RPCManager.defaultTimeout//// @visibility external//<//> @attr rpcRequest.clientOnly (boolean : false : IRWA)// // Used for testing/prototyping without a server. <code>clientOnly</code> requests don't get// sent to the server, but the standard callback chain is still invoked. If all requests in a// transaction are clientOnly then the callbacks are called immediately otherwise they're// called when the server returns responses to the non-clientOnly requests.// // @visibility internal//<//> @attr rpcRequest.params (Object, others - see below : null : IRW)// // Values to be sent as simple HTTP params, as a JavaScript Object where each property/value// pair will become an HTTP parameter name and value. These parameters are then accessible on// the server, for example, using servletRequest.getParameter(paramName) in Java Servlets. // <P>// This API is primarily used in combination with +link{rpcRequest.useSimpleHttp}.// <P>// When contacting the SmartClient server, setting <code>params</code> is an opportunity to// send additional data aside from the main +link{rpcRequest.data} payload; this is useful for // adding data to DataSource requests which will be kept separate from the automatically sent// DataSource data.// <P>// Note that in contrast to +link{rpcRequest.data} object, the data in// <code>rpcRequest.params</code> is not serialized/deserialized by the SmartClient server, and// all values arrive on the server as String type (like HTTP parameters always do).// <p>// The params value can also be a componentID or component instance that provides a method// getValues() that returns an Object literal. SmartClient components// +link{class:DynamicForm}, +link{class:ValuesManager} are two such classes. Lastly, you may// specify the ID of a native form element (retreivable via getElementById()) and the params// will be populated from there. If there is an error resolving your params directive, it will// be logged to the Developer Console.// <p>// Note: The params are submitted once per http transaction. If you are using // +link{RPCManager.startQueue(),request queuing} to bundle multiple RPCRequests or DSRequests// into a single HTTP turnaround, the params from the various RPCRequests will be merged,// with the later-queued transactions winning on parameter name collisions. A warning will be// logged in the Developer Console if multiple RPCRequests specified params.//// @visibility external//<//> @attr rpcRequest.evalResult (boolean : false : IRWA)// // This works similarly to +link{RPCRequest.serverOutputAsString} except the resulting String// is automatically evaluated as JavaScript. The result of the evaluation is then passed to// any specified +link{RPCRequest.callback} as +link{RPCResponse.data}.// <p>// This feature can be used to dynamically load new application modules into a running// application. An RPCRequest with <code>evalResult</code> enabled can be used to fetch a// static .js file or JavaScript dynamically generated by the server. The returned JavaScript// can contain anything that a JavaScript file loaded at init time can contain, including new// views and new SmartClient class definitions.// <p>// <i>Example usage with +link{RPCManager.sendRequest()}:</i>// <pre>// isc.RPCManager.sendRequest({// evalResult:true,// actionURL:"js/loadLabel.js",// evalVars:{var1:"A Value"}// });// </pre>// This call would execute the code from <code>loadLabel.js</code>, and make the variable// <code>var1</code> available to that code. Therefore if the .js file contained this code:// <pre>// isc.Label.create({// contents:var1// })// </pre>// A label would be created with contents set to the value of <code>var1</code> - the string// <code>"A Value"</code>.// // <p>// This feature relies on the XMLHttpRequest object which can be disabled by end-users in some// supported browsers. See +link{group:platformDependencies} for more information.//// @see class:ViewLoader// @see rpcRequest.evalVars// @group viewLoading// @visibility external//<//> @attr rpcRequest.evalVars (Object : null : IRWA)// // If you've set +link{RPCRequest.evalResult} : true, then the property values of this object// will be available in the evaluation scope of the result under the variable names// specified by the property names. // <p>// So e.g. if evalVars is: <code>{foo: "bar"}</code> then a reference to the// variable <code>foo</code> in the result will evaluate to <code>"bar"</code>.//// @group viewLoading// @visibility external//<//> @attr rpcRequest.callbackParam (String : "callback" : IRW) //// For use only with the <code>scriptInclude</code> transport, this attribute specifies the// name of the parameter from which the server expects to read the name of the JavaScript// callback function.// <P>// SmartClient will use the callback mechanism provided by the server, then call// +link{rpcRequest.callback} normally.// <p>// This attribute is ignored by all other transports.//// @visibility external//<//> @attr rpcRequest.suppressAutoDraw (boolean : true : IRWA)// // If +link{attr:RPCRequest.evalResult} is set, setting this property to true causes// +link{attr:Canvas.autoDraw} to be set to false for the duration of the result evaluation -// which is generally what you want if you're returning new components from the server.//// @visibility internal//<//> @attr rpcRequest.serverOutputAsString (boolean : false : IRWA)// // Setting this flag makes the body of the HTTP response available as a String in the// +link{RPCRequest.callback} as +link{RPCResponse.data}. This means that you can, for// example, load the contents of static files off your webserver into a string for processing// on the client with no server support. The +link{RPCRequest.actionURL} must be in the same// domain as the current page for this to work.// <p>// This feature relies on the XMLHttpRequest object which can be disabled by end-users in some// supported browsers. See +link{group:platformDependencies} for more information.// <p>// Generally this API is used for either +link{group:nonJavaBackend,non-Java backends} // or for advanced usage such as content that requires processing before it can be used in// SmartClient components (such as client-side web scraping). Note that SmartClient provides// higher-level APIs for loading common types of data, see eg +link{HTMLFlow} for HTML content,// +link{ViewLoader} for loading SmartClient components, +link{XMLTools.loadXML()} for loading// XML, +link{RPCRequest.evalResult} for loading +externalLink{http://www.json.org/,JSON}, and// +link{DataSource} for loading structured data in various formats.//// @visibility external//<//> @attr rpcRequest.transport (RPCTransport : RPCManager.defaultTransport : IRWA)//// Selects the transport used for this RPCRequest. If unset, the value of// +link{RPCManager.defaultTransport} will be used.// <p>// If you're using queueing, note that all requests in the queue must use the same transport.// If you attempt to send a request via a different transport than those that are currently on// the queue, it will be sent to the server separately, ahead of the queue, and a warning will// be logged to the Developer Console.// <p>// If you specify an unknown transport, an error will be logged to the DeveloperConsole and// +link{RPCManager.defaultTransport} will be used instead.// <p>// If you specify the <code>xmlHttpRequest</code> transport and it is not available, a warning will be// logged to the Developer Console and the RPCManager will attempt to use the// <code>hiddenFrame</code> transport instead for this request. Note that some features like// +link{RPCRequest.serverOutputAsString} requre the <code>xmlHttpRequest</code> transport and will not// work if the <code>xmlHttpRequest</code> transport is unavailable (this can happen if the end user is// using Internet Explorer and has disabled ActiveX). You can check whether or not the// <code>xmlHttpRequest</code> transport is currently available by calling// +link{RPCManager.xmlHttpRequestAvailable}.//// @see RPCManager.defaultTransport//// @visibility external//<//> @attr rpcRequest.useXmlHttpRequest (boolean : RPCManager.useXmlHttpRequest : IRWA)// // Selects the default http transport for this RPCRequest. If set to true, this request will use// XMLHttpRequest for the transport to the server. If set to false it will use a hidden frame. If// left unset, the transport mechanism is determined from the RPCManager default set in // +link{RPCManager.useXmlHttpRequest}// <p>// If you're using queueing, note that all requests in the queue must use the same transport.// If you attempt to send a request via a different transport than those that are currently on// the queue, it will be sent to the server separately, ahead of the queue, and a warning will// be logged to the Developer Console.// <p>// If you specify <code>true</code> for this attribute and XMLHttp is not available, a warning// will be logged to the Developer Console and RPCManager will attempt to use the frames// transport for this request. Note that some features like// +link{RPCRequest.serverOutputAsString} requre the XMLHttp transport and will not work if the// XMLHttp transport is unavailable (this can happen if the end user is using Internet Explorer// and has disabled ActiveX). You can query the availability of XMLHttp by calling// +link{RPCManager.xmlHttpRequestAvailable()}// // @deprecated As of SmartClient 5.5, use +link{RPCRequest.transport}. If you specify a value// for this property, it will take precedence over +link{RPCRequest.transport}.//// @see RPCManager.useXmlHttpRequest// @see RPCManager.xmlHttpRequestAvailable()//// @visibility external//< //> @attr RPCRequest.httpMethod (String : "POST" : IRW)//// Selects the HTTP method that will be used for the request. Valid values are "POST" and "GET".//// @visibility external//< //> @attr RPCRequest.contentType (String : "application/x-www-form-urlencoded" : IRW)//// Valid with the xmlHttpRequest transport only and only when// +link{attr:RPCRequest.httpMethod} is set to "POST". //// @visibility external//< //> @attr RPCRequest.httpHeaders (Object : null : IRW)// HTTP headers to send, as a Object mapping Header name -> Header value, eg<br>// { "Content-Type" : "text/xml" }// <P>// Valid with the xmlHttpRequest +link{rpcRequest.transport,transport} only.//// @visibility external//<//> @attr RPCRequest.containsCredentials (boolean : false : IRWA)// For use during +link{group:relogin,Relogin}, this property marks this request an attempt to// login, therefore a response containing the <code>loginRequiredMarker</code> is a normal// condition and should result in the status code +link{RPCResponse.STATUS_LOGIN_INCORRECT}// rather than a call to +link{RPCManager.loginRequired(),loginRequired()}.// <P>// It is not required to set <code>containsCredentials</code>, however, it does typically// simplify relogin logic by separating the handling of RPCs that are login attempts from RPCs// that are not.// // @group relogin// @visibility external//<//> @attr RPCRequest.canDropOnDelay (boolean : false : IRWA)// // If the transaction containing this request is requested to be delayed for some reason// (Authentication relogin is one case), then this flag notifies the server that this request does// not have to be ultimately fulfilled when the transaction is unblocked.<p>//// Typically you would set this flag on requests that periodically refresh a component every N// seconds, so only the last update is important.//// @visibility internal//<//> @attr RPCRequest.ignoreTimeout (boolean : false : IRWA)//// When set to true, no reply is expected from the server. However, if a reply is received, it will// be processed.<p>//// Note: setting this to true, forces +link{attr:RPCRequest.sendNoQueue} to <code>true</code> for// this request.//// @visibility external//<//> @attr RPCRequest.sendNoQueue (boolean : false : IRWA)//// When set to true, this request is sent to the server immediately, bypassing any current queue.//// @visibility external//<//> @attr RPCRequest.paramsOnly (boolean : false : IRWA)//// When set to true, assume the request is not going to the SmartClient server, and hence send// a simple HTTP request. Values specified in +link{attr:RPCRequest.params} are sent to to the// server as HTTP request parameters. If +link{httpMethod} method is POST and// +link{rpcRequest.data} is supplied, it is assumed to be a string to post as the HTTP// requestBody.// <p>// Setting this to true automatically defaults +link{RPCRequest.serverOutputAsString} to true// as well.//// @deprecated As of SmartClient 5.6, use +link{RPCRequest.useSimpleHttp} instead.// @visibility external//<
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -