Packagecom.yworks.remote
Classpublic class HttpServiceFactory
InheritanceHttpServiceFactory Inheritance Object

A Factory that creates and configures HTTPService instances that are configured for interoperability with the yFiles FLEX server API.

See also

com.yworks.support.Config


Public Properties
 PropertyDefined By
  appendExtension : Boolean = true
[static] Whether to append an extension to the service name.
HttpServiceFactory
  defaultContextRoot : String = http://localhost/
[static] The root URL which is used by default.
HttpServiceFactory
  defaultServiceExtension : String
[static] The default extension to append to service name.
HttpServiceFactory
  resolveURLs : Boolean = true
[static] Whether to resolve serviceURLs provided for getService against the "context-root" property retrieved from the Config class.
HttpServiceFactory
  useConfig : Boolean = true
[static] Whether to use the Config class to get the values of the "context-root" and "service-extension" configuration parameters.
HttpServiceFactory
Public Methods
 MethodDefined By
  
getService(serviceURL:String):HTTPService
[static] Create and configure a http service for the given service name.
HttpServiceFactory
Property Detail
appendExtensionproperty
public static var appendExtension:Boolean = true

Whether to append an extension to the service name.

defaultContextRootproperty 
public static var defaultContextRoot:String = http://localhost/

The root URL which is used by default.

defaultServiceExtensionproperty 
public static var defaultServiceExtension:String

The default extension to append to service name.

resolveURLsproperty 
public static var resolveURLs:Boolean = true

Whether to resolve serviceURLs provided for getService against the "context-root" property retrieved from the Config class.

useConfigproperty 
public static var useConfig:Boolean = true

Whether to use the Config class to get the values of the "context-root" and "service-extension" configuration parameters.

If this property is set to false and resolveURLs is true, the defaultContextRoot and defaultServiceExtension paramaters will be used to resolve the URLs.

The default value is true.

Method Detail
getService()method
public static function getService(serviceURL:String):HTTPService

Create and configure a http service for the given service name.

If resolveURLs is true, the Config instance will be queried for the "context-root" parameter. If no context-root parameter can be retrieved from the configuration, the defaultContextRoot is used.

If a custom error XML string is send from the server, the error description will be traced and displayed in an Alert window. The listener that is registered for the result event to check for error messages is registered with a priority of 20. If a custom listener is registered to check for error messages, it has to be added with a priority > 20 and stop the event propagation so the default listener will not be called. Custom error XML strings sent from the server have to conform to the following format:

		    <?xml version="1.0" encoding="UTF-8"?>
		    <response>
		      <errors>
		        <error>
		          <![CDATA[
		            message
		          ]]>
		        </error>
		      </errors>
		    </response>
		   

If the service request fails completely, the FaultEvent will be traced and displayed in an Alert window.

If the created service is used with a RoundtripHandler, custom error handling can be implemented easily using the corresponding handler properties of class RoundtripHandler.

The service's method is set to "POST" and the result format to "e4x".

Parameters

serviceURL:String — The URL for the service (without the root) as String

Returns
HTTPService — The configured HTTPService

See also