You are not logged in! Log in or Register

ServerWidget

Description

Server widgets can be used by widget builders as blocks that execute code on the server. A serverwidget block can be compared to a function in any programming language with the exception that the code in this function is not executed on the local (client) device, but on the server. Once the result is calculated it is send back to the (client) device.

Attributes

  • BinaryDataChanged [event]: An event that is fired when the binary output has changed.
  • DataChanged [event]: An event that is fired when the output data has changed.
  • Name [string]: The name of the block.
  • ServerUrl [string]: The URL of the server where the Server Widget will be executed. If the attribute is not provided, the default server will be used.
  • ServerWidgetName [string]: When specified, this is the identifier of the serverside widget that is executed.
  • StringChanged [event]: Event raised when the string has changed.

Remarks

  • Parameters [collection of ServerWidgetParameters]: a collection of ServerWidgetParameters that define the input for the ServerWidget. If no parameters are needed, this attribute must still be present but contain no parameters.
  • Code [XML]: the code that is to executed on the server.

Examples

 1 <!-- This piece of code will let the server download an image that would be too large to download and display on a mobile device. The image is resized on the server to at most 80 by 80 pixels and returned to the client, which will display it in a VisualImage block. -->
 2 
 3 <Value Name="val"  StringValue="http://www2.edm.uhasselt.be/casa2007/images/CASA2007_belgium.jpg"/>
 4 
 5 <ServerWidget Name="sitereader">
 6   <ServerWidget.Parameters>
 7     <ServerWidgetParameter Name="url" ValueInput="val"/>
 8   </ServerWidget.Parameters>
 9 
10   <ServerWidget.Code>
11     <ServerWidget>
12 	<InputParameter Name="url" />
13       <BinaryReader Name="reader" Input="url"/>
14       <ImageResizer Name="resizer" Input="reader" TargetSize="80,80" Stretch="false"/>
15       <OutputBlock BinaryInput="resizer"/>
16     </ServerWidget>
17   </ServerWidget.Code>
18 </ServerWidget>
19 
20 <VisualPage>
21   <VisualContent>
22     <VisualImage BinaryInput="sitereader"/>
23   </VisualContent>
24 </VisualPage>
 1 <!-- The above code is equivalent to this example, which uses the existing "resizeimage" serverside widget. -->
 2 
 3 <Value Name="val" StringValue="http://www2.edm.uhasselt.be/casa2007/images/CASA2007_belgium.jpg"/>
 4 
 5 <ServerWidget Name="sitereader" ServerWidgetName="resizeimage">
 6   <ServerWidget.Parameters>
 7     <ServerWidgetParameter Name="url" ValueInput="val"/>
 8   </ServerWidget.Parameters>
 9 </ServerWidget>
10 
11 <VisualPage>
12   <VisualContent>
13     <VisualImage BinaryInput="sitereader"/>
14   </VisualContent>
15 </VisualPage>

See also

User comments

pascalvanhecke says:
June 02nd, 2008 at 6:14 p.m.
As far as I understand, serverwidgets are provided by Citylive? There's no way to develop server widgets of one's own?
Ingo says:
June 25th, 2008 at 5:39 p.m.
Yes you can, the first example is a serverwidget that is created by the user. At runtime, it will be uploaded to the server, processed and the result is returned.

Leave a comment

You need to be logged in to post a comment.