You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Sam Joseph <ga...@yha.att.ne.jp> on 2002/12/10 03:22:44 UTC
Not setting the Content Language Header
Hi,
I am trying to work out how to get a response from turbine (or tdk)
where the Content Language header is *not* set.
My changing the locale settings I find that I can change the Content
Language header:
locale.default.bundle=MyBundle
locale.default.language=ja
locale.default.country=JP
HTTP/1.1 200 OK
Content-Type: text/html; charset=SJIS
Date: Tue, 10 Dec 2002 01:54:20 GMT
Content-Language: ja-JP
Transfer-Encoding: chunked
Server: Apache Tomcat/4.0-b6-dev (HTTP/1.1 Connector)
however this has the unfortunate side effect of also adding a
Content-Type header.
Really what I would like is to be able to ensure that no
Content-Language or Content-Type headers were set at all.
I am trying to view output from Turbine on a Japanese cell phone and I
can view responses like this:
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Tue, 10 Dec 2002 00:40:45 GMT
Content-Type: text/html
Content-Length: 65
ETag: "65-1038973852966"
Last-Modified: Wed, 04 Dec 2002 03:50:52 GMT
but when Turbine adds a Content-Language header of any sort
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Tue, 10 Dec 2002 00:39:37 GMT
Connection: close
Content-Type: text/html
Content-Language: en-US
or
HTTP/1.1 200 OK
Content-Type: text/html; charset=SJIS
Server: Microsoft-IIS/5.0
Date: Tue, 10 Dec 2002 00:39:37 GMT
Connection: close
Content-Type: text/html
Content-Language: ja-JP
The Japanese characters do not render correctly.
Is there any way to avoid setting a Content-Language header? I find that
if I remove the locale settings from the Turbine.properties file then
the system defaults to en-US.
Any help very gratefully received.
CHEERS> SAM
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Not setting the Content Language Header
Posted by Sam Joseph <sa...@neurogrid.com>.
Hi,
[Note I am working against the TDK and Turbine 2.1]
So I've worked out how to avoid setting the Content-Language header and
Content-Type header, however it has involved me hacking up various bits
of Turbine. Specifically I have modifed Turbine.java so that we have:
// Modules can override these.
if(data.getLocale() != null)
{
data.getResponse()
.setLocale( data.getLocale() );
}
if(data.getContentType() != null)
{
data.getResponse()
.setContentType( data.getContentType() );
}
and adjusted DefaultTurbineRunData so that it allows null values for
content type and locale. Now if a module sets thigns like this:
data.setLocale(null);
data.setContentType(null);
then Turbine will avoid setting the relevant headers, and I can display
Japanese characters on my various cell phones.
Now I know this is a great big hack, but I really had to get this
working. Is there some better way to do this such as having the module
do something like:
data.setLocale(new Locale("blank"));
data.setContentType("blank");
and then having Turbine.java detect this specifically? I would very much
like to find an approach that didn't create other potential problems.
Thanks in advance.
CHEERS> SAM
Sam Joseph wrote:
>Hi,
>
>I have identified this part of the Turbine code as setting the locale
>values:
>
>if ( data.isPageSet() && data.isOutSet() == false )
>{
>// Modules can override these.
>data.getResponse()
>.setLocale( data.getLocale() );
>data.getResponse()
>.setContentType( data.getContentType() );
>
>I have tries to override these settings in the modules, in the
>doBuildTemplate() method, data.getResponse().setLocale(new
>Locale("ja","JP"));, but unfortunately to no avail.
>
>Either way I am not really interested in setting a different locale.
>What I really want to do is avoid any locale being set, and
>particularly, avoid the Content-Language header being set. If I set the
>locale to null I get an exception:
>
>java.lang.NullPointerException
>at org.apache.catalina.util.CharsetMapper.getCharset(CharsetMapper.java:164)
>at
>org.apache.catalina.connector.ResponseBase.setLocale(ResponseBase.java:826)
>at
>org.apache.catalina.connector.HttpResponseBase.setLocale(HttpResponseBase.java:800)
>at
>org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:173)
>at com.neurogrid.cerego.modules.screens.Test.doBuildTemplate(Test.java:49)
>
>making it seem like there is no way to have Turbine avoid setting a
>locale, and thus a Content-Language header. Am I missing anything here?
>
>Thanks in advance.
>
>CHEERS> SAM
>
>Sam Joseph wrote:
>
>
>
>>I am trying to work out how to get a response from turbine (or tdk)
>>where the Content Language header is *not* set.
>>
>>My changing the locale settings I find that I can change the Content
>>Language header:
>>
>>locale.default.bundle=MyBundle
>>locale.default.language=ja
>>locale.default.country=JP
>>
>>HTTP/1.1 200 OK
>>Content-Type: text/html; charset=SJIS
>>Date: Tue, 10 Dec 2002 01:54:20 GMT
>>Content-Language: ja-JP
>>Transfer-Encoding: chunked
>>Server: Apache Tomcat/4.0-b6-dev (HTTP/1.1 Connector)
>>
>>however this has the unfortunate side effect of also adding a
>>Content-Type header.
>>
>>Really what I would like is to be able to ensure that no
>>Content-Language or Content-Type headers were set at all.
>>
>>I am trying to view output from Turbine on a Japanese cell phone and I
>>can view responses like this:
>>
>>HTTP/1.1 200 OK
>>Server: Microsoft-IIS/5.0
>>Date: Tue, 10 Dec 2002 00:40:45 GMT
>>Content-Type: text/html
>>Content-Length: 65
>>ETag: "65-1038973852966"
>>Last-Modified: Wed, 04 Dec 2002 03:50:52 GMT
>>
>>but when Turbine adds a Content-Language header of any sort
>>
>>HTTP/1.1 200 OK
>>Server: Microsoft-IIS/5.0
>>Date: Tue, 10 Dec 2002 00:39:37 GMT
>>Connection: close
>>Content-Type: text/html
>>Content-Language: en-US
>>
>>or
>>
>>HTTP/1.1 200 OK
>>Content-Type: text/html; charset=SJIS
>>Server: Microsoft-IIS/5.0
>>Date: Tue, 10 Dec 2002 00:39:37 GMT
>>Connection: close
>>Content-Type: text/html
>>Content-Language: ja-JP
>>
>>The Japanese characters do not render correctly.
>>
>>Is there any way to avoid setting a Content-Language header? I find that
>>if I remove the locale settings from the Turbine.properties file then
>>the system defaults to en-US.
>>
>>Any help very gratefully received.
>>
>>CHEERS> SAM
>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Not setting the Content Language Header
Posted by Sam Joseph <ga...@yha.att.ne.jp>.
Hi,
I have identified this part of the Turbine code as setting the locale
values:
if ( data.isPageSet() && data.isOutSet() == false )
{
// Modules can override these.
data.getResponse()
.setLocale( data.getLocale() );
data.getResponse()
.setContentType( data.getContentType() );
I have tries to override these settings in the modules, in the
doBuildTemplate() method, data.getResponse().setLocale(new
Locale("ja","JP"));, but unfortunately to no avail.
Either way I am not really interested in setting a different locale.
What I really want to do is avoid any locale being set, and
particularly, avoid the Content-Language header being set. If I set the
locale to null I get an exception:
java.lang.NullPointerException
at org.apache.catalina.util.CharsetMapper.getCharset(CharsetMapper.java:164)
at
org.apache.catalina.connector.ResponseBase.setLocale(ResponseBase.java:826)
at
org.apache.catalina.connector.HttpResponseBase.setLocale(HttpResponseBase.java:800)
at
org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:173)
at com.neurogrid.cerego.modules.screens.Test.doBuildTemplate(Test.java:49)
making it seem like there is no way to have Turbine avoid setting a
locale, and thus a Content-Language header. Am I missing anything here?
Thanks in advance.
CHEERS> SAM
Sam Joseph wrote:
>I am trying to work out how to get a response from turbine (or tdk)
>where the Content Language header is *not* set.
>
>My changing the locale settings I find that I can change the Content
>Language header:
>
>locale.default.bundle=MyBundle
>locale.default.language=ja
>locale.default.country=JP
>
>HTTP/1.1 200 OK
>Content-Type: text/html; charset=SJIS
>Date: Tue, 10 Dec 2002 01:54:20 GMT
>Content-Language: ja-JP
>Transfer-Encoding: chunked
>Server: Apache Tomcat/4.0-b6-dev (HTTP/1.1 Connector)
>
>however this has the unfortunate side effect of also adding a
>Content-Type header.
>
>Really what I would like is to be able to ensure that no
>Content-Language or Content-Type headers were set at all.
>
>I am trying to view output from Turbine on a Japanese cell phone and I
>can view responses like this:
>
>HTTP/1.1 200 OK
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:40:45 GMT
>Content-Type: text/html
>Content-Length: 65
>ETag: "65-1038973852966"
>Last-Modified: Wed, 04 Dec 2002 03:50:52 GMT
>
>but when Turbine adds a Content-Language header of any sort
>
>HTTP/1.1 200 OK
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:39:37 GMT
>Connection: close
>Content-Type: text/html
>Content-Language: en-US
>
>or
>
>HTTP/1.1 200 OK
>Content-Type: text/html; charset=SJIS
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:39:37 GMT
>Connection: close
>Content-Type: text/html
>Content-Language: ja-JP
>
>The Japanese characters do not render correctly.
>
>Is there any way to avoid setting a Content-Language header? I find that
>if I remove the locale settings from the Turbine.properties file then
>the system defaults to en-US.
>
>Any help very gratefully received.
>
>CHEERS> SAM
>
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Not setting the Content Language Header
Posted by Sam Joseph <ga...@yha.att.ne.jp>.
Hi,
I have identified this part of the Turbine code as setting the locale
values:
if ( data.isPageSet() && data.isOutSet() == false )
{
// Modules can override these.
data.getResponse()
.setLocale( data.getLocale() );
data.getResponse()
.setContentType( data.getContentType() );
I have tries to override these settings in the modules, in the
doBuildTemplate() method, data.getResponse().setLocale(new
Locale("ja","JP"));, but unfortunately to no avail.
Either way I am not really interested in setting a different locale.
What I really want to do is avoid any locale being set, and
particularly, avoid the Content-Language header being set. If I set the
locale to null I get an exception:
java.lang.NullPointerException
at org.apache.catalina.util.CharsetMapper.getCharset(CharsetMapper.java:164)
at
org.apache.catalina.connector.ResponseBase.setLocale(ResponseBase.java:826)
at
org.apache.catalina.connector.HttpResponseBase.setLocale(HttpResponseBase.java:800)
at
org.apache.catalina.connector.ResponseFacade.setLocale(ResponseFacade.java:173)
at com.neurogrid.cerego.modules.screens.Test.doBuildTemplate(Test.java:49)
making it seem like there is no way to have Turbine avoid setting a
locale, and thus a Content-Language header. Am I missing anything here?
Thanks in advance.
CHEERS> SAM
Sam Joseph wrote:
>I am trying to work out how to get a response from turbine (or tdk)
>where the Content Language header is *not* set.
>
>My changing the locale settings I find that I can change the Content
>Language header:
>
>locale.default.bundle=MyBundle
>locale.default.language=ja
>locale.default.country=JP
>
>HTTP/1.1 200 OK
>Content-Type: text/html; charset=SJIS
>Date: Tue, 10 Dec 2002 01:54:20 GMT
>Content-Language: ja-JP
>Transfer-Encoding: chunked
>Server: Apache Tomcat/4.0-b6-dev (HTTP/1.1 Connector)
>
>however this has the unfortunate side effect of also adding a
>Content-Type header.
>
>Really what I would like is to be able to ensure that no
>Content-Language or Content-Type headers were set at all.
>
>I am trying to view output from Turbine on a Japanese cell phone and I
>can view responses like this:
>
>HTTP/1.1 200 OK
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:40:45 GMT
>Content-Type: text/html
>Content-Length: 65
>ETag: "65-1038973852966"
>Last-Modified: Wed, 04 Dec 2002 03:50:52 GMT
>
>but when Turbine adds a Content-Language header of any sort
>
>HTTP/1.1 200 OK
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:39:37 GMT
>Connection: close
>Content-Type: text/html
>Content-Language: en-US
>
>or
>
>HTTP/1.1 200 OK
>Content-Type: text/html; charset=SJIS
>Server: Microsoft-IIS/5.0
>Date: Tue, 10 Dec 2002 00:39:37 GMT
>Connection: close
>Content-Type: text/html
>Content-Language: ja-JP
>
>The Japanese characters do not render correctly.
>
>Is there any way to avoid setting a Content-Language header? I find that
>if I remove the locale settings from the Turbine.properties file then
>the system defaults to en-US.
>
>Any help very gratefully received.
>
>CHEERS> SAM
>
>
>
>
>--
>To unsubscribe, e-mail: <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>