You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Zog TheBogue <zo...@hotmail.com> on 2004/07/19 16:02:49 UTC

Jasper XML encoding support

Hi
I'm using tomcat-4.1.30 on a Japanese windows machine.
I believe I found a problem with the way XML JSP syntax is
handled in Jasper. It seems the 'encoding' attribute in
the <?xml declaration is not taken into account. I searched the
lists for no avail on this specific pb, and then dug into the code:

In org.apache.jasper.compiler.ParserController#figureOutJspDocument()
there is this comment:
	// Figure out the encoding of the page
	// FIXME: We assume xml parser will take care of
        // encoding for page in XML syntax. Correct?

This is correct if you feed the XML parser with a bare InputStream
(i.e. if your InputSource is built around an InputStream). However,
the ParserController build an InputStreamReader based on the
default encoding (ISO-8859-1), which ends up beeing the
InputSource base stream (see JspDocumentParser#parse).
In this case, it seems that  the XML parser (Xerces in my case)
assumes the encoding
of the stream is correct, instead of trying to figure it out of the
xml declaration.

Also, it seems the <jsp:directive.page encoding=.../> is not
properly taken into account. The Compiler#generateJava method
will first setup the ServletWriter with the default encoding (UTF-8)
and then call Validator#validate() which is responsible for
handling the page directives. So the writer is already configured
with UTF-8 at the time the real encoding is read.

Am I mis-unterpreting the specs or code ? Anybody had problems
with encodings in Jasper ?
            /zog

_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN Premium   
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Linux Virtual Hosting - weird file not found exception

Posted by Matt Anderson <mu...@swiftdsl.com.au>.
Hi everyone,

I have this problem on my Linux server with tomcat. I recently put in some
virtual hosts and these have worked on a windows 2000 server machine but
doesn't seem to work with linux (Debian).

For some reason it goes to compile the jsp files in a wierd directory
/usr/apps/jakarta-tomcat-5.0.25/work\Catalina\www.extremescrapping.com\_/org
/apache/jsp/index_jsp.class
I believe it should be
/usr/apps/jakarta-tomcat-5.0.25/work/Catalina/www.extremescrapping.com/_/org
/apache/jsp/index_jsp.class

Does anyone know how to make it so it compiles using the correct linux file
path separator and not the windows one. Keep in mind I installed this from
the tar file found Jakarta's website and didn't just copy the files from
windows across. I also manually entered in the virtual hosting ensuring that
the file path separator was a '/'. However I have now run out of ideas. Can
anyone help me please? Below is an example of a failed compile when
index.jsp was requested.

Kindest Regards,
Matt Anderson

java.io.FileNotFoundException: no such file:
/usr/apps/jakarta-tomcat-5.0.25/work\Catalina\www.extremescrapping.com\_/org
/apache/jsp/index_jsp.class
        at
org.apache.jasper.compiler.SmapUtil$SDEInstaller.<init>(SmapUtil.java:248)
        at
org.apache.jasper.compiler.SmapUtil$SDEInstaller.install(SmapUtil.java:236)
        at
org.apache.jasper.compiler.SmapUtil.installSmap(SmapUtil.java:163)
        at
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:420)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:463)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
        at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
11)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
74)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:237)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:157)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:214)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:198)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:152)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117
)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:102)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContex
t.java:104)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
ction(Http11Protocol.java:702)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:644)
        at java.lang.Thread.run(Thread.java:534)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org