Wednesday, September 24, 2008

Enabling SSL with Granite Data Services

You need to do the below settings in services-config.xml

<services-config>
<services>
<service messageTypes= "flex.messaging. messages. RemotingMessage"
class="flex. messaging. services. RemotingService" id="granite- service">
<destination id="test-service" >
<channels>
<channel ref="my-graniteamf" />
<channel ref="my-secure- graniteamf" />
</channels>
<properties>
<factory>springFact ory</factory>
<source>TestService </source>
</properties>
</destination>
</service>
</services>
<factories>
<factory
class="org.granite. messaging. service.SpringSe rviceFactory"
id="springFactory" />
</factories>
<channels>
<channel-definition class="mx.messaging .channels. AMFChannel"
id="my-graniteamf" >
<endpoint class="flex. messaging. endpoints. AMFEndpoint"
uri="http:// {server.name} :{server. port}/
{context.root} /graniteamf/ amf"/>
</channel-definitio n>
<channel-definition
class="mx.messaging .channels. SecureAMFChannel " id="my-secure-
graniteamf">
<endpoint class="flex. messaging. endpoints. SecureAMFEndpoin t"
uri="https:/ /{server. name}:443/ {context. root}/graniteamf /amfsecure" />
<properties>
<add-no-cache- headers>false< /add-no-cache- headers>
</properties>
</channel-definitio n>
</channels>
</services-config>

Understanding Flex 3 Migration Issues (Part I)

For this week, I thought I would post about some changes in the framework that will likely cause some differences in Flex 2 applications.
Button Changes
Issue during migration: Button labels are now truncated. For example, this code produces a truncated label in Flex 3, but, not Flex 2.

Cause of compatibility issue: In Flex 3, all Buttons have paddingLeft, paddingRight, paddingTop and paddingBottom of 10, by default. Padding styles didn’t work in Flex 2.0.1. The space to the left and right of the Button label in Flex 2.0.1 varied.
Fix: Adjust the paddingStyles. For example -

Issue during migration: The Event.CHANGE event no longer triggers on a Button or CheckBox unless there is user interaction. If the selected property changes programatically, the event doesn’t trigger.
Cause of compatibility issue: There needed to be a distinction of changing the selected property from user interaction vs programmatically.
Fix: If your code changed the selected property, it should know what to do when this happens.
DataGrid Changes:
Issue during migration: DataGrid code that relied on rowCount does not behave the same.
Cause of compatibility issue: rowCount and lockedRowCount no longer include the header. Also, the itemClick event’s rowIndex property returns 0 for the first row of data.
Fix: Adjust your code to look for different rowCount values. Most likely, you’ll need to subtract 1 from any rowCount value used in Flex 2.0.1.
Issue during migration: You get a runtime error or wrong behavior in a custom component that subclassed DataGrid. In this subclassed component, you used MyDataGrid.getChildAt(…) to access various children of the DataGrid, like the vertical scrollbar.
Cause of compatibility issue: The order of children in the DataGrid was changed. For example, in Flex 2, MyDataGrid.getChildAt(3) used to yield the vertical scrollbar. In Flex 3, it doesn’t. MyDataGrid.getChild(4) yields the scrollbar. In general, you shouldn’t expect the order of children to stay the same. We don’t guarantee this.
Fix: If possible, don’t use getChildAt to access internal components of the DataGrid. Otherwise, adjust which child you are accessing.
more ahead…