You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Carlos Adolfo Ortiz Quiros <ca...@trebol.com.co> on 2007/11/29 15:54:31 UTC

A Bug in org.apache.myfaces.webapp.filter.ExtensionsFilter functionallity

HI you all

This is a repost, as I have not got a solution to my question by tomahawk developers (this is regarding the Extension Filter class org.apache.myfaces.webapp.filter.ExtensionsFilter which I consider there is a bug because the resulting page gets HTML encoded which should not be, that is, where in the page there is a á character and using the page encoding windows-1252  it is converted to the equivalent &#255; HTML code and thus altering the functionality of the page as such). Following is the original POST.

Any help is appreciated.

Thank you all.

 

After a great amount of time trying to find why web page in the source code gets altered I concluded that the Extensions Filter is doing something that should not be doing or perhaps I don't know how to fix.

 

Here is the situation.

First code sample

<%@ page contentType="text/html;charset=windows-1252"%>

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>

<f:view>

  <html>

    <head>

      <meta http-equiv="Content-Type"

            content="text/html; charset=windows-1252"/>

      <meta name="Eddy Johana Angarita Navarro" content="TRÉBOL Software S.A."></meta>

<script type="text/javascript" language="JavaScript">

        

        

        //Valida la longitud de un texto.

function validaLongitud(texto, longitud, e) {

if (!e) e = window.event;

 

if (!isEdicionKey(e) && texto.value.length >= longitud) {

alert("No puede digitar más de " + longitud + " caracteres.");

return false;

}

 

return true;

}

// Valida si la tecla presionada es de edición.

// Utilizar unicamente en evento "onkeydown".

function isEdicionKey(e) {

if (!e) e = window.event;

var key = e.which ? e.which : e.keyCode;

 

return (key==8 || key==9 || (key >= 33 && key <= 40) || key==45 || key==46);

}

 

        function doOnKeyDown(e) {

          var obj = document.getElementById("frmSistemas:nombreSistema");

          validaLongitud(obj.value, 10, e);

        }

        </script>              

      <title>This is a full text sample</title>

    </head>

    <body onload="alert('más o áéíóúñÑ');">This is it verbatim and m&aacute;s to

                                           this<h:form>

        <h:inputText maxlength="10" onkeypress="return validaLongitud(this, 10, event);"/>        

      </h:form></body>

  </html>

</f:view>

 

See the text in bold above.

I am using MyFaces tomahawk and have configured the ExtensionsFilter as stated in the page http://myfaces.apache.org/tomahawk/extensionsFilter.html

 

I have put this page in a tomcat server and captured the generated java code and the characters are preserved but when I look at the source code in the Internet Browser, it gets altered to HTML characters, that is á is changed to &aacute; or &#255;.

 

See in page

<%@ page contentType="text/html;charset=windows-1252"%>

<meta http-equiv="Content-Type"

            content="text/html; charset=windows-1252"/>

 

To enforce page is interpreted correctly by browser

 

I think this is a bug because the whole page should not be encoded, only what needed by the filter.

Is there a way to fix this or it is indeed a bug in the library.

 

 

CARLOS ADOLFO ORTIZ Q

Ingeniero de Desarrollo

TRÉBOL Software S.A.

Tel : (574)3110663 Fax : (574)3113474

Dirección Cll 16 # 28-195

Medellín - Colombia

http://www.trebol.com.co <http://www.trebol.com.co/> 

 

La información de este mensaje y sus anexos son propiedad exclusiva
de TRÉBOL Software S.A. Es  únicamente para el uso del destinatario
intencional  y  pueden  contener  información de carácter privado o
confidencial. Le  informamos que cualquier revisión, retransmisión,
divulgación,  copia  o  uso  indebido  del mismo está estrictamente
prohibida  y será sancionada legalmente.



Information contained in this message and every attachment is property of TREBOL Software S.A. Only the destiny user is able to make use of the data here contained, which is private and/or confidential. Any revision, broadcasting, spreading, copy or illegal use of this information is strictly prohibited and will be sanctioned by legal means.