<?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>.:: Seam City ::. &#187; seo</title>
	<atom:link href="http://seamcity.madeinxpain.com/archives/tag/seo/feed" rel="self" type="application/rss+xml" />
	<link>http://seamcity.madeinxpain.com</link>
	<description>Sobre programación en general, y Seam en particular</description>
	<lastBuildDate>Thu, 22 Jan 2009 15:35:41 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SEO-friendly URLs con Seam II</title>
		<link>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii</link>
		<comments>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii#comments</comments>
		<pubDate>Fri, 25 Jul 2008 08:55:12 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[seam]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/?p=52</guid>
		<description><![CDATA[Vamos a ampliar la información del post anterior con conceptos más avanzados.
Partimos de la base de que tenemos configurado y funcionando el módulo UrlRewrite.
El primer problema con el que me topé es que mi aplicación usaba identificadores numéricos, tipo .../product.seam?idProduct=123. Por lo tanto necesitaba traducir el identificador numerico a una palabra descriptiva del producto, como [...]]]></description>
			<content:encoded><![CDATA[<p>Vamos a ampliar la información del post anterior con conceptos más avanzados.<br />
Partimos de la base de que tenemos configurado y funcionando el módulo UrlRewrite.</p>
<p>El primer problema con el que me topé es que mi aplicación usaba identificadores numéricos, tipo .../product.seam?idProduct=123. Por lo tanto necesitaba traducir el identificador numerico a una palabra descriptiva del producto, como .../product/silla o .../product/mesa.</p>
<p>
Afortunadamente con Seam eso no presenta mucha dificultad y puede emplearse una EL Expression tipo #{rewriter.fromNameToId('silla')}.<br />
Por desgracia, en el archivo urlrewrite.xml no pueden incluirse EL Expressions.
</p>
<p>
Para solucionarlo, creé una 'página virtual' en el pages.xml que recogía los parámetros como String de la url y mediante una llamada a un componente de Seam los traducía en el correspondiente identificador numérico, aprovechando que en el archivo pages.xml sí que se pueden usar EL Expressions.</p>
<ul>
<li>Fichero urlrewrite.xml
<div class="syntax_hilite">
<div id="xml-4">
<div class="xml"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;from<span style="font-weight: bold; color: black;">&gt;</span></span></span>^/pruduct/([A-Za-z]*)$<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/from<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;to</span> <span style="color: #000066;">last</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">&gt;</span></span>/virtual_product.seam?name=$1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/to<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p>
        </li>
<li>Fichero pages.xml
<div class="syntax_hilite">
<div id="xml-5">
<div class="xml">.....<br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;page</span> <span style="color: #000066;">view-id</span>=<span style="color: #ff0000;">"/virtual_product.xhtml"</span> <span style="color: #000066;">action</span>=<span style="color: #ff0000;">"#{product.init}"</span><span style="font-weight: bold; color: black;">&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"name"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;navigation<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;redirect</span> <span style="color: #000066;">view-id</span>=<span style="color: #ff0000;">"/product.seam"</span><span style="font-weight: bold; color: black;">&gt;</span></span>&nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;param</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"idProduct"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"#{urlRewriter.idProductFromName(name)}"</span><span style="font-weight: bold; color: black;">/&gt;</span></span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/redirect<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/navigation<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/page<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
.....</div>
</div>
</div>
<p>
         </li>
<li>Componente rewrite
<div class="syntax_hilite">
<div id="java-6">
<div class="java"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #993333;">int</span> idProductFromName<span style="color: #66cc66;">&#40;</span><a href="http://www.google.com/search?q=allinurl%3AString+java.sun.com&amp;bntl=1" onclick="javascript:pageTracker._trackPageview('article_out/www.google.com');"><span style="color: #aaaadd; font-weight: bold;">String</span></a> name<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Consulta en la bbdd para halar </span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// el id del producto a partir del nombre</span><br />
<span style="color: #66cc66;">&#125;</span></div>
</div>
</div>
<p></p>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam-ii/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SEO-friendly URLs con Seam</title>
		<link>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam</link>
		<comments>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam#comments</comments>
		<pubDate>Thu, 17 Jul 2008 06:36:53 +0000</pubDate>
		<dc:creator>Tes</dc:creator>
				<category><![CDATA[seam]]></category>
		<category><![CDATA[seo]]></category>

		<guid isPermaLink="false">http://seamcity.madeinxpain.com/?p=51</guid>
		<description><![CDATA[Hoy en día están muy de moda las aplicaciones web y blogs con URLs amigables, tipo http://seamcity.madeinxpain.com/archives/category/seam.
Estas URLs además de ser más intuitivas y agradables a la vista, también son más agradables para buscadores de internet como google (o podríamos decir más agradables para EL BUSCADOR de internet).Esta es una de las técnicas seo más [...]]]></description>
			<content:encoded><![CDATA[<p>Hoy en día están muy de moda las aplicaciones web y blogs con URLs amigables, tipo http://seamcity.madeinxpain.com/archives/category/seam.</p>
<p>Estas URLs además de ser más intuitivas y agradables a la vista, también son más agradables para buscadores de internet como google (o podríamos decir más agradables para EL BUSCADOR de internet).Esta es una de las <a href="http://es.wikipedia.org/wiki/Barnizagaitas" onclick="javascript:pageTracker._trackPageview('article_out/es.wikipedia.org');" target="_blank">técnicas seo</a> más simples, destinadas a mejorar tu posicionamiento en buscadores.</p>
<p>En Seam podemos obtener estas URLs sencillas a través del filtro URLrewrite. Este filtro básicamente se encarga de traducir URLs, y es muy muy fácil de usar.<br />
Una de las principales ventajas es que es una capa independiente que se coloca por encima de la aplicación. No es necesario modificar ni una línea de código ya existente, simplemente definir cómo se van a traducir las direcciones.</p>
<ol>
<li>Añadir el archivo <strong>urlrewrite.jar</strong> que viene incluido en la distribución de Seam en la carpeta WEB-INF/lib del proyecto. La mejor forma de hacerlo es mediante el archivo de ant que crea el seam-gen</li>
<li><strong>Configurar el filtro</strong> UrlRewrite en el web.xml tal y como se indica <a href="http://tuckey.org/urlrewrite/" onclick="javascript:pageTracker._trackPageview('article_out/tuckey.org');">aqui</a></li>
<li>Crear el fichero <strong>urlrewrite.xml</strong> que contiene las reglas de traduccion de urls en la carpeta WEB-INF. Aqui pongo el  fichero del ejemplo <em>seambay</em>, pero lo mejor es mirar la <a href="http://tuckey.org/urlrewrite/manual/3.0/" onclick="javascript:pageTracker._trackPageview('article_out/tuckey.org');">documentacion oficial</a>
<div class="syntax_hilite">
<div id="xml-8">
<div class="xml"><span style="color: #00bbdd;">&lt;!DOCTYPE urlrewrite<br />
&nbsp; &nbsp; PUBLIC &quot;-//tuckey.org//DTD UrlRewrite 3.0//EN&quot;<br />
&nbsp; &nbsp; &quot;http://tuckey.org/res/dtds/urlrewrite3.0.dtd&quot;&gt;</span></p>
<p><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span></p>
<p>&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;from<span style="font-weight: bold; color: black;">&gt;</span></span></span>^/feedback/([A-Za-z0-9]*)$<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/from<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;to</span> <span style="color: #000066;">last</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">&gt;</span></span>/feedback.seam?member=$1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/to<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;from<span style="font-weight: bold; color: black;">&gt;</span></span></span>^/itemdetail/([0-9]*)$<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/from<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;to</span> <span style="color: #000066;">last</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">&gt;</span></span>/auction.seam?id=$1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/to<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rule<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;from<span style="font-weight: bold; color: black;">&gt;</span></span></span>^/bidhistory/([0-9]*)$<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/from<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;to</span> <span style="color: #000066;">last</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">&gt;</span></span>/bidhistory.seam?id=$1<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/to<span style="font-weight: bold; color: black;">&gt;</span></span></span><br />
&nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rule<span style="font-weight: bold; color: black;">&gt;</span></span></span></p>
<p><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/urlrewrite<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</div>
</div>
<p></li>
</ol>
<p>En otro post esplicaré con más detalle las posibilidades del fichero urlrewrite.xml, cómo usar parámetros, cómo traducir de nombres a identificadores numéricos, y cómo conseguir que las urls amigables las pueda generar nuestra aplicación tras el envío de formularios o acciones.</p>
]]></content:encoded>
			<wfw:commentRss>http://seamcity.madeinxpain.com/archives/seo-friendly-urls-con-seam/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

