ohmage / gwt-front-end

The javascript/GWT code behind the front end.
6 stars 2 forks source link

CSS content type in tomcat config #275

Closed jeroen closed 11 years ago

jeroen commented 11 years ago

Tomcat configuration on lausd is still not setting css headers correctly? Internet Exporer is not displaying CSS because of this:

content type

stevenolen commented 11 years ago

We haven't pushed a new frontend there, since it wasn't in use. 2.14 frontend will be deployed before the mobilize deployment. On Feb 11, 2013 9:07 PM, "Jeroen" notifications@github.com wrote:

Tomcat configuration on lausd is still not setting css headers correctly? I.e. is not displaying CSS because of this:

[image: content type]https://a248.e.akamai.net/camo.github.com/859e80b3ac2f2be32f5b88f4e91a774719b43cad/687474703a2f2f692e696d6775722e636f6d2f416768584950482e706e67

— Reply to this email directly or view it on GitHubhttps://github.com/cens/ohmageFrontEnd/issues/275.

jeroen commented 11 years ago

I think we should upgrade asap on this host, to test the behavior of 2.14 in combination with the weird https/gmaps hacky stuff on this host.

hongsudt commented 11 years ago

Steven and John tried to update the front-end on lausd today but I think they had some difficulties. Josh will have to help with the process. Steven can document the process, so it can be repeated later.

On Mon, Feb 11, 2013 at 9:33 PM, Jeroen notifications@github.com wrote:

I think we should upgrade asap on this host, to test the behavior of 2.14 in combination with the weird https/gmaps hacky stuff on this host.

— Reply to this email directly or view it on GitHubhttps://github.com/cens/ohmageFrontEnd/issues/275#issuecomment-13418878.

jshslsky commented 11 years ago

Here's how you build the SSL version of the front end:

ant clean build buildwar

To build the non-SSL version:

ant clean build buildwar-nossl
jshslsky commented 11 years ago

The CSS issue should be fixed. I see the mime-mapping config in the web.xml files.

 <!-- Hack to get IE to render CSS properly -->
 <mime-mapping>
     <extension>css</extension>
     <mime-type>text/css</mime-type>
 </mime-mapping>  
jojenki commented 11 years ago

I am not sure if there is a default MIME mapping or not. I just created another, simple project that served up HTML, CSS, and JavaScript, and Chrome's Developer Tools complained that all of the MIME types were set to "text/text". I tried searching for a way to tell Tomcat to use some sort of defaults, e.g. ".html" files should always be set as "text/html".

If anyone can confirm this behavior, then great; if anyone knows a way to set these defaults, please let me know.

jeroen commented 11 years ago

Many of these problems can easily be avoided by using an actual web server like apache or nginx to serve static content, and use tomcat only for the servlets.

Apache2 ships with mod_proxy_ajp which allows you to very easily proxy sites to tomcat's high performance ajp13 interface. I use this for the installation packages and performance is really good.

On Wed, Feb 13, 2013 at 1:10 PM, John Jenkins notifications@github.comwrote:

I am not sure if there is a default MIME mapping or not. I just created another, simple project that served up HTML, CSS, and JavaScript, and Chrome's Developer Tools complained that all of the MIME types were set to "text/text". I tried searching for a way to tell Tomcat to use some sort of defaults, e.g. ".html" files should always be set as "text/html".

If anyone can confirm this behavior, then great; if anyone knows a way to set these defaults, please let me know.

— Reply to this email directly or view it on GitHubhttps://github.com/cens/ohmageFrontEnd/issues/275#issuecomment-13518271.

jshslsky commented 11 years ago

@jojenki There is not a default MIME mapping. You have to set the MIME type as in my example above. (Unless I just misunderstood your question.)

jojenki commented 11 years ago

That sounds correct. I just seems goofy not to have defaults for the most popular MIME types out there...

stevenolen commented 11 years ago

300 voice on THIS. IS. TOMCATTTTT.

On Wed, Feb 13, 2013 at 1:28 PM, John Jenkins notifications@github.comwrote:

That sounds correct. I just seems goofy not to have defaults for the most popular MIME types out there...

— Reply to this email directly or view it on GitHubhttps://github.com/cens/ohmageFrontEnd/issues/275#issuecomment-13519123.

jeroen commented 11 years ago

On Wed, Feb 13, 2013 at 1:28 PM, John Jenkins notifications@github.comwrote:

That sounds correct. I just seems goofy not to have defaults for the most popular MIME types out there...

Because it is not meant to serve static files in the first place.

jeroen commented 11 years ago

Can we redeploy the front-end on lausd to test if the CSS now displays properly in IE?

On Wed, Feb 13, 2013 at 1:30 PM, Jeroen Ooms jeroenooms@gmail.com wrote:

On Wed, Feb 13, 2013 at 1:28 PM, John Jenkins notifications@github.comwrote:

That sounds correct. I just seems goofy not to have defaults for the most popular MIME types out there...

Because it is not meant to serve static files in the first place.

jshslsky commented 11 years ago

Yes, it is meant to serve static content. In the default Tomcat distribution there should be a web.xml that has all of the MIME mappings you'd expect.

stevenolen commented 11 years ago

We're not deploying a new front-end on lausd until the last browser bug in 2.14 is fixed. there isn't a reason to. It will display properly though, since it'll be running the same frontend code that is currently on otest (which is running a version since the MIME type fix).

jeroen commented 11 years ago

W3C validation is still complaining about content-type headers, both lausd and otest:

http://validator.w3.org/check?uri=https%3A%2F%2Ftest.ohmage.org%2Fweb%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

http://validator.w3.org/check?uri=http%3A%2F%2Flausd.mobilizingcs.org%2Fweb%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

jojenki commented 11 years ago

I tried adding all of the standard mime-types in the web.xml, but it is still being returned without a Content-Type. It is probably because what is being returned is not a filename, so there is no extension to process.

<mime-mapping>
    <extension>css</extension>
    <mime-type>text/html</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>css</extension>
    <mime-type>text/css</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>jpg</extension>
    <mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>jpeg</extension>
    <mime-type>image/jpeg</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>png</extension>
    <mime-type>image/png</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>gif</extension>
    <mime-type>image/gif</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>ico</extension>
    <mime-type>image/x-icon</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>js</extension>
    <mime-type>application/javascript</mime-type>
</mime-mapping>
<mime-mapping>
    <extension>jsp</extension>
    <mime-type>text/text</mime-type>
</mime-mapping>