You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Garret Wilson <ga...@globalmentor.com> on 2004/09/18 02:55:34 UTC

valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

With Tomcat 5.5.2, JSF, and JSP, I'm serving up pure, 
standards-compliant XHTML 1.1 that starts out with:

<?xml version="1.0">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

That works just fine with FireFox, but with IE (the very latest and 
greatest available), I get:

Parameter entity must be defined before it is used. Error processing 
resource 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd...

%xhtml-prefw-redecl.mod;
-^

Apparently, it's because of an IE bug that chokes if the content is 
served as text/xml. See:

http://lists.w3.org/Archives/Public/www-math/2002Apr/0002.html
http://www.biglist.com/lists/xsl-list/archives/200405/msg00106.html
http://www.intertwingly.net/blog/1626.html

How do I tell Tomcat to serve JavaServer Faces files as text/html (or 
application/html+xml, but maybe that's asking for too much) so that IE 
users can access content that's apparently too standards-compliant for 
their browsers?

Garret


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


Re: chroot Linux 2.4.20-8 and tomcat 5.0.27

Posted by Glen Ezkovich <gl...@hard-bop.com>.
Thanks Oliver, that did the trick. I had the feeling that was the 
directory I needed but for some reason I tried to make a new copy. What 
was I thinking.

On Sep 19, 2004, at 9:42 AM, Olivier Jolly wrote:

> Just for checking, have you mounted /proc in the chroot ? It is a 
> source of valuable information for any program running inside the jail 
> and could explain the misbehaviour.
> "mount -t proc /proc proc" as root in the chroot
>
> Olivier
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

Glen Ezkovich
HardBop Consulting
glen at hard-bop.com
http://www.hard-bop.com - new and improved site coming soon



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


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


Re: chroot Linux 2.4.20-8 and tomcat 5.0.27

Posted by Olivier Jolly <ol...@pcedev.com>.
Glen Ezkovich wrote:

> Sjoerd,
>
> Thanks for your input. We installed Java within the chroot jail and 
> are still having this problem. I have no problem increasing the stack 
> size using Xss but I have no idea what property sets the initial 
> thread stack location or which would allow us to allocate stack guard 
> pages.
>
Just for checking, have you mounted /proc in the chroot ? It is a source 
of valuable information for any program running inside the jail and 
could explain the misbehaviour.
"mount -t proc /proc proc" as root in the chroot

Olivier

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


Re: chroot Linux 2.4.20-8 and tomcat 5.0.27

Posted by Glen Ezkovich <gl...@hard-bop.com>.
Sjoerd,

Thanks for your input. We installed Java within the chroot jail and are 
still having this problem. I have no problem increasing the stack size 
using Xss but I have no idea what property sets the initial thread 
stack location or which would allow us to allocate stack guard pages.

On Sep 19, 2004, at 8:06 AM, Sjoerd van Leent wrote:

> Did you install Java within or without the chroot jail?
>
> If it is without the chroot jail, it can't detect certain 
> configuration files, with the abcense of these, it doesn't know how to 
> initialize itself. You could either:
>
> Use the parameters for the java executable
> Copy the needed configuration files (property files)
> Install Java within the chroot jail
>
> Regards,
> Sjoerd
>
> Glen Ezkovich wrote:
>
>> We are trying to run tomcat 5.0.27 in a chroot jail on Linux 2.4.20-8 
>> . When we start tomcat we always get the following error message:
>>
>>> Java HotSpot(TM) Client VM warning: Can't detect initial thread 
>>> stack location
>>
>>
>> About 50% of the time its worse.
>>
>>> Java HotSpot(TM) Client VM warning: Can't detect initial thread 
>>> stack location
>>> Java HotSpot(TM) Client VM warning: Attempt to allocate stack guard 
>>> pages failed.
>>> Fatal: Stack size too small. Use 'java -Xss' to increase default 
>>> stack size.
>>
>>
>> We get the same error running any java application with chroot. I'm 
>> pretty sure this is because some file with important information is 
>> not available inside our chrooted file structure.
>>
>> Does anyone have a solution to this problem?
>>
>> Thanks,
>>
>> Glen Ezkovich
>> HardBop Consulting
>> glen at hard-bop.com
>> http://www.hard-bop.com - new and improved site coming soon
>>
>>
>>
>> A Proverb for Paranoids:
>> "If they can get you asking the wrong questions, they don't have to 
>> worry about answers."
>> - Thomas Pynchon Gravity's Rainbow
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

Glen Ezkovich
HardBop Consulting
glen at hard-bop.com
http://www.hard-bop.com - new and improved site coming soon



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


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


Re: chroot Linux 2.4.20-8 and tomcat 5.0.27

Posted by Sjoerd van Leent <sv...@wanadoo.nl>.
Did you install Java within or without the chroot jail?

If it is without the chroot jail, it can't detect certain configuration 
files, with the abcense of these, it doesn't know how to initialize 
itself. You could either:

Use the parameters for the java executable
Copy the needed configuration files (property files)
Install Java within the chroot jail

Regards,
Sjoerd

Glen Ezkovich wrote:

> We are trying to run tomcat 5.0.27 in a chroot jail on Linux 2.4.20-8 
> . When we start tomcat we always get the following error message:
>
>> Java HotSpot(TM) Client VM warning: Can't detect initial thread stack 
>> location
>
>
> About 50% of the time its worse.
>
>> Java HotSpot(TM) Client VM warning: Can't detect initial thread stack 
>> location
>> Java HotSpot(TM) Client VM warning: Attempt to allocate stack guard 
>> pages failed.
>> Fatal: Stack size too small. Use 'java -Xss' to increase default 
>> stack size.
>
>
> We get the same error running any java application with chroot. I'm 
> pretty sure this is because some file with important information is 
> not available inside our chrooted file structure.
>
> Does anyone have a solution to this problem?
>
> Thanks,
>
> Glen Ezkovich
> HardBop Consulting
> glen at hard-bop.com
> http://www.hard-bop.com - new and improved site coming soon
>
>
>
> A Proverb for Paranoids:
> "If they can get you asking the wrong questions, they don't have to 
> worry about answers."
> - Thomas Pynchon Gravity's Rainbow
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>



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


chroot Linux 2.4.20-8 and tomcat 5.0.27

Posted by Glen Ezkovich <gl...@hard-bop.com>.
We are trying to run tomcat 5.0.27 in a chroot jail on Linux 2.4.20-8 . 
When we start tomcat we always get the following error message:

> Java HotSpot(TM) Client VM warning: Can't detect initial thread stack 
> location

About 50% of the time its worse.

> Java HotSpot(TM) Client VM warning: Can't detect initial thread stack 
> location
> Java HotSpot(TM) Client VM warning: Attempt to allocate stack guard 
> pages failed.
> Fatal: Stack size too small. Use 'java -Xss' to increase default stack 
> size.

We get the same error running any java application with chroot. I'm 
pretty sure this is because some file with important information is not 
available inside our chrooted file structure.

Does anyone have a solution to this problem?

Thanks,

Glen Ezkovich
HardBop Consulting
glen at hard-bop.com
http://www.hard-bop.com - new and improved site coming soon



A Proverb for Paranoids:
"If they can get you asking the wrong questions, they don't have to 
worry about answers."
- Thomas Pynchon Gravity's Rainbow


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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Garret Wilson <ga...@globalmentor.com>.
Hassan Schroeder wrote:
> Garret Wilson wrote:
>> Thanks for the example. Note, however, that you're example 
>> doesn't enumerate *all* the accept headers, which means it won't work 
>> if a browser decides to sent each accept string as a separate header.
> 
> True -- is that legal? I just looked at RFC2616 and it doesn't seem
> to be explicitly specified, so...

    Multiple message-header fields with the same field-name MAY be
    present in a message if and only if the entire field-value for that
    header field is defined as a comma-separated list [i.e., #(values)].
    It MUST be possible to combine the multiple header fields into one
    "field-name: field-value" pair, without changing the semantics of the
    message, by appending each subsequent field-value to the first, each
    separated by a comma. The order in which header fields with the same
    field-name are received is therefore significant to the
    interpretation of the combined field value, and thus a proxy MUST NOT
    change the order of these field values when a message is forwarded.

(RFC 2616, 32)

(I ran into several years ago working on a SIP processor, but that's 
another story.)

> I know I've never seen a UA do that
> but if it's possible, Murphy will make it happen at the worst possible
> time :-)

Well, considering 9X% of the market is using Murphysoft browsers, we 
better code for that possibility... ;)

I found an article that gives a nice overview of the situation we've 
been discussing:

http://www.greytower.net/en/archive/articles/xhtmlcontent.html

Best,

Garret


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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Garret Wilson wrote:

> I was *just* about to check into filters (or go insane, one or the 
> other). Thanks for the example. Note, however, that you're example 
> doesn't enumerate *all* the accept headers, which means it won't work if 
> a browser decides to sent each accept string as a separate header.

True -- is that legal? I just looked at RFC2616 and it doesn't seem
to be explicitly specified, so... I know I've never seen a UA do that
but if it's possible, Murphy will make it happen at the worst possible
time :-)

-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Garret Wilson <ga...@globalmentor.com>.
Hassan Schroeder wrote:
> 3. Use a Filter -- here's a quick example, you may need to tweak it
>    for your particular situation --

I was *just* about to check into filters (or go insane, one or the 
other). Thanks for the example. Note, however, that you're example 
doesn't enumerate *all* the accept headers, which means it won't work if 
a browser decides to sent each accept string as a separate header.

Garret

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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Garret Wilson wrote:

> Oh, this is just a nightmare.
> 
> Using JavaServer Faces, here are the options:
> 
> 1. Just add a JSP directive:
> 2. Add a script to check for what the browser accepts:

3. Use a Filter -- here's a quick example, you may need to tweak it
    for your particular situation --

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public class Accept implements Filter {

   private FilterConfig config = null;
   private String  htmlContentType = "text/html";
   private String xhtmlContentType = "application/xhtml+xml";

   public void init(FilterConfig config) throws ServletException
   {
     this.config = config;
   }

   public void destroy()
   {
     config = null;
   }

   public void doFilter(ServletRequest request, ServletResponse response,
                  FilterChain chain) throws IOException, ServletException
   {
     String thisContentType = "";
     if (request instanceof HttpServletRequest)
     {
       String AcceptHeader = 
((HttpServletRequest)request).getHeader("Accept").toString();

       if ( AcceptHeader.matches(".*application/xhtml\\+xml.*") )
       {
         thisContentType = xhtmlContentType;
       }
       else
       {
         thisContentType = htmlContentType;
       }
     }
     response.setContentType(thisContentType);
     chain.doFilter(request, response);
   }
}

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Garret Wilson <ga...@globalmentor.com>.
Oh, this is just a nightmare.

Using JavaServer Faces, here are the options:

1. Just add a JSP directive:

<jsp:directive.page contentType="text/html"/>

Of course, that turns *all* pages into text/html, which we don't want to 
do for non-broken browsers such as Firefox and Mozilla.

2. Add a script to check for what the browser accepts:

<jsp:directive.page import="java.util.Enumeration"/>
<jsp:scriptlet>
   String contentType="text/html";
   final Enumeration httpAcceptEnumeration=request.getHeaders("accept");
   while(httpAcceptEnumeration.hasMoreElements())
   {
 
if(((String)httpAcceptEnumeration.nextElement()).indexOf("application/xhtml+xml")>=0)
     {
       contentType="application/xhtml+xml";
       break;

     }
   }
   response.setContentType(contentType);	//set the content type to 
whatever we decided upon
</jsp:scriptlet>

That works really well; on Firefox it returns application/xhtml+xml, and 
for buggy browsers (and browsers that don't support XML at all, IE being 
the former) it returns text/html.

But do I want to put all of that junk in all of my JavaServer Faces 
files? I don't think so. Inclusion sounds perfect, but here's the 
problem: if I include the code statically, it doesn't get executed. If I 
include it dynamically, it doesn't correctly set the content-type header 
because its output is fed into the main page, which is working with the 
real HTTP request/response.

Anyone have an idea on this really nasty situation? Or should I just go 
back to sending out HTML 3.x?

Garret


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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Garret Wilson <ga...@globalmentor.com>.
Morten Liebach wrote:
> The nicest solution is to follow the tips in this article:
> 
>     http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html
> 
> Basically , if the HTTP_ACCEPT variable contains the string
> "application/xhtml+xml" set MIME-Type to that, otherwise set it to
> "text/html".
> 
> And no, I have no idea how you do that in Java/JSP, I'm too much of a
> newbie yet, but eventually I'll have to do something like that myself.

Thanks for the nice tip.

It seems like this checking is something you would do on the 
server---Tomcat. You could probably get it done somewhere in the 
internals of the JavaServer Faces implementation, too.

I found <mime-mapping> in web.xml and tried setting the "faces" 
extension to return text/html. No luck. Then I tried the "jsp" 
extension. No luck there, either. The _Java™ Servlet Specification
Version 2.4_ is no help. Neither is _Professional Apache Tomcat 5_.

Can Tomcat handle this?

Is there something I can put in my JSF page to handle this? Rather than 
placing hacks throughout my pages, though, I'd like to just tell Tomcat 
to serve text/html for now---how do I do that?

Garret

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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Morten Liebach <m...@mongers.org>.
On 2004-09-17 23:27:01 -0700, Mark Eggers wrote:
> Yes, but the actual XSL is just a copy statement:
> 
> <stylesheet version="1.0"
>      xmlns="http://www.w3.org/1999/XSL/Transform">
>     <template match="/">
>         <copy-of select="."/>
>     </template>
> </stylesheet>
> 
> This should mean that no actual transformation gets done.
> 
> However, also from the FAQ:
> 
> Why is it allowed to send XHTML 1.0 documents as text/html?

[snip]

> A third hack might be to use the:
> 
>   <!--[if IE]>
> 
>   <![endif]-->
> 
> hack in your document.  This means that only Internet Exploder will see
> what's there.

The nicest solution is to follow the tips in this article:

    http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html

Basically , if the HTTP_ACCEPT variable contains the string
"application/xhtml+xml" set MIME-Type to that, otherwise set it to
"text/html".

And no, I have no idea how you do that in Java/JSP, I'm too much of a
newbie yet, but eventually I'll have to do something like that myself.
 
> Sigh - asking Microsoft to play by the rules is just not a possible
> thing.

It is, it just won't help.

Have a nice day
                                 Morten

-- 
http://m.mongers.org/ -- http://gallery.zentience.org/
__END__

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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Mark Eggers <it...@yahoo.com>.
Yes, but the actual XSL is just a copy statement:

<stylesheet version="1.0"
     xmlns="http://www.w3.org/1999/XSL/Transform">
    <template match="/">
        <copy-of select="."/>
    </template>
</stylesheet>

This should mean that no actual transformation gets done.

However, also from the FAQ:

Why is it allowed to send XHTML 1.0 documents as text/html?

XHTML is an XML format; this means that strictly speaking it should be
sent with an XML-related media type (application/xhtml+xml,
application/xml, or text/xml). However XHTML 1.0 was carefully designed
so that with care it would also work on legacy HTML user agents as well.
If you follow some simple guidelines, you can get many XHTML 1.0
documents to work in legacy browsers. However, legacy browsers only
understand the media type text/html, so you have to use that media type
if you send XHTML 1.0 documents to them. But be well aware, sending
XHTML documents to browsers as text/html means that those browsers see
the documents as HTML documents, not XHTML documents.

A third hack might be to use the:

  <!--[if IE]>

  <![endif]-->

hack in your document.  This means that only Internet Exploder will see
what's there.

Sigh - asking Microsoft to play by the rules is just not a possible
thing.

/mde/
just my two cents . . . .


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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Garret Wilson <ga...@globalmentor.com>.
No, please, tell me it's all a bad dream...

Doesn't that workaround mean that all browsers, even ones that support 
XHTML 1.1 (such as Firefox), will suddenly start applying an XSL 
transformation to the entire web page?

Wouldn't it be a much less nasty hack just to tell Tomcat to serve these 
pages as text/html? How can I do that?

Garret

Mark Eggers wrote:
> On Fri, 2004-09-17 at 17:55, Garret Wilson wrote:
> 
>>With Tomcat 5.5.2, JSF, and JSP, I'm serving up pure, 
>>standards-compliant XHTML 1.1 that starts out with:
>>
>><?xml version="1.0">
>><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
>>"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
>><html xmlns="http://www.w3.org/1999/xhtml">
>>
>>That works just fine with FireFox, but with IE (the very latest and 
>>greatest available), I get:
>>
>>Parameter entity must be defined before it is used. Error processing 
>>resource 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd...
>>
>>%xhtml-prefw-redecl.mod;
>>-^
> 
> 
> Yep - known bug that IE cannot handle this.  Apparently there is a
> work-around detailed at:
> 
> http://www.w3.org/MarkUp/2004/xhtml-faq#texthtml
> 
> I haven't tried it yet.
> 
> /mde/
> just my two cents . . . .
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

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


Re: valid XHTML 1.1, Tomcat, text/xml, and @!&* IE

Posted by Mark Eggers <it...@yahoo.com>.
On Fri, 2004-09-17 at 17:55, Garret Wilson wrote:
> With Tomcat 5.5.2, JSF, and JSP, I'm serving up pure, 
> standards-compliant XHTML 1.1 that starts out with:
> 
> <?xml version="1.0">
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> 
> That works just fine with FireFox, but with IE (the very latest and 
> greatest available), I get:
> 
> Parameter entity must be defined before it is used. Error processing 
> resource 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd...
> 
> %xhtml-prefw-redecl.mod;
> -^

Yep - known bug that IE cannot handle this.  Apparently there is a
work-around detailed at:

http://www.w3.org/MarkUp/2004/xhtml-faq#texthtml

I haven't tried it yet.

/mde/
just my two cents . . . .


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