<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Blog BaaO</title>
	<atom:link href="http://blog.baao.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.baao.com/blog</link>
	<description>La vraie vie Flex</description>
	<lastBuildDate>Thu, 14 Oct 2010 13:18:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installer Flash Media Server 4 sur CentOS 5.5</title>
		<link>http://blog.baao.com/blog/?p=392</link>
		<comments>http://blog.baao.com/blog/?p=392#comments</comments>
		<pubDate>Thu, 14 Oct 2010 13:14:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[FMS]]></category>
		<category><![CDATA[Installation]]></category>

		<guid isPermaLink="false">http://blog.baao.com/blog/?p=392</guid>
		<description><![CDATA[Installation de Flash Media Server 4 sur Centos 5.5]]></description>
			<content:encoded><![CDATA[<p>Une nouvelle version de Flash Media Server, la 4, est sortie avec son lot de nouveautés (notamment la possibilité de streamer en http)<br />
Nous avions déjà vu l&#8217;installation de <a href="http://blog.baao.com/blog/?p=109">FMS 3 sur Ubuntu</a>.<br />
Cette fois, nous changeons d&#8217;OS et vous proposons <a href="http://www.centos.org/">Centos</a>, basé sur Red Hat.<br />
Flash Media Server s&#8217;installe sans problème sur CentOS (en version 32 bit. Je ferai une màj pour la version 64 bit).</p>
<p>Nous installerons ce serveur dans une machine virtuelle VMWare sur notre Mac.</p>
<p>Récupérez <a href="http://mirror.in2p3.fr/linux/CentOS/5.5/isos/i386/CentOS-5.5-i386-bin-DVD.iso">l&#8217;image du serveur Centos 5.5</a> qui est une version 32 bit</p>
<h1>1 &#8211; Virtualisation</h1>
<p>Pour l&#8217;installer dans VMWare, voici les étapes à suivres:</p>
<ol>
<li>Dans le menu File, cliquer sur New</li>
<li>Sélectionnez le fichier iso que vous venez de récupérer<img class="alignnone size-full wp-image-122" title="vmware-installation-iso1" src="http://box.baao.com/blog/wp-content/uploads/2010/10/selection-iso-centos.png" alt="vmware-installation-iso1"/></li>
<li>Dans le choix du système d&#8217;exploitation, choisissez : <b>Linux</b> et dans version : <b>Autre Linux 2.6</b></li>
</ol>
<p><i>Notes : Dans le dernier panneau de l&#8217;assistant, vous pouvez cliquer sur le bouton de Réglages. Assurez-vous que le réseau est en mode <b>Pont</b> (ou <b>Bridged</b>) afin de pouvoir obtenir une adresse IP pour votre serveur et communiquez avec lui facilement. Ce réglage est modifiable après installation, machine virtuelle arrêtée, via le menu <b>Machines Virtuelles->Réglages</b></i></p>
<p>L&#8217;installation du serveur débute. Suivez les instructions.<br />
<i>Quelques minutes plus tard&#8230;</i><br />
Une fois que CentOS est prêt (vous devez avoir le bureau en mode graphique) nous pouvons commencer à nous intéresser à la partie FMS.</p>
<p>Le clavier Macintosh ne semble pas être reconnu correctement. Pour cela nous allons utiliser le Terminal d&#8217;OS X pour nous connecter sur CentOS.<br />
Arrêter la machine virtuelle de CentOS et cliquez dans le menu <b>Machines Virtuelles->Réglages</b>. Assurez-vous que le réseau est en mode <b>Pont</b> (ou <b>Bridged</b>) afin de pouvoir obtenir une adresse IP pour votre serveur et communiquez avec lui facilement.<br />
Redémarrez CentOS. Lancez un Terminal CentOS et tapez la commande <em>/sbin/ifconfig</em> pour déterminez l&#8217;adresse IP de CentOS (192.168.1.90 pour moi).<br />
Depuis un Terminal OS X, tapez</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #000000; font-weight: bold;">&lt;</span>username<span style="color: #000000; font-weight: bold;">&gt;@&lt;</span>adresse IP Centos<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p> pour vous y connecter (j&#8217;ai créé un nom d&#8217;utilisateur centos).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Corebook:~ olivier$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> centos<span style="color: #000000; font-weight: bold;">@</span>192.168.1.90
The authenticity of host <span style="color: #ff0000;">'localhost (192.168.1.90)'</span> cannot be established.
RSA key fingerprint is cf:<span style="color: #000000;">65</span>:d0:8b:ff:f5:f5:<span style="color: #000000;">93</span>:3c:4b:f7:6e:d6:1c:6a:ed.
Are you sure you want to <span style="color: #7a0874; font-weight: bold;">continue</span> connecting <span style="color: #7a0874; font-weight: bold;">&#40;</span>yes<span style="color: #000000; font-weight: bold;">/</span>no<span style="color: #7a0874; font-weight: bold;">&#41;</span>? <span style="color: #c20cb9; font-weight: bold;">yes</span>
Warning: Permanently added <span style="color: #ff0000;">'centos,192.168.1.90'</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>RSA<span style="color: #7a0874; font-weight: bold;">&#41;</span> to the list of known hosts.
centos<span style="color: #000000; font-weight: bold;">@</span>190.168.1.90 password:</pre></div></div>

<p></i></p>
<h1>2 &#8211; Flash Media Server</h1>
<p>Nous pouvons maintenant nous concentrer sur la partie Flash Media Server. Pour commencer nous allons le <a href="http://www.adobe.com/products/flashmediaserver/" target="_new">télécharger ici</a>. (il vous faudra un compte Adobe)<br />
J&#8217;ai récupéré la version Flash Media Streaming Server 4 (en version Linux).</p>
<p>Vous allez récupérer un fichier zip (FlashMediaServer_4_all.zip) d&#8217;environ 460 Mo. Après extraction, allez dans le répertoire
<li>linux</li>
<p> pour y trouver deux fichiers:</p>
<ul>
<li>FlashMediaServer4_x64.tar.gz</li>
<li>FlashMediaServer4.tar.gz</li>
</ul>
<p>Lancez un autre Terminal OSX, tapez les commandes suivantes pour copier l&#8217;archive FMS sur notre serveur CentOS (dans la commande scp, remplacer centos par votre nom d&#8217;utilisateur CentOS et l&#8217;adresse IP par celle affiché par la commande ifconfig):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Corebook:~ olivier$ <span style="color: #7a0874; font-weight: bold;">cd</span> Downloads<span style="color: #000000; font-weight: bold;">/</span>FlashMediaServer_4_all<span style="color: #000000; font-weight: bold;">/</span>linux
Corebook:linux olivier$ <span style="color: #c20cb9; font-weight: bold;">scp</span> FlashMediaServer4.tar.gz centos<span style="color: #000000; font-weight: bold;">@</span>192.168.1.90:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>centos</pre></div></div>

<p>Une fois la copie terminée, revenez sur la session CentOS de votre Terminal OS X et décompressez l&#8217;archive sur place:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">centos<span style="color: #000000; font-weight: bold;">@</span>locahost:~$ <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> FlashMediaServer4.tar.gz</pre></div></div>

<p>Un répertoire FMS_4_0_0_r1121 est créé (au moment de la rédaction de cet article).</p>
<p>Pour installer FMS, nous devons passer en mode superuser :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">centos<span style="color: #000000; font-weight: bold;">@</span>localhost:~$ <span style="color: #c20cb9; font-weight: bold;">su</span>
root<span style="color: #000000; font-weight: bold;">@</span>localhost:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> FMS_4_0_0_r1121
root<span style="color: #000000; font-weight: bold;">@</span>localhost:~<span style="color: #000000; font-weight: bold;">/</span>FMS_4_0_0_r1121$ .<span style="color: #000000; font-weight: bold;">/</span>installFMS</pre></div></div>

<p>Le processus d&#8217;installation commence.</p>
<ul>
<li>Faites défiler les termes de la license en appuyant frénétiquement sur la barre espace.</li>
<li>A la demande du numéro de license, appuyer sur la touche Entrée. FMS se lancera en mode développement (limité en connexion)</li>
<li>Pour les autres questions, appuyer sur Entrée pour accepter les valeurs par défaut. Les valeurs sont stockées dans le fichier <strong>/conf/fms.ini</strong>.</li>
</ul>
<h1>3 &#8211; Comment tester ?</h1>
<p>Le plus simple pour tester la configuration et d&#8217;essayer de streamer la video d&#8217;exemple fournie avec FMS.<br />
Pour cela, nous allons effectuer une petite modification de la configuration de notre serveur Apache sur CentOS qui nous permettra de streamer la video directement depuis Safari sur le Mac.</p>
<p>Dans le Terminal OS X connecté en SSH à CentOS, ouvrez le fichier de configuration d&#8217;apache (en mode superuser)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>localhost:~$ <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</pre></div></div>

<p>En fin de fichier, ajouter les lignes suivantes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Alias for fms webroot</span>
Alias <span style="color: #000000; font-weight: bold;">/</span>fms <span style="color: #ff0000;">&quot;/opt/adobe/fms/webroot&quot;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>directory <span style="color: #ff0000;">&quot;/opt/adobe/fms/webroot&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
       Options Indexes FollowSymLinks MultiViews ExecCGI
       AllowOverride All
       Order allow,deny
       Allow from all
<span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Par ces lignes nous indiquons à Apache de créer un répertoire virtuel (accessible depuis le navigateur), sur le répertoire <em>/opt/adobe/fms/webroot</em> où se trouvent les fichiers d&#8217;exemples d&#8217;Adobe.<br />
Relancez Apache:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>localhost:~$ <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>httpd restart</pre></div></div>

<p>Dans Safari sur votre Mac, tapez l&#8217;url suivante: <strong>http://190.168.1.90/fms</strong> pour accéder à la page d&#8217;accueil (Flash Player 10 obligatoire).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=392</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installer Flash Builder 4 et les web tools</title>
		<link>http://blog.baao.com/blog/?p=381</link>
		<comments>http://blog.baao.com/blog/?p=381#comments</comments>
		<pubDate>Wed, 13 Oct 2010 08:46:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Installation]]></category>

		<guid isPermaLink="false">http://blog.baao.com/blog/?p=381</guid>
		<description><![CDATA[Dans cet article, nous allons voir les différentes étapes nécessaires à l'installation de Flash Builder 4 et de son plugin compagnon, les webtools, qui lui permet de créer des projets java.]]></description>
			<content:encoded><![CDATA[<p>Dans cet article, nous allons voir les différentes étapes nécessaires à l&#8217;installation de Flash Builder 4 et de son plugin compagnon, les webtools, qui lui permet de créer des projets java.</p>
<p>Comme pour la version précédente l&#8217;IDE vient sous deux formes :</p>
<ul>
<li>version autonome</li>
<li>version plugin pour éclipse</li>
</ul>
<p>Les fonctionnalités proposées sont identiques. Ici nous parlerons de la version autonome.</p>
<h1>1-Récupération et installation de FB4</h1>
<p>Rendez-vous sur <a href="http://www.adobe.com/fr/products/flashbuilder/">cette page</a>. Là, cliquez sur le bouton [Version d'Evaluation] pour charger la page qui vous proposera la version de FB4 à télécharger en fonction des informations récupérées depuis votre environnement.</p>
<p>Je prends ici la version en anglais, étant habitué aux libellés des menus dans cette langue.</p>
<p>Une fois l&#8217;archive récupérée et décompressée aller dans le dossier <em>Adobe Flash Builder 4 Standalone</em>, et lancer l&#8217;application <em>Install</em> et laissez-vous guider par l&#8217;assistant d&#8217;installation.<br />
Adobe en profite pour vous installer Flash Player 10, puisque c&#8217;est la version minimum pour exécuter du code Flex 4.</p>
<p>Une fois l&#8217;installation terminée, lancez l&#8217;application et poursuivons la configuration.</p>
<h1>2-Installation des WebTools</h1>
<p>Les WebTools sont un ensemble de composant qui vont ajouter a Eclipse la possibililité de créer des applications web en java.<br />
Un des éléments intéressant est la possibilité de gérer, depuis Eclipse, votre serveur d&#8217;application java (Tomcat par exemple), ce qui permet de débugger le code java, lancer et arrêter le serveur.<br />
Pour les ajouter, procéder aux étapes suivantes:</p>
<ol>
<li>Dans FlashBuilder, allez dans le menu Help puis sélectionnez Install New Software&#8230;pour faire apparaître la boîte suivante. Cliquer sur le bouton <strong>Add&#8230;</strong>
<p><div id="attachment_257" class="wp-caption alignnone" style="width: 382px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png"><img class="size-full wp-image-257  " title="ajouter software site" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png" alt="" width="372" height="310" /></a><p class="wp-caption-text">Ajout d&#39;un serveur de plugin</p></div></li>
<li>Dans la boîte de dialogue qui apparaît, remplissez les champs tel que montré sur l&#8217;image ci-dessous pour créer une connection au serveur de mise à jour d&#8217;Eclipse (le socle de base de FlashBuilder) : http://download.eclipse.org/releases/galileo/<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png"><img class="alignnone size-full wp-image-258" title="Picture 10" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png" alt="" width="555" height="266" /></a></li>
<li>Pour ajouter les outils Web Java, sélectionnez ce nouveau site en dans la liste déroulante si ce n&#8217;est pas déjà le cas. Patienter le temps que FlashBuilder récupére la liste des plugins disponibles, puis sélectionnez celui intitulé <em>Web, XML and Java EE Development</em>
<p><div id="attachment_259" class="wp-caption alignnone" style="width: 482px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png"><img class="size-full wp-image-259" title="choix plugin J2EE" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png" alt="" width="472" height="451" /></a><p class="wp-caption-text">choix plugin J2EE</p></div></li>
<li>Cliquez sur les boutons <strong>Next&gt;</strong> et acceptez le texte de la license pour finir l&#8217;installation</li>
<li>Redémarrez FlashBuilder</li>
</ol>
<p>Voilà ! c&#8217;est prêt.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=381</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créer une application Flash Builder 4 communicant avec une autre application BlazeDS</title>
		<link>http://blog.baao.com/blog/?p=311</link>
		<comments>http://blog.baao.com/blog/?p=311#comments</comments>
		<pubDate>Wed, 12 May 2010 05:56:06 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Blaze DS]]></category>
		<category><![CDATA[Installation]]></category>

		<guid isPermaLink="false">http://blog.baao.com/blog/?p=311</guid>
		<description><![CDATA[Dans ce billet, nous allons présenter les différentes étapes nécessaires pour la création d'une application Flex communicant avec une application serveur Java / BlazeDS créés chacune dans deux projets différents.]]></description>
			<content:encoded><![CDATA[<p>Dans ce billet, nous allons présenter les différentes étapes nécessaires pour la création d&#8217;une application Flex communicant avec une application serveur Java / BlazeDS créés chacune dans deux projets différents.</p>
<h1>1 &#8211; Les installations</h1>
<h2>FlashBuilder 4</h2>
<p>Récupérer FlashBuilder 4 sur <a href="http://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder" target="_blank">cette page</a> (nous utiliserons ici la version standalone en anglais pour Mac) et l&#8217;installer.</p>
<h2>BlazeDS (3 ou 4)</h2>
<p>Récupérer BlazeDS 4 sur la page du site des <a href="http://opensource.adobe.com/wiki/display/blazeds/download+blazeds+4" target="_blank">builds</a> (nous utiliserons ici le binaire (3MB) la version 4.0.0.1493 GA d&#8217;avril 2010).</p>
<h2>Tomcat 6</h2>
<p>Récupérer Tomcat 6 sur la <a href="http://tomcat.apache.org/download-60.cgi" target="_blank">page suivante</a> . Dézipper pour installer.</p>
<h2>Les WebTools</h2>
<p><strong>ATTENTION</strong> : Lorsque ce billet a été écrit, l&#8217;installation du plugin des WebTools entre en conflit avec le plugin de modeling, une nouvelle fonctionnalité proposée par LiveCycleDS. Ne procédez aux étapes suivantes que si vous êtes sûrs de ne pas utiliser LiveCycleDS.</p>
<p>Les WebTools sont un ensemble d&#8217;outils qui ajouteront des fonctionnalités à FlashBuilder, notamment pour développer des applications Web Java</p>
<p>Pour les ajouter, procéder aux étapes suivantes:</p>
<ol>
<li>Dans FlashBuilder, aller dans le menu Help puis sélectionnez Install New Software&#8230;pour faire apparaître la boîte suivante. Cliquer sur le bouton Add&#8230;
<div id="attachment_257" class="wp-caption alignnone" style="width: 382px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png"><img class="size-full wp-image-257  " title="ajouter software site" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png" alt="" width="372" height="310" /></a><p class="wp-caption-text">Ajout d&#39;un serveur de plugin</p></div></li>
<li>Dans la boîte de dialogue qui apparaît, remplissez les champs tel que montré sur l&#8217;image ci-dessous pour créer une connection au serveur de mise à jour d&#8217;Eclipse (le socle de base de FlashBuilder) : http://download.eclipse.org/releases/galileo/<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png"><img class="alignnone size-full wp-image-258" title="Picture 10" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png" alt="" width="555" height="266" /></a></li>
<li>Pour ajouter les outils Web Java, sélectionnez le nouveau site en dans la liste déroulante. Patienter le temps que FlashBuilder récupére la liste des plugin disponibles, puis sélectionner celui intitulé <em>Web, XML and Java EE Development</em>
<p><div id="attachment_259" class="wp-caption alignnone" style="width: 482px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png"><img class="size-full wp-image-259" title="choix plugin J2EE" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png" alt="" width="472" height="451" /></a><p class="wp-caption-text">choix plugin J2EE</p></div></li>
<li>Redémarrer FlashBuilder</li>
</ol>
<h1>2 &#8211; Préparation du projet Java</h1>
<p>Basculer en perspective Java EE. Dans le menu de FlashBuilder, sélectionner dans la vue Project Explorer, faire un clic droit Import > War file.<br />
Dans la boîte de dialogue, cliquer sur le bouton Browse&#8230; pour sélectionner le fichier blazeds.war.<br />
Dans le champ Web project, entrer le nom de l&#8217;application serveur.<br />
Il reste en configurer Tomcat dans Eclipse.<br />
En face de Target Runtime, cliquer sur le bouton New&#8230;, sélectionner Apache>Apache Tomcat v6.0 puis cliquer sur le bouton Next.</p>
<p>Dans la fenêtre de choix du serveur, sélectionner Apache &gt; Tomcat v6.0<br />
<div id="attachment_264" class="wp-caption alignnone" style="width: 537px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-3.png"><img class="size-full wp-image-264" title="Choix serveur Tomcat" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-3.png" alt="" width="527" height="651" /></a><p class="wp-caption-text">Choix serveur Tomcat</p></div>
<p>puis choisir son répertoire d&#8217;installation en cliquant sur le bouton Browse&#8230; , puis Finish<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-4.png"><img class="alignnone size-full wp-image-265" title="Picture 4" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-4.png" alt="" width="560" height="650" /></a></p>
<p>On revient alors sur le panneau War Import avec le Target Runtime positionné sur Apache Tomcat v6.0. Cliquer sur le bouton Finish.<br />
<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/war-import.png"><img class="alignnone size-full wp-image-265" title="Picture 4" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/war-import.png" alt=""/></a></p>
<p>Il reste à rendre afficher ce serveur dans la vue Servers. Si cette dernière n&#8217;est pas déjà présente, vous pouvez l&#8217;afficher en allant dans le menu Window &gt; Other Views&#8230;Dans la boite de dialogue Show Views qui apparaît, sélectionner la vue Servers<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Show-Views.png"><img class="alignnone size-full wp-image-289" title="Show Views" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Show-Views.png" alt="" width="384" height="498" /></a></p>
<p>A l&#8217;intérieur de cette vue, faire un clic droit puis New &gt; Server et là, sélectionner Apache &gt; Tomcat v6.0 Server.</p>
<h1>3 &#8211; Création de l&#8217;application serveur Java/BlazeDS</h1>
<p>Dézipper le fichier .war (en le renommant .zip) pour pouvoir accéder à son contenu.<br />
Dans un explorateur de fichier glisser tous les éléments du dossier <strong>WEB-INF</strong>, <strong>sauf</strong> le dossier <strong>src</strong>, dans le dossier WebContent/WEB-INF de votre application Java (ce n&#8217;est pas bien grave de glisser également src, mais il n&#8217;est pas utile). Le fichier web.xml ainsi que le dossier lib seront remplacés par ceux de BlazeDS.</p>
<p>Passer en perspective J2EE pour écrire la petite classe Java. Sur le dossier Ressource Java créer un package appelé <strong>baao</strong> (faire un clic droit puis dans le menu contextuel New &gt; Package ).</p>
<p>Puis, toujours dans ce même dossier, créer une classe <strong>TransformationText</strong> (click droit, New &gt; Class)</p>
<p>Dans cette classe, taper le code suivant:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">baao</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TransformationText
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> inverser<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> aValue<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span> aValue <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">reverse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> mettreEnMajuscule<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> aValue<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> aValue.<span style="color: #006633;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Notre petite application web Java est terminée. Il faut maintenant l&#8217;ajouter à Tomcat pour qu&#8217;elle soit exécutée. Dans la vue Servers, faire un clic droit sur la ligne Tomcat, et dans le menu contextuel sélectionner <strong>Add and Remove Projects</strong>&#8230;Double cliquer sur le projet JavaBlazeDS à gauche pour le faire passer dans la liste <em>Configured</em><br />
<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Add-project.png"><img src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Add-project.png" alt="" title="Add-project" width="605" height="625" class="alignnone size-full wp-image-331" /></a><br />
La classe étant prête, il ne reste plus qu&#8217;à exposer ses méthodes publiques aux applications Flex grâce à BlazeDS.</p>
<h1>4 &#8211; Configuration BlazeDS</h1>
<p>Nous allons créer la destination correspondant à notre classe Java dans le fichier remoting-config.xml situé dans le répertoire WebContent &gt; WEB-INF &gt; flex du projet . Juste avant la balise fermante &lt;/service&gt;, ajouter ce qui suit:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">	<span style="color: #000000;">&lt;destination id=<span style="color: #ff0000;">&quot;textService&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;properties<span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;source<span style="color: #7400FF;">&gt;</span></span>baao.TransformationText<span style="color: #000000;">&lt;/source<span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;scope<span style="color: #7400FF;">&gt;</span></span>application<span style="color: #000000;">&lt;/scope<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;/properties<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/destination<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Nous pouvons à présent démarrer le serveur Tomcat, en faisant clic droit sur sa ligne dans la vue Servers, puis Start</p>
<h1>Création de l&#8217;application Flex</h1>
<p>Basculer en perspective Flex Dans le menu, sélectionner File > New > Flex Project. Entrer le nom du projet (Flex2Blaze) et sélectionner dans la section serveur J2EE, puis BlazeDS. Assurez-vous que la case Create combined&#8230; est bien décochée<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/New-Flex-1.png"><img src="http://blog.baao.com/blog/wp-content/uploads/2010/05/New-Flex-1.png" alt="" title="New-Flex-1" width="731" height="843" class="alignnone size-full wp-image-333" /></a><br />
Cliquez sur Next ></p>
<p>Dans le champ Root folder, à l&#8217;aide du bouton Browse&#8230;sélectionner le dossier WebContent de votre application JavaBlazeDS précédemment créée.<br />
Dans le champ Root URL, entrer l&#8217;url permettant d&#8217;accéder à l&#8217;application JavaBlazeDS<br />
Dans le Context root entrer le contexte de l&#8217;application JavaBlazeDS</p>
<p>Cliquer sur le bouton Validate Configuration. L&#8217;avertissement en haut de la boîte n&#8217;est pas bloquant. Cliquez sur Finish<br />
Sélectionner le répertoire contenant le WEB-INF de l&#8217;application JavaBlazeDS<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/New-flex-2.png"><img src="http://blog.baao.com/blog/wp-content/uploads/2010/05/New-flex-2.png" alt="" title="New-flex-2" width="744" height="557" class="alignnone size-full wp-image-335" /></a><br />
Ouvrer le fichier Flex2Blaze.mxml et copier le code ci-dessous:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span> minWidth=<span style="color: #ff0000;">&quot;955&quot;</span> minHeight=<span style="color: #ff0000;">&quot;600&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RemoteObject</span> id=<span style="color: #ff0000;">&quot;ro&quot;</span> destination=<span style="color: #ff0000;">&quot;textService&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;mot&quot;</span> enter=<span style="color: #ff0000;">&quot;ro.inverser(mot.text);ro.mettreEnMajuscule(mot.text)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> text=<span style="color: #ff0000;">&quot;{ro.inverser.lastResult}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> text=<span style="color: #ff0000;">&quot;{ro.mettreEnMajuscule.lastResult}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>	
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Il ne reste plus qu&#8217;à tester, en faisant simplement clic droit sur le fichier Flex2Blaze.mxml puis Run Application<div id="attachment_336" class="wp-caption alignnone" style="width: 664px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-12.png"><img src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-12.png" alt="" title="Exécution de l&#039;application" width="654" height="138" class="size-full wp-image-336" /></a><p class="wp-caption-text">Exécution de l'application</p></div></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=311</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Créer une application Flash Builder 4 / BlazeDS combinée</title>
		<link>http://blog.baao.com/blog/?p=255</link>
		<comments>http://blog.baao.com/blog/?p=255#comments</comments>
		<pubDate>Tue, 11 May 2010 09:22:57 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Blaze DS]]></category>

		<guid isPermaLink="false">http://blog.baao.com/blog/?p=255</guid>
		<description><![CDATA[Dans ce billet, nous allons présenter les différentes étapes nécessaires pour la création d'une application Flex communicant avec un serveur Java / BlazeDS toutes les deux créés dans un même projet.]]></description>
			<content:encoded><![CDATA[<p>Dans ce billet, nous allons présenter les différentes étapes nécessaires pour la création d&#8217;une application Flex communicant avec un serveur Java / BlazeDS toutes les deux créés dans un même projet.</p>
<p>[Note] Cette méthode reste problématique, suivant certaines configurations (version de FB4, WTP installé&#8230;). Un bug a été soumis à Adobe ( <a href="http://bugs.adobe.com/jira/browse/FB-22939">bug WTP</a> ). Nous attendrons sa résolution pour mettre à jour ce billet.<br />
N&#8217;hésitez pas à voter pour la correction de ce bug pour augmenter sa priorité</p>
<p>Un billet similaire avait été écrit pour la version 3 de FlexBuilder. Cette version est adaptée à FlashBuilder 4.</p>
<h1>1 &#8211; Les installations</h1>
<h2>FlashBuilder 4</h2>
<p>Récupérer FlashBuilder 4 sur <a href="http://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder" target="_blank">cette page</a> (nous utiliserons ici la version standalone en anglais pour Mac) et l&#8217;installer.</p>
<h2>BlazeDS (3 ou 4)</h2>
<p>Récupérer BlazeDS 4 sur la page du site des <a href="http://opensource.adobe.com/wiki/display/blazeds/download+blazeds+4" target="_blank">builds</a> (nous utiliserons ici le binaire (3MB) la version 4.0.0.1493 GA d&#8217;avril 2010).</p>
<h2>Tomcat 6</h2>
<p>Récupérer Tomcat 6 sur la <a href="http://tomcat.apache.org/download-60.cgi" target="_blank">page suivante</a> . Dézipper pour installer.</p>
<h2>Les WebTools</h2>
<p><strong>ATTENTION</strong> : Lorsque ce billet a été écrit, l&#8217;installation du plugin des WebTools entre en conflit avec le plugin de modeling, une nouvelle fonctionnalité proposée par LiveCycleDS. Ne procédez aux étapes suivantes que si vous êtes sûrs de ne pas utiliser LiveCycleDS.</p>
<p>Les WebTools sont un ensemble d&#8217;outils qui ajouteront des fonctionnalités à FlashBuilder, notamment pour développer des applications Web Java</p>
<p>Pour les ajouter, procéder aux étapes suivantes:</p>
<ol>
<li>Dans FlashBuilder, aller dans le menu Help puis sélectionnez Install New Software&#8230;pour faire apparaître la boîte suivanteCliquer sur le bouton Add&#8230;
<div id="attachment_257" class="wp-caption alignnone" style="width: 382px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png"><img class="size-full wp-image-257  " title="ajouter software site" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-11.png" alt="" width="372" height="310" /></a><p class="wp-caption-text">Ajout d&#39;un serveur de plugin</p></div></li>
<li>Dans la boîte de dialogue qui apparaît, remplissez les champs tel que montré sur l&#8217;image ci-dessous pour créer une connection au serveur de mise à jour d&#8217;Eclipse (la base de FlashBuilder) : http://download.eclipse.org/releases/galileo/<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png"><img class="alignnone size-full wp-image-258" title="Picture 10" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-10.png" alt="" width="555" height="266" /></a></li>
<li>Pour ajouter les outils Web Java, sélectionnez le nouveau site en dans la liste déroulante. Patienter le temps que FlashBuilder récupére la liste des plugin disponibles, puis sélectionner celui intitulé <em>Web, XML and Java EE Development</em>
<p><div id="attachment_259" class="wp-caption alignnone" style="width: 482px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png"><img class="size-full wp-image-259" title="choix plugin J2EE" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-1.png" alt="" width="472" height="451" /></a><p class="wp-caption-text">choix plugin J2EE</p></div></li>
<li>Redémarrer FlashBuilder</li>
</ol>
<h1>2 &#8211; Préparation du projet Flex/Java dans le même projet</h1>
<p><div id="attachment_261" class="wp-caption alignnone" style="width: 497px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/wizard1.png"><img class="size-full wp-image-261" title="nouveau projet" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/wizard1.png" alt="" width="487" height="675" /></a><p class="wp-caption-text">nouveau projet</p></div>
<p>Sélection dans le menu File &gt; New &gt; Flex Project. Dans la boîte de dialogue, remplissez les champs comme sur l&#8217;image ci-dessous, puis cliquez sur Next &gt;</p>
<div id="attachment_262" class="wp-caption alignnone" style="width: 562px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-2.png"><img class="size-full wp-image-262" title="serveur J2EE à configurer" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-2.png" alt="" width="552" height="435" /></a><p class="wp-caption-text">serveur J2EE à configurer</p></div>
<p>Dans la nouvelle fenêtre nous allons configurer le serveur web Java qui fera tourner notre petite application. Cliquez sur le bouton New&#8230;</p>
<div id="attachment_264" class="wp-caption alignnone" style="width: 537px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-3.png"><img class="size-full wp-image-264" title="Choix serveur Tomcat" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-3.png" alt="" width="527" height="651" /></a><p class="wp-caption-text">Choix serveur Tomcat</p></div>
<p>Dans la fenêtre de choix du serveur, sélectionner Apache &gt; Tomcat v6.0</p>
<p>puis choisir son répertoire d&#8217;installation en cliquant sur le bouton Browse&#8230; ,puis Finish<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-4.png"><img class="alignnone size-full wp-image-265" title="Picture 4" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-4.png" alt="" width="560" height="650" /></a></p>
<p>De retour sur la boîte de configuration du serveur cliquer dans la liste déroulante pour sélectionner Apache Tomcat, puis cliquez sur Browse du champ BlazeDS WAR File pour sélectionner le fichier .war</p>
<div id="attachment_266" class="wp-caption alignnone" style="width: 562px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-5.png"><img class="size-full wp-image-266" title="war blazeds" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Picture-5.png" alt="" width="552" height="435" /></a><p class="wp-caption-text">war blazeds</p></div>
<p>NOTE: Un message d&#8217;alerte peut apparaitre en haut de cette boîte de dialogue. Il est sans conséquence.</p>
<p><strong>IMPORTANT</strong> : Le champ ContentFolder doit comporter la même valeur que le Context root. Cette valeur est utilisée dans l&#8217;url de connexion Flex-Serveur.<br />
Il est possible de modifier directement le fichier de propriétés. Ouvrez le fichier .flexProperties situé à la racine du projet que l&#8217;on vient de créer. Chercher la propriété <strong>serverContextRoot</strong> et modifier sa valeur (/WebContent en général) par <strong>/FlexAndJava</strong></p>
<p>Le WebContent doit simplement être le même que le nom de l&#8217;application.</p>
<p>Puis cliquer sur Finish</p>
<p><strong>Attention</strong>. Si le panel Flex Server (dans les propriétés de FlashBuilder) est ouvert, il écrasera cette modification. Il faudra donc de nouveau modifier le fichier et faire un clean du projet.</p>
<p>Il reste à rendre afficher ce serveur dans la vue Servers. Si cette dernière n&#8217;est pas déjà présente, vous pouvez l&#8217;afficher en allant dans le menu Window &gt; Other Views&#8230;Dans la boite de dialogue Show Views qui apparaît, sélectionner la vue Servers<a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Show-Views.png"><img class="alignnone size-full wp-image-289" title="Show Views" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Show-Views.png" alt="" width="384" height="498" /></a></p>
<p>A l&#8217;intérieur de cette vue, faire un clic droit puis New &gt; Server et là, sélectionner Apache &gt; Tomcat v6.0 Server.</p>
<h1>3 &#8211; Création de l&#8217;application serveur Java/BlazeDS</h1>
<p>Passer en perspective J2EE pour écrire la petite classe Java. Sur le dossier Ressource Java créer un package appelé <strong>baao</strong> (faire un clic droit puis dans le menu contextuel New &gt; Package ).</p>
<p>Puis, toujours dans ce même dossier, créer une classe <strong>TransformationText</strong> (click droit, New &gt; Class)</p>
<p>Dans cette classe, taper le code suivant:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">baao</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TransformationText
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> inverser<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> aValue<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000000; font-weight: bold;">new</span> StringBuilder<span style="color: #009900;">&#40;</span> aValue <span style="color: #009900;">&#41;</span>.<span style="color: #006633;">reverse</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> mettreEnMajuscule<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> aValue<span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> aValue.<span style="color: #006633;">toUpperCase</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<div id="attachment_290" class="wp-caption alignnone" style="width: 532px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Add-remove-projects.png"><img class="size-full wp-image-290" title="Installer la WebApp dans Tomcat" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Add-remove-projects.png" alt="" width="522" height="598" /></a><p class="wp-caption-text">Installer la WebApp dans Tomcat</p></div>
<p>Notre petite application web Java est terminée. Il faut maintenant l&#8217;ajouter à Tomcat pour qu&#8217;elle soit exécutée. Dans la vue Servers, faire un clic droit sur la ligne Tomcat, et dans le menu contextuel sélectionner <strong>Add and Remove Projects</strong>&#8230;Double cliquer sur le projet FlexAndJava à gauche pour le faire passer dans la liste <em>Configured</em></p>
<p>La classe étant prête, il ne reste plus qu&#8217;à exposer ses méthodes publiques aux applications Flex grâce à BlazeDS.</p>
<h1>4 &#8211; Configuration BlazeDS</h1>
<p>Nous allons créer la destination correspondant à notre classe Java dans le fichier remoting-config.xml situé dans le répertoire WebContent &gt; WEB-INF &gt; flex du projet . Juste avant la balise fermante &lt;/service&gt;, ajouter ce qui suit:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">	<span style="color: #000000;">&lt;destination id=<span style="color: #ff0000;">&quot;textService&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;properties<span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;source<span style="color: #7400FF;">&gt;</span></span>baao.TransformationText<span style="color: #000000;">&lt;/source<span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;">&lt;scope<span style="color: #7400FF;">&gt;</span></span>application<span style="color: #000000;">&lt;/scope<span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;/properties<span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;">&lt;/destination<span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Nous pouvons à présent démarrer le serveur Tomcat, en faisant clic droit sur sa ligne dans la vue Servers, puis Start</p>
<h1>5 &#8211; Création de l&#8217;application Flex</h1>
<p>Basculer en perspective Flex. Dans le répertoire src-flex, ouvrir l&#8217;application en double-cliquant sur le fichier FlexAndJava.mxml<br />
Entrer le code suivant:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span> minWidth=<span style="color: #ff0000;">&quot;955&quot;</span> minHeight=<span style="color: #ff0000;">&quot;600&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:RemoteObject</span> id=<span style="color: #ff0000;">&quot;ro&quot;</span> destination=<span style="color: #ff0000;">&quot;textService&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:VerticalLayout</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;mot&quot;</span> enter=<span style="color: #ff0000;">&quot;ro.inverser(mot.text);ro.mettreEnMajuscule(mot.text)&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> text=<span style="color: #ff0000;">&quot;{ro.inverser.lastResult}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> text=<span style="color: #ff0000;">&quot;{ro.mettreEnMajuscule.lastResult}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>	
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Il ne reste plus qu&#8217;à tester.</p>
<h1>6 &#8211; Exécuter l&#8217;application</h1>
<div id="attachment_298" class="wp-caption alignnone" style="width: 521px"><a href="http://blog.baao.com/blog/wp-content/uploads/2010/05/Execution.png"><img class="size-full wp-image-298" title="Hello World!" src="http://blog.baao.com/blog/wp-content/uploads/2010/05/Execution.png" alt="" width="511" height="138" /></a><p class="wp-caption-text">Hello World!</p></div>
<p>En Flex 3, il suffirait de sélectionner dans le menu Run &gt; Run FlexAndJava pour lancer l&#8217;application dans le navigateur.<br />
En Flex 4 cette même opération entraîne une page d&#8217;erreur 404. En regardant l&#8217;url on comprend pourquoi :</p>
<p>http://localhost:8080/FlexAndJava/FlexAndJava/bin-debug/FlexAndJava.html</p>
<p>L&#8217;url n&#8217;appelle pas notre web application correctement.<br />
Il faut corriger l&#8217;url en : http://localhost:8080/FlexAndJava/FlexAndJava.html</p>
<p>Voilà.</p>
<p>Il semble qu&#8217;Adobe ne teste pas trop ce type de configuration (vu le nombre de correction à faire) qui est pourtant très pratique pour faire petite application.</p>
<p>Pour des applications de plus grande envergure, une séparation des projets Flex et Java est préférable. Cette installation est expliquée dans un autre billet.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=255</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Génération de classes AS3 depuis Java pour Flex</title>
		<link>http://blog.baao.com/blog/?p=228</link>
		<comments>http://blog.baao.com/blog/?p=228#comments</comments>
		<pubDate>Thu, 02 Jul 2009 14:52:18 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Blaze DS]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=228</guid>
		<description><![CDATA[Une des tâches les plus ingrate mais nécessaire lorsqu'on écrit une application Flex/Java communiquant en RemoteObject, c'est d'écrire les classes AS3 correspondant aux classes Java.
Heureusement, il existe un certain nombre d'outil de génération automatique et je vous présente dans ce billet DTO2Fx]]></description>
			<content:encoded><![CDATA[<p>Une des tâches les plus ingrate mais nécessaire lorsqu&#8217;on écrit une application Flex/Java communiquant en RemoteObject, c&#8217;est d&#8217;écrire les classes AS3 correspondant aux classes Java.<br />
Cela est nécessaire pour que le mécanisme de mapping automatique de Flex fonctionne, mais c&#8217;est fastidieux et nécessite une synchronisation permanente.<br />
Heureusement, il existe un certain nombre d&#8217;outil de génération automatique. J&#8217;en ai découvert un récemment (merci Adrien) qui m&#8217;a semblé particulièrement intéressant.</p>
<p>Je vous propose de vous le présenter rapidement (d&#8217;après le doc d&#8217;installation fournie).</p>
<h1>Installation</h1>
<p>Récupérer la doc <a href="http://flexblog.faratasystems.com/?p=357">ici</a> ainsi que les jars nécessaires : <a href="http://www.myflex.org/beta/dto2fx/com.farata.dto2fx.asap_1.0.0.jar">plugin</a> et <a href="http://www.myflex.org/beta/dto2fx/com.farata.dto2fx.annotations.jar">annotations</a> .</p>
<p>Jar du plugin:<br />
Ajouter le jar du plugin dans le répertoire plugins de votre Eclipse.</p>
<p>Jar des annotations:<br />
Créer un projet Flex/Java en comme d&#8217;habitude, puis faites un clic-droit sur le projet pour ouvrir ses propriétés. Sélectionnez l&#8217;élément &laquo;&nbsp;Java Build Path&nbsp;&raquo; sur la gauche pour pouvoir ajouter le .jar (utilisez le bouton &laquo;&nbsp;Add External Jar&#8230;&nbsp;&raquo;)<br />
<img class="alignnone size-large wp-image-230" title="dto2fx-add-jar" src="http://box.baao.com/blog/wp-content/uploads/2009/07/dto2fx-add-jar-550x219.png" alt="dto2fx-add-jar" width="550" height="219" /></p>
<h1>Configuration</h1>
<p>Nous allons maintenant donnez quelques informations à cet utilitaire pour qu&#8217;il sache où générer les classes AS3.</p>
<p>Encore dans cette boîte de dialogue, allez dans Java Compiler-&gt;Annotation Processing-&gt;Factory Path, pour y cocher la case &laquo;&nbsp;Enable project specific settings&nbsp;&raquo; puis cliquez sur le bouton Apply.<br />
<img class="alignnone size-full wp-image-231" title="dto2fx-enable-annotation" src="http://box.baao.com/blog/wp-content/uploads/2009/07/dto2fx-enable-annotation.png" alt="dto2fx-enable-annotation" width="522" height="315" /></p>
<p>Toujours dans cette même boîte de dialogue, revenez sur le menu parent (Annotation Processing) pour y ajouter une nouvelle option pour cette annotation.<br />
Cliquez sur le bouton New&#8230;<br />
Dans le champ <em>key</em> entrez l&#8217;information suivante:<br />
-Acom.faratasystems.dto2fx.output<br />
Dans le champ <em>value</em> entrez indiquez le chemin du répertoire source de où devront être générés vos classes AS3.<br />
<img class="alignnone size-large wp-image-233" title="dto2fx-annotation-path" src="http://box.baao.com/blog/wp-content/uploads/2009/07/dto2fx-annotation-path-550x347.png" alt="dto2fx-annotation-path" width="550" height="347" /></p>
<p><em>Note: C&#8217;est ce qu&#8217;indique la doc de configuration pour une application Java classique. Pour une application Web, j&#8217;ai du ajouter (glisser/déposer) le jar d&#8217;annotation dans le répertoire WebContent/WEB-INF/lib pour qu&#8217;il soit pris en compte.</em></p>
<p>Ouf! c&#8217;est fini pour la configuration, on va pouvoir coder.</p>
<h1>Utilisation de l&#8217;outil</h1>
<p>Dans le répertoire des sources Java, créer un package vo, puis dedans une classe User avec les propriétés username et password.<br />
Générez les getters/setters.</p>
<p>Au dessus de la classe, ajoutez l&#8217;annotation @FXClass ou @FXClass(&laquo;&nbsp;&lt;package.classe.flex.NomClasseAS3&gt;&nbsp;&raquo;). Sauvegardez pour lancez la compilation et la génération des classes AS3.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">vo</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">com.farata.dto2fx.annotations.FXClass</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//pour générer une classe AS3 du même nom, dans le même package</span>
<span style="color: #666666; font-style: italic;">//il suffit de mettre @FXClass</span>
@FXClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;dto.UserVO&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> User
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">String</span> _username<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">protected</span> <span style="color: #003399;">String</span> _password<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getUsername<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> _username<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setUsername<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> username<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		_username <span style="color: #339933;">=</span> username<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getPassword<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> _password<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setPassword<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> password<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		_password <span style="color: #339933;">=</span> password<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Faites un refresh du projet pour voir apparaître les classes dans le répertoire des sources flex.<br />
<img class="alignnone size-full wp-image-235" title="dto2fx-classes-as3" src="http://box.baao.com/blog/wp-content/uploads/2009/07/dto2fx-classes-as3.png" alt="dto2fx-classes-as3" width="193" height="92" /></p>
<p>Deux classes AS3 sont générées pour chaque classe Java : _ClasseAS3.as et ClasseAS3.as (qui hérite de _ClasseAS3.as)<br />
Ne modifier sous aucun prétexte la classe _ClasseAS3. Le générateur de code l&#8217;écrase à chaque modification de la classe Java.<br />
Par contre vous pouvez modifier la classe ClasseAS3.as</p>
<p>Il existe une annotation @FXIgnore que l&#8217;on peut positionner sur les méthodes Java afin qu&#8217;elles ne soient pas générées.<br />
Par exemple, un @FXIgnore sur un setter, entrainera la génération d&#8217;un accesseur get (et uniquement) côté AS3, pour protéger la classe AS3 contre l&#8217;écriture.</p>
<h1>Conclusion</h1>
<p>Cet utilitaire de génération de classe AS3 m&#8217;a paru très pratique car bien intégré à Eclipse. Du coup, une fois sa configuration effectuée, il travaille pour nous de façon quasi transparente.</p>
<p>Dites-moi ce que vous en pensez et si vous connaissez d&#8217;autres outils de génération intéressant.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=228</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Créer une webapp java flex avec spring blazeds</title>
		<link>http://blog.baao.com/blog/?p=189</link>
		<comments>http://blog.baao.com/blog/?p=189#comments</comments>
		<pubDate>Mon, 15 Jun 2009 08:51:22 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Blaze DS]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=189</guid>
		<description><![CDATA[Jusqu'à présent nous avons parlé de Flex en combinaison avec BlazeDS. La création de ce type de projet est rendue très simple par la bonne intégration entre BlazeDS, Flex et Flex Builder.]]></description>
			<content:encoded><![CDATA[<p>Jusqu&#8217;à présent nous avons parlé de Flex en combinaison avec BlazeDS. La création de ce type de projet est rendue très simple par la bonne intégration entre BlazeDS, Flex et Flex Builder.</p>
<p>Dans l&#8217;univers des frameworks web java, il en est un qui s&#8217;est imposé depuis quelques années : Spring.<br />
Adobe l&#8217;avait reconnu, puisqu&#8217;il est assez simple de configurer BlazeDS pour lui indiquer d&#8217;utiliser Spring comme container des classes java. Mais il fallait alors gérer la configuration de BlazeDS d&#8217;un côté et la configuration de Spring de l&#8217;autre.</p>
<p>Il y a quelques mois, Spring a proposé une <a href="http://www.springsource.org/spring-flex">nouvelle intiative</a> permettant de simplifier l&#8217;intégration avec BlazeDS.</p>
<p>Dans ce billet nous vous proposons de créer un petit projet qui vous permettra d&#8217;évaluer cette nouvelle solution.</p>
<p>Vous aurez besoin des librairies suivantes contenues dans les projets suivants:</p>
<ul>
<li><a href="http://s3.amazonaws.com/dist.springframework.org/release/FLEX/spring-flex-1.0.0.RELEASE-with-dependencies.zip" target="_blank">spring-flex-integration</a></li>
<li><a href="http://s3.amazonaws.com/dist.springframework.org/release/SPR/spring-framework-2.5.6.SEC01-with-dependencies.zip" target="_blank">spring</a></li>
</ul>
<h1>Création d&#8217;une webapp Flex/Java</h1>
<p>Commençons par créer une simple webapp en suivant <a href="/blog/2008/01/04/creer-java-webapp-flexbuilder-tomcat/">ce billet</a> si nécessaire.<br />
<em>Note: Dans cet exemple, nous utiliserons une table d&#8217;une base de données mysql, mais nous vous laissons libre d&#8217;adapter le code à votre propre contexte.</em></p>
<p>A cette webapp, ajouter (glisser/déposer) les libraries suivantes dans le dossier lib:</p>
<ul>
<li>driver de votre base de données</li>
<li>spring.jar (dans le dossier /dist du projet spring)</li>
<li>spring-webmvc.jar (dans le dossier /dist/modules du projet spring)</li>
<li>org.springframework.flex.-1.0.0.RELEASE.jar (dans le dossier /dist du projet spring-flex-integration)</li>
<li>cglib-nodep-2.1_3.jar (dans le dossier /lib/cglib du projet spring)</li>
<li>com.springsource.org.codehaus.jackson-1.0.0.jar (dans le dossier /projects/ivy-cache/repository/org.codehaus.jackson/com.springsource.org.codehaus.jackson/1.0.0 du projet spring-flex-integration)</li>
</ul>
<p>Votre dossier lib doit ressembler à ceci:</p>
<p><img class="alignnone size-full wp-image-193" title="librairies-java" src="http://box.baao.com/blog/wp-content/uploads/2009/06/librairies-java.png" alt="librairies-java" width="349" height="362" /></p>
<h1>Adaptation des fichiers de configuration</h1>
<p> <br />
Maintenant que Spring est en place, c&#8217;est sa servlet qui va intercepter les appels Flex vers le serveur. Pour ce faire, nous allons remplacer le fichier web.xml d&#8217;origine par ceci:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
<span style="color: #00bbdd;">&lt;!DOCTYPE web-app PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN&quot; &quot;http://java.sun.com/dtd/web-app_2_3.dtd&quot;&gt;</span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Spring BlazeDS Integration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/display-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Spring BlazeDS Integration<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- The front controller of this Spring Web application, responsible for handling all application requests --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Spring MVC Dispatcher Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.springframework.web.servlet.DispatcherServlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>contextConfigLocation<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/WEB-INF/config/web-application-config.xml<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/param-value<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/init-param<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/load-on-startup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Map all *.spring requests to the DispatcherServlet for handling --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>Spring MVC Dispatcher Servlet<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-name<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>/spring/*<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/url-pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/servlet-mapping<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;welcome-file-list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>index.html<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>index.htm<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/welcome-file<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/welcome-file-list<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/web-app<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Vous avez du remarqué la référence à un autre fichier : web-application-config.xml. Dans le répertoire WEB-INF de WebContent, créez un nouveau dossier config, puis créez un nouveau fichier nommé : web-application-config.xml .</p>
<p>Son contenu est le suivant pour notre petit exemple:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xmlns:flex</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/flex&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">           http://www.springframework.org/schema/beans/spring-beans.xsd</span>
<span style="color: #009900;">           http://www.springframework.org/schema/flex</span>
<span style="color: #009900;">           http://www.springframework.org/schema/flex/spring-flex-1.0.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
	<span style="color: #808080; font-style: italic;">&lt;!-- Lance le MessageBroker BlazeDS --&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex:message-broker</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
    <span style="color: #808080; font-style: italic;">&lt;!-- Implementation de CandidateDAO --&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;candidate&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;dao.CandidateDAO&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constructor-arg</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #808080; font-style: italic;">&lt;!-- Exposition de CandidateDAO en tant que destination --&gt;</span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex:remoting-destination</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.jdbc.datasource.DriverManagerDataSource&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;driverClassName&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;com.mysql.jdbc.Driver&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;url&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;jdbc:mysql://localhost:3306/&lt;votre base&gt;</span></span>&quot; /&gt;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;username&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;&lt;votre compte&gt;</span></span>&quot; /&gt;
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;password&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;&lt;votre mot de passe&gt;</span></span>&quot; /&gt;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/beans<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><em>Remarque: Pour faire simple nous exposons directement la la classe DAO, plutôt que de créer une classe façade.<br />
</em><br />
Dans ce fichier, nous devons spécifier toutes les classes dont nous souhaitons rendre les méthodes accessibles à Flex. Cela ce fait par la définition du bean dans lequel on précise le nom complet de la classe, ainsi que le nom de la destination (id=&nbsp;&raquo;candidate&nbsp;&raquo;).<br />
Par la balise <flex:remoting-destination /> on précise que ce bean sera exposé à Flex.</p>
<p>Du coup, inutile de configurer le fichier remoting-config.xml comme on le ferait dans une projet BlazeDS classique.</p>
<p>Enfin, il est nécessaire de modifier dans le fichier services-config.xml (situé dans WebContent/WEB-INF/flex).<br />
Dabord rajouter un channel par défaut:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;services<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service-include</span> <span style="color: #000066;">file-path</span>=<span style="color: #ff0000;">&quot;remoting-config.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service-include</span> <span style="color: #000066;">file-path</span>=<span style="color: #ff0000;">&quot;proxy-config.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;service-include</span> <span style="color: #000066;">file-path</span>=<span style="color: #ff0000;">&quot;messaging-config.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;default-channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;my-amf&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/default-channels<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/services<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Ensuite, les urls d&#8217;accès aux classes de sérialisation AMF (notez le &#8216;spring&#8217; dans l&#8217;url):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;channel-definition</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;my-amf&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;mx.messaging.channels.AMFChannel&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;endpoint</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;http://{server.name}:{server.port}/{context.root}/spring/messagebroker/amf&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;flex.messaging.endpoints.AMFEndpoint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/channel-definition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<h1>Côté Java</h1>
<p>Nous allons maintenant créer les classes java qui exposeront leurs méthodes pour permettre à Flex d&#8217;accéder à la base et de retourner son contenu.<br />
Créez un nouveau package dao, puis créez les classes suivantes:<br />
Classe CandidateDAO.java</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">dao</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.ResultSet</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.sql.SQLException</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.List</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.HashMap</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Map</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">javax.sql.DataSource</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.jdbc.core.simple.ParameterizedRowMapper</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.jdbc.core.simple.SimpleJdbcInsert</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.springframework.jdbc.core.simple.SimpleJdbcTemplate</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> CandidateDAO <span style="color: #000000; font-weight: bold;">implements</span> IGenericDAO<span style="color: #339933;">&lt;</span>candidate<span style="color: #339933;">&gt;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> SimpleJdbcTemplate template<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> SimpleJdbcInsert insertCandidate<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> ParameterizedRowMapper<span style="color: #339933;">&lt;</span>candidate<span style="color: #339933;">&gt;</span> rowMapper <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ParameterizedRowMapper<span style="color: #339933;">&lt;</span>candidate<span style="color: #339933;">&gt;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">public</span> Candidate mapRow<span style="color: #009900;">&#40;</span><span style="color: #003399;">ResultSet</span> rs, <span style="color: #000066; font-weight: bold;">int</span> rowNum<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">SQLException</span>
		<span style="color: #009900;">&#123;</span>
			Candidate candidate <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Candidate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			candidate.<span style="color: #006633;">setId</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getInt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;id&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			candidate.<span style="color: #006633;">setEmail</span><span style="color: #009900;">&#40;</span>rs.<span style="color: #006633;">getString</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;email&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">return</span> candidate<span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>candidate<span style="color: #339933;">&gt;</span> findAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> template.<span style="color: #006633;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM candidates ORDER BY firstname&quot;</span>, rowMapper<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> CandidateDAO<span style="color: #009900;">&#40;</span>DataSource dataSource<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		template <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleJdbcTemplate<span style="color: #009900;">&#40;</span>dataSource<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		insertCandidate <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> SimpleJdbcInsert<span style="color: #009900;">&#40;</span>dataSource<span style="color: #009900;">&#41;</span>.<span style="color: #006633;">withTableName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Candidate&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">usingGeneratedKeyColumns</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ID&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Classe Candidate.java</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">dao</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Candidate
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> id<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #003399;">String</span> email<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setId<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">id</span> <span style="color: #339933;">=</span> id<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> id<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setEmail<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> email<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">email</span> <span style="color: #339933;">=</span> email<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getEmail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">return</span> email<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h1>Côté Flex</h1>
<p>Mettons en place une simple Datagrid pour afficher les résultats:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;vertical&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RemoteObject</span> id=<span style="color: #ff0000;">&quot;ro&quot;</span> destination=<span style="color: #ff0000;">&quot;candidate&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> dataProvider=<span style="color: #ff0000;">&quot;{ro.findAll.lastResult}&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Get Data&quot;</span> click=<span style="color: #ff0000;">&quot;ro.findAll()&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Maintenant vous devriez pouvoir lancer le projet depuis le connecteur Tomcat et lancer l&#8217;exécution de l&#8217;application Flex.<br />
Si tout se passe bien vous devriez voir le contenu de votre table s&#8217;afficher.</p>
<h1>Ajout de la sécurité</h1>
<p><em>Attention:Testez bien tous les niveaux d&#8217;accès de votre application avant de la déployer. L&#8217;implémentation telle que décrite ci-dessous fonctionne telle que décrite, mais n&#8217;a pas été testée au-delà.</em><br />
La possibilité de gérer finement l&#8217;accès aux méthodes des services exposés est un atout de Spring/BlazeDS par rapport à BlazeDS seul.</p>
<p>Pour ce faire nous allons un peu modifier me projet que nous venons de mettre en place.</p>
<h3>Ajouter de nouvelles librairies java</h3>
<p>Sur <a href="http://www.springsource.org/download">la page</a>, cliquez sur le lien download de la section &laquo;&nbsp;Spring Security&nbsp;&raquo; (version 2.0.4 pour nous).<br />
Dans le répertoire dist de cette librairie, copiez les jars suivant dans le répertoire lib de notre projet:</p>
<ul>
<li>spring-security-acl-2.0.4.jar</li>
<li>spring-security-core-2.0.4.jar</li>
<li>spring-security-core-tiger-2.0.4.jar</li>
<li>spring-security-taglibs-2.0.4.jar</li>
</ul>
<p>et également aspectjrt.jar (que vous trouverez dans le répertoire lib/aspectj de la librairie spring)</p>
<h3>Modifications de web-application-config.xml</h3>
<p>On rajoute les namespaces concernant la sécurité:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;beans</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xmlns:flex</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/flex&quot;</span></span>
<span style="color: #009900;">	   <span style="color: #000066;">xmlns:security</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/security&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xmlns:xsi</span>=<span style="color: #ff0000;">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span>
<span style="color: #009900;">       <span style="color: #000066;">xsi:schemaLocation</span>=<span style="color: #ff0000;">&quot;http://www.springframework.org/schema/beans</span>
<span style="color: #009900;">           http://www.springframework.org/schema/beans/spring-beans.xsd</span>
<span style="color: #009900;">           http://www.springframework.org/schema/flex</span>
<span style="color: #009900;">           http://www.springframework.org/schema/flex/spring-flex-1.0.xsd</span>
<span style="color: #009900;">           http://www.springframework.org/schema/security</span>
<span style="color: #009900;">           http://www.springframework.org/schema/security/spring-security-2.0.4.xsd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div>

<p>On ajoute la possibilité d&#8217;utiliser les notations pour définir la sécurité dans le code directement:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:global-method-security</span> <span style="color: #000066;">secured-annotations</span>=<span style="color: #ff0000;">&quot;enabled&quot;</span> <span style="color: #000066;">jsr250-annotations</span>=<span style="color: #ff0000;">&quot;enabled&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>On indique que l&#8217;on ajoute la sécurité au niveau du MessageBroker:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex:message-broker<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;flex:secured</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/flex:message-broker<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>On définit la classe chargé de filtrer les accès:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:http</span> <span style="color: #000066;">entry-point-ref</span>=<span style="color: #ff0000;">&quot;securedEntryPoint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;securedEntryPoint&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;org.springframework.security.ui.preauth.PreAuthenticatedProcessingFilterEntryPoint&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Puis on ajoute quelques lignes pour définir les rôles pouvant accéder aux services</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:authentication-provider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;admin&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;admin&quot;</span> <span style="color: #000066;">authorities</span>=<span style="color: #ff0000;">&quot;ROLE_USER,ROLE_ADMIN&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;security:user</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;user&quot;</span> <span style="color: #000066;">password</span>=<span style="color: #ff0000;">&quot;user&quot;</span> <span style="color: #000066;">authorities</span>=<span style="color: #ff0000;">&quot;ROLE_USER&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security:user-service<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/security:authentication-provider<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Et puis on va en profiter pour faire la déclaration du service non pas dans le fichier xml, mais par annotation. Une seule des deux déclarations possible à la fois.<br />
Transformer le bean &laquo;&nbsp;contact&nbsp;&raquo; en lui enlevant la baliser &lt;flex:remoting-destination /&gt;</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;bean</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;candidate&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;dao.CandidateDAO&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;constructor-arg</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;dataSource&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/bean<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Voilà concernant ce fichier.</p>
<h3>Modification de la classe java exposant le service</h3>
<p>On va maintenant pouvoir rajouter les annotations sur la classe java pour indiquer les filtres d&#8217;accès aux différentes méthodes.<br />
Ajoutez ces annotations juste au-dessus de la classe:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">@Service<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;candidate&quot;</span><span style="color: #009900;">&#41;</span>
@RemotingDestination<span style="color: #009900;">&#40;</span>channels<span style="color: #339933;">=</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;my-amf&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Maintenant, ajoutons les annotations d&#8217;accessibilité aux méthodes, dont voici deux exemples:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*
* accessible uniquement au role ROLE_ADMIN
*/</span>
@RemotingInclude
@Secured<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ROLE_ADMIN&quot;</span><span style="color: #009900;">&#41;</span>
<span style="color: #000000; font-weight: bold;">public</span> List<span style="color: #339933;">&lt;</span>candidate<span style="color: #339933;">&gt;</span> findAll<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">return</span> template.<span style="color: #006633;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM candidates ORDER BY firstname&quot;</span>, rowMapper<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">/*
* accessible à tous
*/</span>
@RemotingInclude
<span style="color: #000000; font-weight: bold;">public</span> Candidate findById<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">return</span> template.<span style="color: #006633;">queryForObject</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM candidates WHERE id=?&quot;</span>, rowMapper, id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Il est possible d&#8217;indiquer à Spring qu&#8217;une méthode, même publique, ne devra pas être exposé à Flex, en utilisant l&#8217;annotation : @RemoteExclude</p>
<h3>Modification de la partie Flex</h3>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #66cc66;">&lt;</span>?<span style="color: #0066CC;">xml</span> <span style="color: #0066CC;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Application xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;vertical&quot;</span>
creationComplete=<span style="color: #ff0000;">&quot;onCreationComplete()&quot;</span>
<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;!</span><span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onCreationComplete<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	ro.<span style="color: #006600;">setCredentials</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;admin&quot;</span>,<span style="color: #ff0000;">&quot;admin&quot;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #808080; font-style: italic;">//			ro.setCredentials(&quot;user&quot;,&quot;user&quot;);</span>
<span style="color: #66cc66;">&#125;</span>
<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onLogoutClick<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
<span style="color: #66cc66;">&#123;</span>
	ro.<span style="color: #006600;">logout</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Script<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:RemoteObject id=<span style="color: #ff0000;">&quot;ro&quot;</span> destination=<span style="color: #ff0000;">&quot;candidate&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:HBox<span style="color: #66cc66;">&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Load!&quot;</span> click=<span style="color: #ff0000;">&quot;ro.findAll();ro.findById(3)&quot;</span><span style="color: #66cc66;">/&gt;</span>
	<span style="color: #66cc66;">&lt;</span>mx:<span style="color: #0066CC;">Button</span> label=<span style="color: #ff0000;">&quot;Logout&quot;</span> click=<span style="color: #ff0000;">&quot;onLogoutClick()&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:HBox<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:Label <span style="color: #0066CC;">text</span>=<span style="color: #ff0000;">&quot;Candidate(3)={ro.findById.lastResult.email}&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;</span>mx:DataGrid dataProvider=<span style="color: #ff0000;">&quot;{ro.findAll.lastResult}&quot;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #0066CC;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #66cc66;">/&gt;</span>
<span style="color: #66cc66;">&lt;/</span>mx:Application<span style="color: #66cc66;">&gt;</span></pre></div></div>

<p>Cette application fait appel aux 2 méthodes exposées.<br />
Tester-la en mode admin et user pour voir la différence.<br />
Il doit être possible de trapper l&#8217;erreur de sécurité de façon plus propre en utilisant l&#8217;évènement fault sur le RemoteObject.</p>
<p>En cas de comportement inattendue, fermer votre navigateur (pour enlever le swf du cache), et relancer l&#8217;application.</p>
<p>Le bouton logout permet d&#8217;indiquer au serveur une déconnexion de l&#8217;application. Sinon, la session est conservée et si l&#8217;on ne fait que relancer l&#8217;application (ou rafraîchir), une erreur est générée.</p>
<p>Encore une fois, cette application semble fonctionner correctement. Mais indiquez en commentaires les erreurs que vous pourriez rencontrer.<br />
<em>Note: Ce billet a été écrit en se basant sur <a href="http://dima-vp.livejournal.com/573.html">ce billet</a> ainsi que <a href="http://coenraets.org/blog/2009/05/new-update-to-the-spring-blazeds-integration-test-drive/">celui-ci</a>.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=189</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Flex allégé : Utilisez le framework en RSL</title>
		<link>http://blog.baao.com/blog/?p=166</link>
		<comments>http://blog.baao.com/blog/?p=166#comments</comments>
		<pubDate>Thu, 02 Apr 2009 12:11:06 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=166</guid>
		<description><![CDATA[Adobe nous donne cependant la possibilité de séparer notre swf applicatif des classes du framework.
Il y a un gros avantage à cette façon de déployer notre application. Le framework peut donc être disponible au téléchargement en tant qu'entité propre (sans classes applicatives).]]></description>
			<content:encoded><![CDATA[<p>Rappelez-vous lorsque vous avez créé votre premier &laquo;&nbsp;Hello World&nbsp;&raquo; en Flex. Avez-vous eu la curiosité de regarder la taille du fichier swf généré ?<br />
Avec Flex 3, ce fichier pèse environ 275 Ko (et 170 Ko en version release). A l&#8217;heure des bandes passantes à 8Mb/s ce n&#8217;est certe pas grand chose, mais tout de même. Si votre site, et je vous le souhaite, est visité par des milliers d&#8217;utilisateurs par jour, ce sont quelques Ko de trop.</p>
<p>La raison est assez simple : chaque application Flex contient une partie du framework. Le Flash Player ne contient aucune classe Flex, ce qui le rend plus léger au téléchargement et aussi plus indépendant des  évolutions.</p>
<p>Adobe nous donne cependant la possibilité de séparer notre swf applicatif des classes du framework.<br />
Il y a un gros avantage à cette façon de déployer notre application. Le framework peut donc être disponible au téléchargement en tant qu&#8217;entité propre (sans classes applicatives). Il se trouve alors sous la forme d&#8217;un fichier d&#8217;extension .swz (signé par Adobe, qui pour le moment est la seule société à pouvoir signer des librairies). Ce fichier signé, une fois téléchargé, peut alors résider dans le cache du Flash Player (et pas du navigateur comme un vulgaire swf).<br />
Vous voyez tout de suite l&#8217;intérêt si toutes les applications Flex étaient compilées de cette manière. Plus personne n&#8217;aurait à télécharger le framework, et les applications Flex seraient allégées en poids.</p>
<p>Comment procéder ? C&#8217;est très simple. Sous Flex Builder, dans les propriétés du projet (clic droit sur le projet puis Properties), sélectionnez &laquo;&nbsp;Flex Build Path&nbsp;&raquo; dans le panel de gauche.<br />
Là, la combo box intitulée &laquo;&nbsp;Framework linkage&nbsp;&raquo; affiche par défaut &laquo;&nbsp;Merge into code&nbsp;&raquo; (c&#8217;est à dire que le framework est intégré dans le swf de votre application).<br />
Il suffit de sélectionner l&#8217;autre option &laquo;&nbsp;Runtime shared library (RSL)&nbsp;&raquo; pour externaliser le framework.<br />
<img src="http://box.baao.com/blog/wp-content/uploads/2009/04/flex-build-path.png" alt="Flex build path" /></p>
<p>Après cette opération, le projet est recompilé, et vous pouvez voir apparaître dans le répertoire bin-debug, les fichiers framework_3.2.0.3958.swz et framework_3.2.0.3958.swf.<br />
Ces deux fichiers sont à déployer sur votre serveur de production, dans le même répertoire que votre application Flex.<br />
(Note: Le swf est pour les Flash Player < 9.0.115 )</p>
<p>Le fichier du framework pèse environ 550 Ko. C&#8217;est donc pénalisant lors du premier chargement (quand le Flash Player ne l&#8217;a pas dans son cache). Mais par la suite on gagne quelques centaines de Ko.<br />
Une petite action de plus pour sauver la planète !</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=166</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Générer des swf Flash Player 10 avec FlexBuilder 3.0.2</title>
		<link>http://blog.baao.com/blog/?p=139</link>
		<comments>http://blog.baao.com/blog/?p=139#comments</comments>
		<pubDate>Thu, 05 Feb 2009 09:29:04 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=139</guid>
		<description><![CDATA[1- Récupérer une version de debug du FP10 Sur downloads dans la rubrique &#171;&#160;Adobe Flash Player 10 Update for Flash CS4 Professional&#160;&#187; télécharger le gros zip de 41 Mo. Dézipper et dans le répertoire Debug, prendre l&#8217;installeur qui vous correspond. (ActiveX pour IE, Plugin pour FireFox) et aussi les versions standalone. 2- S&#8217;assurer d&#8217;avoir la version 3.0.2 [...]]]></description>
			<content:encoded><![CDATA[<h1>1- Récupérer une version de debug du FP10</h1>
<p>Sur <a href="http://www.adobe.com/support/flashplayer/downloads.html">downloads</a> dans la rubrique &laquo;&nbsp;Adobe Flash Player 10 Update for Flash CS4 Professional&nbsp;&raquo; télécharger le gros zip de 41 Mo.</p>
<p>Dézipper et dans le répertoire Debug, prendre l&#8217;installeur qui vous correspond. (ActiveX pour IE, Plugin pour FireFox) et aussi les versions standalone.</p>
<h1>2- S&#8217;assurer d&#8217;avoir la version 3.0.2 de FB</h1>
<p>En effet, celle-ci contient le SDK 3.2 dont le compilateur sait générer des swf pour le FP10. Pour vérifier votre version de FB, menu Help/About Adobe FlexBuilder 3 en bas à gauche pour la version (procédure de maj ?)</p>
<h1>3- Récupérer le projet</h1>
<p>Ce projet contient une appli qui utilise la nouvelle API du FP10 pour le File Reference (en parler)</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> layout=<span style="color: #ff0000;">&quot;vertical&quot;</span> xmlns:net=<span style="color: #ff0000;">&quot;flash.net.*&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">		&lt;![CDATA[</span>
&nbsp;
<span style="color: #339933;">			private function saveAsFile():void</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				fr.save(logArea.text, &quot;MyFile.txt&quot;);</span>
<span style="color: #339933;">			}</span>
&nbsp;
<span style="color: #339933;">			private function loadFile():void</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				fr.browse();</span>
<span style="color: #339933;">			}</span>
&nbsp;
<span style="color: #339933;">			private function loadComplete():void</span>
<span style="color: #339933;">			{</span>
<span style="color: #339933;">				var bt:ByteArray = fr.data as ByteArray;</span>
<span style="color: #339933;">				logArea.text = bt.readUTFBytes(bt.length);</span>
<span style="color: #339933;">			}</span>
&nbsp;
<span style="color: #339933;">		]]&gt;</span>
<span style="color: #339933;">	&lt;/mx:Script&gt;</span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;net:FileReference</span> id=<span style="color: #ff0000;">&quot;fr&quot;</span> complete=<span style="color: #ff0000;">&quot;loadComplete()&quot;</span> select=<span style="color: #ff0000;">&quot;fr.load()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Panel</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:TextArea</span> id=<span style="color: #ff0000;">&quot;logArea&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Load&quot;</span> click=<span style="color: #ff0000;">&quot;loadFile()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Save&quot;</span> click=<span style="color: #ff0000;">&quot;saveAsFile()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Panel</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Normalement, par défaut ce projet ne devrait pas compiler (l&#8217;API FP10 n&#8217;est pas reconnue)</p>
<h1>4- FP10 Pour le projets de type &#8216;Flex Project&#8217;</h1>
<p>Il suffit d&#8217;aller dans les propriétés du projet ;<br />
dans l&#8217;onglet &laquo;&nbsp;Flex compiler&nbsp;&raquo; mettre la version du wrapper à 10 &#8211; 0 &#8211; 12</p>
<p>C&#8217;est tout (normalement, ça devrait recompiler tout seul) et les erreurs devrait partir. Si ce n&#8217;est pas le cas, faire un clean</p>
<p>-Yann</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=139</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Installer FMS 3.5 sur Mac OSX (via Ubuntu Server 8.04)</title>
		<link>http://blog.baao.com/blog/?p=109</link>
		<comments>http://blog.baao.com/blog/?p=109#comments</comments>
		<pubDate>Mon, 02 Feb 2009 12:49:37 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[FMS]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=109</guid>
		<description><![CDATA[L'environnement de production est un ubuntu server 8. Autant se mettre dans le même environnement pour effectuer les tests. Pour cela, je vais donc installer Ubuntu server sur le Mac, grâce à VMWare.]]></description>
			<content:encoded><![CDATA[<p>&laquo;&nbsp;Faudrait que tu installes un serveur FMS sur ton Mac pour faire des tests&nbsp;&raquo;. La tâche ne me paraissait pas compliquée. Un p&#8217;tit coup de google et hop! l&#8217;affaire devrait être réglée.</p>
<p> Et puis après quelques clics, modifications de critères de recherche j&#8217;ai bien l&#8217;impression que je m&#8217;embarque dans une installation un peu exotique, pour les raisons suivantes :</p>
<ol>
<li>FMS 3.5 vient de sortir, donc pas beaucoup de commentaire, support&#8230;</li>
<li>Adobe précise que le linux supporté est Red Hat (mais un linux est un linux n&#8217;est-ce pas ?)</li>
<li>Pas de support de Mac OS X</li>
</ol>
<h1>1 &#8211; Virtualisation</h1>
<p>L&#8217;environnement de production est un ubuntu server 8. Autant se mettre dans le même environnement pour effectuer les tests. Pour cela, je vais donc installer Ubuntu server sur le Mac, grâce à VMWare (L&#8217;installation de VMWare s&#8217;effectue sans soucis donc je ne la détaille pas ici).<br />
Attention, la version Desktop de Ubuntu ne semble pas permettre l&#8217;installation de FMS (message &laquo;&nbsp;plateforme non reconnue&nbsp;&raquo;)<br />
Sur la page de <a href="http://www.ubuntu.com/getubuntu/download" target="_new">téléchargement</a> du site Ubuntu sélectionner bien l&#8217;onglet &laquo;&nbsp;Server&nbsp;&raquo;. J&#8217;ai pris la version par défaut (32 bits), car je n&#8217;ai pas réussi à installer FMS avec la version 64 bits (même après triturage des scripts d&#8217;installation. Le fichier fmsini ne semble pas pouvoir se lancer. Si l&#8217;un de vous y parvient la solution m&#8217;intéresse). Sélectionner un miroir et récupérer le fichier iso (environ 650 Mo).</p>
<p>Pour l&#8217;installer dans VMWare, voici les étapes à suivres:</p>
<ol>
<li>Dans le menu File, cliquer sur New</li>
<li>Sélectionnez le fichier iso que vous venez de récupérer<img class="alignnone size-full wp-image-122" title="vmware-installation-iso1" src="http://box.baao.com/blog/wp-content/uploads/2009/01/vmware-installation-iso1.png" alt="vmware-installation-iso1" width="388" height="310" /></li>
<li>Quand le panneau des options est affiché, cliquez sur l&#8217;icône de l&#8217;adapteur réseau pour sélectionner le mode &laquo;&nbsp;Bridged&nbsp;&raquo;. Ce mode vous permettra d&#8217;associer une adresse internet à votre serveur virtuel différente de celle de votre machine.</li>
</ol>
<p>La configuration est terminée. Allez dans le menu Virtual Machine et sélecionnez le menu &laquo;&nbsp;Start up guest&#8230;&nbsp;&raquo; pour commencer l&#8217;installation du serveur. (Note: pour récupérer la souris, appuyez sur Pomme/Command + Ctrl)</p>
<p>Pour faire simple, on ne créera pas de partition (on prend tout l&#8217;espace attribué par défaut, 20Go).</p>
<p>Concernant les packages à installer (dans la liste proposée en fin d&#8217;installation), il n&#8217;est pas nécessaire d&#8217;en installer un. Mais il est bien pratique d&#8217;avoir au moins un serveur LAMP installé (Linux/apache/MySQL/PHP) que nous allons donc sélectionner et installer.</p>
<p>Attention, Apache et FMS peuvent entrer en conflit au niveau du port 80. FMS peut en effet streamer sur ce port pour essayer de passer les firewall (mais certain sont plus malins que ça et bloquent quand même). Voir plus loin dans ce billet.</p>
<p>Une fois l&#8217;installation terminée, le serveur est relancé:<img class="alignnone size-large wp-image-127" title="serveur-up-running2" src="http://box.baao.com/blog/wp-content/uploads/2009/01/serveur-up-running2-550x321.png" alt="serveur-up-running2" width="550" height="321" /></p>
<p>Bien que nous ayons installé le clavier Français Macintosh, vous remarquerz que les caractères spéciaux (~, | ) ne sont pas reconnus. Pour cette raison il est plus pratique de se connecter à notre serveur Ubuntu virtuel en ssh depuis un Terminal OS X&#8230;(soupirs).</p>
<p>Pour cela, dans la fenêtre vmware, sur le prompt connectez vous avec votre identifiant, puis tapez:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openssh-server</pre></div></div>

<p>Cette simple commande va installer et démarrer le deamon ssh sur notre serveur ubuntu, ce qui nous permettra de nous y connecter.</p>
<p>Depuis un Terminal OS X, nous pouvons maintenant taper la commande de connection ssh &lt;identifiant&gt;@&lt;nom du serveur donné lors de l&#8217;installation&gt;, ce qui donne pour moi :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Corebook:~ olivier$ <span style="color: #c20cb9; font-weight: bold;">ssh</span> olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu
The authenticity of host <span style="color: #ff0000;">'ubuntu (192.168.1.13)'</span> can<span style="color: #ff0000;">'t be established.
RSA key fingerprint is cf:65:d0:8b:ff:f5:f5:93:3c:4b:f7:6e:d6:1c:6a:ed.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '</span>ubuntu64,192.168.1.13<span style="color: #ff0000;">' (RSA) to the list of known hosts.
olivier@ubuntu'</span>s password:</pre></div></div>

<h1>2 &#8211; FMS</h1>
<p>Nous pouvons maintenant nous concentrer sur la partie FMS. Pour commencer nous allons le <a href="http://www.adobe.com/support/flashmediaserver/downloads_updaters.html" target="_new">télécharger ici</a>. (il vous faudra un compte Adobe)<br />
J&#8217;ai pris la version Linux du Flash Media Development Server 3.5 update qui est destinée justement aux environnements de test/developpement avec une limitation de 10 connexions simultanées.</p>
<p>Vous allez récupérer un fichier zip (Flashmedia3_5_Int_Strm_ALP.zip) d&#8217;environ 275Mo contenant un fichier FlashMediaServer3.5.exe (???&#8230;de 100 Mo tout de même) et un fichier FlashMediaServer3.5.tar.gz qui nous intéressera beaucoup plus.<br />
En téléchargeant avec Safari, le fichier zip est placé dans le répertoire Downloads et le zip est automatiquement décompressé.<br />
Lancez un autre Terminal OSX, tapez les commandes suivantes pour copier l&#8217;archive FMS sur notre serveur ubuntu (dans la commande scp, remplacer olivier par votre nom d&#8217;utilisateur):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Corebook:~ olivier$ <span style="color: #7a0874; font-weight: bold;">cd</span> Downloads<span style="color: #000000; font-weight: bold;">/</span>Flashmedia3_5_Int_Strm_ALP<span style="color: #000000; font-weight: bold;">/</span>
Corebook:Flashmedia3_5_Int_Strm_ALP olivier$ <span style="color: #c20cb9; font-weight: bold;">scp</span> FlashMediaServer3.5.tar.gz olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>olivier</pre></div></div>

<p>Une fois la copie terminée, revenez sur la session ubuntu de votre Terminal OS X et décompressez l&#8217;archive sur place:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xzf</span> FlashMediaServer3.5.tar.gz</pre></div></div>

<p>Un répertoire FMS_3_5_0_r405 est créé. Mais avant de pouvoir effectuer l&#8217;installation de FMS sur notre serveur ubuntu, nous devons installer un certain nombre de choses (si le script d&#8217;installation ne les trouve pas il s&#8217;arrêtera en cours de route&#8230;essayez si vous ne me croyez pas <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Je vous ai fait une synthèse de mes recherches sur internet.</p>
<p>Sur le prompt Ubuntu de votre Terminal OSX, tapez:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libnspr4-dev</pre></div></div>

<p>Puis nous devons patcher le script d&#8217;installation pour l&#8217;adapter aux spécificité de Ubuntu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> FMS_3_5_0_r405
olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~<span style="color: #000000; font-weight: bold;">/</span>FMS_3_5_0_r405$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.joeterranova.net<span style="color: #000000; font-weight: bold;">/</span>code<span style="color: #000000; font-weight: bold;">/</span>fms-<span style="color: #000000;">3.5</span>-ubuntu.patch
olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~<span style="color: #000000; font-weight: bold;">/</span>FMS_3_5_0_r405$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-p1</span> <span style="color: #000000; font-weight: bold;">&lt;</span> fms-<span style="color: #000000;">3.5</span>-ubuntu.patch</pre></div></div>

<p>Note: Grand merci à Joe ! </p>
<p>Ensuite, le script d&#8217;installation fera appel à chkconfig qu&#8217;il ne trouvera pas, pace que sur Ubuntu ce script s&#8217;appelle différemment.</p>
<p>Nous allons devoir l&#8217;installer et créer un lien/alias pour le faire passer pour chkconfig avec la commande suivante:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sysv-rc-conf
olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>sysv-rc-conf <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>chkconfig</pre></div></div>

<p>Enfin, le script va chercher à installer FMS sur le user nobody, de groupe nobody. Là encore, sur Ubuntu tout n&#8217;est pas tout à fait en place. A nous de le faire:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> addgroup nobody
olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> usermod <span style="color: #660033;">-g</span> nobody nobody</pre></div></div>

<p>Voilà! Notre serveur est prêt. Nous pouvons installer FMS en tapant la commande:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #7a0874; font-weight: bold;">cd</span> FMS_3_5_0_r405
olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~<span style="color: #000000; font-weight: bold;">/</span>FMS_3_5_0_r405$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> .<span style="color: #000000; font-weight: bold;">/</span>installFMS</pre></div></div>

<p>Note: Il n&#8217;y a pas license pour cette version. Quand le script vous le demande, appuyer sur la touche Entrée. Puis à la question:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">You have not entered a serial number.  Falling back to
the Adobe Flash Media Development Server<span style="color: #000000; font-weight: bold;">!</span>
&nbsp;
Would you like to try again? y<span style="color: #000000; font-weight: bold;">/</span>n:  Default <span style="color: #7a0874; font-weight: bold;">&#91;</span>n<span style="color: #7a0874; font-weight: bold;">&#93;</span>: n</pre></div></div>

<p>Tapez n puis Entrée.<br />
Note 2:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">The Adobe Flash Media Server communicates on the IANA-assigned
port of <span style="color: #000000;">1935</span>, <span style="color: #c20cb9; font-weight: bold;">which</span> is the port most Flash applications expect,
and can also communicate on port <span style="color: #000000;">80</span>, both <span style="color: #000000; font-weight: bold;">for</span> tunneling Flash
over HTTP, and <span style="color: #000000; font-weight: bold;">for</span> proxying HTTP to a webserver.
&nbsp;
Please enter the Adobe Flash Media Server port<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>, comma-separated
Default <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1935</span>,<span style="color: #000000;">80</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: <span style="color: #000000;">1935</span></pre></div></div>

<p>Remarquez que le port 80 peut-être utilisé par FMS (pour faire du RTMPT, c.à.d. RTMP encapsulé dans HTTP). Comme nous avons notre serveur Apache sur ce port, entrez 1935 pour interdire à FMS l&#8217;utilisation du 80. Ces valeurs sont modifiables après installation dans le fichier /conf/fms.ini.</p>
<p>A la question sur l&#8217;installation d&#8217;Apache tapez &#8216;n&#8217;, encore une fois pour ne pas entrer en conflit avec une version existante:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Do you want to <span style="color: #c20cb9; font-weight: bold;">install</span> apache? <span style="color: #7a0874; font-weight: bold;">&#40;</span>y<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Default <span style="color: #7a0874; font-weight: bold;">&#91;</span>y<span style="color: #7a0874; font-weight: bold;">&#93;</span>: n</pre></div></div>

<p>Voici mes réponses en résumé:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #660033;">-----------</span> Install Action Summary <span style="color: #660033;">-----------</span>
WARNING: You have chosen to overwrite a previous installation.
&nbsp;
Installation directory         = <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>adobe<span style="color: #000000; font-weight: bold;">/</span>fms
&nbsp;
Flash Media Server Port        = <span style="color: #000000;">1935</span>
Flash Media Admin Server Port  = <span style="color: #000000;">1111</span>
&nbsp;
Apache Install                 = No
&nbsp;
Administrative username        = admin
Administrative password        = <span style="color: #7a0874; font-weight: bold;">&#40;</span>suppressed<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
service owner                  = nobody
&nbsp;
service user                   = nobody
service group                  = fms
&nbsp;
Run <span style="color: #c20cb9; font-weight: bold;">as</span> daemon                  = Yes
Start Flash Media Server       = Yes
&nbsp;
Proceed with the installation? <span style="color: #7a0874; font-weight: bold;">&#40;</span>y<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #000000; font-weight: bold;">/</span>q<span style="color: #7a0874; font-weight: bold;">&#41;</span>:</pre></div></div>

<p>Une fois que vous tapez &#8216;y&#8217;, FMS s&#8217;installe et est lancé en fin de procédure.</p>
<p>Vous devriez obtenir les messages suivants en fin d&#8217;installation:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Installing Adobe Flash Media Server files...
Configuring Adobe Flash Media Server...
Adding <span style="color: #ff0000;">&quot;fms&quot;</span> service.
Setting default admin to <span style="color: #ff0000;">&quot;fms&quot;</span>.
Applications directory created at <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>adobe<span style="color: #000000; font-weight: bold;">/</span>fms<span style="color: #000000; font-weight: bold;">/</span>applications. Add <span style="color: #c20cb9; font-weight: bold;">users</span> that will <span style="color: #c20cb9; font-weight: bold;">install</span> applications to the fms group.
update-rc.d: warning: <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms missing LSB style header
 Adding system startup <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms ...
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc0.d<span style="color: #000000; font-weight: bold;">/</span>K20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc1.d<span style="color: #000000; font-weight: bold;">/</span>K20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc6.d<span style="color: #000000; font-weight: bold;">/</span>K20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc2.d<span style="color: #000000; font-weight: bold;">/</span>S20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc3.d<span style="color: #000000; font-weight: bold;">/</span>S20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc4.d<span style="color: #000000; font-weight: bold;">/</span>S20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
   <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc5.d<span style="color: #000000; font-weight: bold;">/</span>S20fms -<span style="color: #000000; font-weight: bold;">&amp;</span>gt; ..<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>fms
Setting autostart <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #ff0000;">&quot;fms&quot;</span>.
Server:fms <span style="color: #7a0874; font-weight: bold;">command</span>:start
NPTL 2.8.90
Starting Adobe Flash Media Server <span style="color: #7a0874; font-weight: bold;">&#40;</span>please check <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>messages<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
Admin server:fmsadmin <span style="color: #7a0874; font-weight: bold;">command</span>:start
Starting Adobe Flash Media Admin Server <span style="color: #7a0874; font-weight: bold;">&#40;</span>please check <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>messages<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
The Adobe Flash Media Server installation is complete.</pre></div></div>

<h1>3 &#8211; Comment tester ?</h1>
<p>Le plus simple pour tester la configuration et d&#8217;essayer de streamer la petite video fournie avec FMS.<br />
Pour cela, nous allons effectuer une petite modification de la configuration de notre serveur Apache qui nous permettra de streamer la video directement depuis le Mac.</p>
<p>Ouvrez le fichier de configuration d&#8217;apache:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>apache2.conf</pre></div></div>

<p>Note: remplacer vim par votre editeur en ligne préféré.<br />
En fin de fichier, ajouter les lignes suivantes:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Alias for fms webroot</span>
Alias <span style="color: #000000; font-weight: bold;">/</span>fms <span style="color: #ff0000;">&quot;/opt/adobe/fms/webroot&quot;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>directory <span style="color: #ff0000;">&quot;/opt/adobe/fms/webroot&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
       Options Indexes FollowSymLinks MultiViews ExecCGI
       AllowOverride All
       Order allow,deny
       Allow from all
<span style="color: #000000; font-weight: bold;">&lt;/</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Par ces lignes nous indiquons à Apache de créer un répertoire virtuel (accessible depuis le navigateur), sur le répertoire /opt/adobe/fms/webroot où se trouvent les fichiers d&#8217;exemples d&#8217;Adobe.<br />
Relancez Apache:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olivier<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>Dans le navigateur préféré de votre Mac, tapez l&#8217;url suivante: http://ubuntu/fms<br />
Vous devriez voir la jolie vidéo du train (à condition d&#8217;avoir Flash version 10 mais la mise à jour se fait en un simple click <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Créer une java web app (jsp) avec Flex builder 3 et Tomcat 6</title>
		<link>http://blog.baao.com/blog/?p=6</link>
		<comments>http://blog.baao.com/blog/?p=6#comments</comments>
		<pubDate>Fri, 04 Jan 2008 14:58:57 +0000</pubDate>
		<dc:creator>olivier</dc:creator>
				<category><![CDATA[Blaze DS]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[webapp]]></category>

		<guid isPermaLink="false">http://baao.com/blog/?p=6</guid>
		<description><![CDATA[Si vous avez installé Europa EE et Flex Builder 3 plugin, configuré Tomcat, vous allez voir qu'il est assez simple de créer une application mixte Java et Flex.]]></description>
			<content:encoded><![CDATA[<p><em>Note : Si vous avez installé Europa EE et Flex Builder 3 plugin, configuré Tomcat, vous allez voir qu&#8217;il est assez simple de créer une application mixte Java et Flex.</em></p>
<p><em>Sinon rendez-vous sur mon billet sur ce même blog.</em></p>
<h2>1- Créons la JavaFlexApp</h2>
<h3>a- Création du projet Flex</h3>
<p>Dans la perspective Flex Development allez dans le menu File-&gt;New-&gt;Flex Project</p>
<h3>b- Etape 1</h3>
<ol>
<li>Project Name : JavaFlexApp</li>
<li>Application Type : Web Application</li>
<li>Application server Type : J2EE</li>
<li>Décochez Use remote object&#8230;service</li>
<li>Cochez Create combined&#8230;WTP</li>
<li>Changez le java source folder : srcjava</li>
</ol>
<p>Next&#8230;</p>
<p><img class="alignnone size-medium wp-image-8" title="Panneau de configuration : écran 1" src="http://box.baao.com/blog/wp-content/uploads/2009/01/wizard1.gif" alt="Panneau de configuration : écran 1" /></p>
<h3>c- Etape 2</h3>
<p>J&#8217;ai laissé toutes les valeurs par défaut</p>
<p>Next&#8230;</p>
<h3>d- Etape 3</h3>
<p>J&#8217;ai changé pour srcflex (je préfère <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Finish&#8230;</p>
<p><img class="alignnone size-full wp-image-17" title="wizard3" src="http://box.baao.com/blog/wp-content/uploads/2009/01/wizard3.gif" alt="wizard3" /></p>
<p>Pour ceux qui ont connu l&#8217;équivalent en Flex 2, c&#8217;est trop simple <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>2- Codons la partie serveur</h2>
<h3>a- Créons la classe Clock</h3>
<p>Basculons dans la perspective J2EE pour créer la classe Java com.baao.test.Clock (cliquez droit sur le répertoire Java Resources: srcjava puis New-&gt; Class) dont voici le code:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.baao.test</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Date</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Clock
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTimeAsString<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>b- Créons la JSP ClockView.jsp</h3>
<p>Cliquons droit sur le répertoire WebContent puis New-&gt;JSP. Recopions le code ci-dessous:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>xml version<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1.0&quot;</span> encoding<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;utf-8&quot;</span><span style="color: #339933;">?&gt;</span>
<span style="color: #339933;">&lt;%</span>@page <span style="color: #000000; font-weight: bold;">import</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;com.baao.test.Clock;&quot;</span><span style="color: #339933;">%&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;%</span>
	<span style="color: #666666; font-style: italic;">//Pour éviter la mise en cache par le navigateur de la réponse</span>
	response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Cache-Control&quot;</span>,<span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	response.<span style="color: #006633;">setHeader</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Pragma&quot;</span>,<span style="color: #0000ff;">&quot;no-cache&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	response.<span style="color: #006633;">setDateHeader</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Expires&quot;</span>, <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">%&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>info<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span>
  <span style="color: #339933;">&lt;</span>date<span style="color: #339933;">&gt;&lt;%=</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> Clock<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getTimeAsString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%&gt;&lt;/</span>date<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>info<span style="color: #339933;">&gt;</span></pre></div></div>

<h3>Testons</h3>
<ol>
<li>Lancer le serveur s&#8217;il ne tourne pas (dans la vue serveur)</li>
<li>Sélectionnons la JSP par un click droit Run as-&gt;Run on server</li>
<li>Sélectionnez le bon serveur (Tomcat 6 chez moi)</li>
<li>Ajoutons JavaFlexApp au projet</li>
<li>Update du Context Root</li>
<li>Finish&#8230;</li>
</ol>
<p> <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><img class="alignnone size-full wp-image-12" title="vue-jsp" src="http://box.baao.com/blog/wp-content/uploads/2009/01/vue-jsp.gif" alt="vue-jsp" /></p>
<h2>3- Du Flex, du flex, du flex !</h2>
<h3>Création</h3>
<p>Dans srcflex, remplaçons le contenu de la JavaFlexApp.mxml par:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">	creationComplete=<span style="color: #ff0000;">&quot;clockService.send()&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:HTTPService</span> id=<span style="color: #ff0000;">&quot;clockService&quot;</span> url=<span style="color: #ff0000;">&quot;ClockView.jsp&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
	<span style="color: #000000;">&lt;;mx:Label id=<span style="color: #ff0000;">&quot;clockLabel&quot;</span> text=<span style="color: #ff0000;">&quot;{clockService.lastResult.info.date}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Refresh!&quot;</span> click=<span style="color: #ff0000;">&quot;clockService.send()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<h3>b- Exécution</h3>
<p>Sur ce mxml, click droit puis Run as-&gt;Flex Application</p>
<p><img class="alignnone size-full wp-image-14" title="vue-flex" src="http://box.baao.com/blog/wp-content/uploads/2009/01/vue-flex.gif" alt="vue-flex" /></p>
<p>Bienvenue dans le monde JavaFlexApp <img src='http://blog.baao.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>-Yann</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.baao.com/blog/?feed=rss2&amp;p=6</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

