Change language. POST or GET

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Change language. POST or GET

Carlos Tejo Alonso
Change language. POST or GET

Hello,

first of all, apologies if it is not the correct place to ask for this issue.

I want to know how is the correct way to change the language of a website:
- a link that invokes a HTTP GET method
- a button that invokes a HTTP POST method

AFAIK:

- GET should not be used for operations that cause side-effects.
- The GET method means retrieve whatever information

So, how can we consider change the language of a website?

What do you think?

Best regards,

Carlos Tejo

Reply | Threaded
Open this post in threaded view
|

RE: Change language. POST or GET

Mike Dierken
Change language. POST or GET
If there are two variants of the website, one for each language, and the user would simply like to view the website in one of the two languages, then using a link to point to the particular language variant would be fine. The browser would then use a GET request to retrieve that particular page for that language. The links on that language-specific page would continue to point to other language-specific pages.
It is also possible that the website could detect a request header named "Accept-Language" and respond with a page appropriate to the languages specified in that header.
 
If you are trying to send a single request that rewrites every html file stored on the server to be translated to a different language - that's a very different beast.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Carlos Tejo Alonso
Sent: Sunday, December 21, 2008 9:27 AM
To: [hidden email]
Subject: Change language. POST or GET

Hello,

first of all, apologies if it is not the correct place to ask for this issue.

I want to know how is the correct way to change the language of a website:
- a link that invokes a HTTP GET method
- a button that invokes a HTTP POST method

AFAIK:

- GET should not be used for operations that cause side-effects.
- The GET method means retrieve whatever information

So, how can we consider change the language of a website?

What do you think?

Best regards,

Carlos Tejo

Reply | Threaded
Open this post in threaded view
|

RE: Change language. POST or GET

Carlos Tejo Alonso

Maybe I have express myself wrong. I will try again with an example:

I am abroad, using a shared pc with arabic language as default. I send a
request to the URL http://www.example.org/doc. By content negociation, a
server will response with a page written in arabic. In that moment, I
want to change the language of the content, and the return page should
be again http://www.example.org/doc.

What would be the correct approach ?
- a link that invokes a HTTP GET method
- a button that invokes a HTTP POST method

Carlos Tejo Alonso
R&D and Innovation Department - CTIC Foundation [Asturias, Spain]
www.fundacionctic.org

Reply | Threaded
Open this post in threaded view
|

Re: Change language. POST or GET

Upendra Jariya
you should try using a proxy server... may be that could solve your problem.
see www.publicproxyservers.com for reference

Regards,
Upendra Jariya

On Mon, Dec 22, 2008 at 3:16 PM, Carlos Tejo Alonso <[hidden email]> wrote:

Maybe I have express myself wrong. I will try again with an example:

I am abroad, using a shared pc with arabic language as default. I send a
request to the URL http://www.example.org/doc. By content negociation, a
server will response with a page written in arabic. In that moment, I
want to change the language of the content, and the return page should
be again http://www.example.org/doc.

What would be the correct approach ?
- a link that invokes a HTTP GET method
- a button that invokes a HTTP POST method

Carlos Tejo Alonso
R&D and Innovation Department - CTIC Foundation [Asturias, Spain]
www.fundacionctic.org


Reply | Threaded
Open this post in threaded view
|

Re: Change language. POST or GET

Julian Reschke
In reply to this post by Carlos Tejo Alonso

Carlos Tejo Alonso wrote:

> Maybe I have express myself wrong. I will try again with an example:
>
> I am abroad, using a shared pc with arabic language as default. I send a
> request to the URL http://www.example.org/doc. By content negociation, a
> server will response with a page written in arabic. In that moment, I
> want to change the language of the content, and the return page should
> be again http://www.example.org/doc.
>
> What would be the correct approach ?
> - a link that invokes a HTTP GET method
> - a button that invokes a HTTP POST method

It seems to be that you're changing the state of the server, thus GET
would be incorrect.

BR, Julian

Reply | Threaded
Open this post in threaded view
|

RE: Change language. POST or GET

Carlos Tejo Alonso
RE: Change language. POST or GET

>> Maybe I have express myself wrong. I will try again with an example:
>> I am abroad, using a shared pc with arabic language as default. I 
>> send a
>> request to the URL http://www.example.org/doc. By content 
>> negociation, a
>> server will response with a page written in arabic. In that moment, I
>> want to change the language of the content, and the return page 
>> should
>> be again http://www.example.org/doc.
>> What would be the correct approach ?
>> - a link that invokes a HTTP GET method
>> - a button that invokes a HTTP POST method
>
> It seems to be that you're changing the state of the server, thus 
> GET would be incorrect.

I disagree.  The Accept-Language: header is responded to in the reply 
to the GET
request containing it and does not alter state on the server.  The 
server is
ready on the next hit from anyone to provide the same range of 
languages as on
this hit.  With the same server defaults, not defaulting to the last 
request
satisfied.

If you click on the flag of your national language on a site to get that
language version, that is changing the state of your session, yes.

---

That's the problem: the way to interprete it. I am looking for a normative answer from W3C, but I haven't found yet anything in the documentation about it.

Carlos Tejo

Reply | Threaded
Open this post in threaded view
|

Re: Change language. POST or GET

Julian Reschke

Carlos Tejo Alonso wrote:

>  >> Maybe I have express myself wrong. I will try again with an example:
>  >> I am abroad, using a shared pc with arabic language as default. I
>  >> send a
>  >> request to the URL http://www.example.org/doc. By content
>  >> negociation, a
>  >> server will response with a page written in arabic. In that moment, I
>  >> want to change the language of the content, and the return page
>  >> should
>  >> be again http://www.example.org/doc.
>  >> What would be the correct approach ?
>  >> - a link that invokes a HTTP GET method
>  >> - a button that invokes a HTTP POST method
>  >
>  > It seems to be that you're changing the state of the server, thus
>  > GET would be incorrect.
>
> I disagree.  The Accept-Language: header is responded to in the reply
> to the GET
> request containing it and does not alter state on the server.  The
> server is
> ready on the next hit from anyone to provide the same range of
> languages as on
> this hit.  With the same server defaults, not defaulting to the last
> request
> satisfied.

You didn't tell us before that sessions are in use.

But anyway, you're changing state, so GET is the wrong thing to do here.

> If you click on the flag of your national language on a site to get that
> language version, that is changing the state of your session, yes.
>
> ---
>
> That's the problem: the way to interprete it. I am looking for a
> normative answer from W3C, but I haven't found yet anything in the
> documentation about it.

You can't get a "normative" answer from the W3C. First of all, the W3C
isn't in charge (HTTP/1.1 is an IETF specification). So, what's relevant
is what RFC2616 has to say about GET.

BR, Julian



Reply | Threaded
Open this post in threaded view
|

Re: Change language. POST or GET

Reinier Post

On Tue, Dec 23, 2008 at 07:42:22PM +0100, Julian Reschke wrote:

>
> Carlos Tejo Alonso wrote:
>>  >> Maybe I have express myself wrong. I will try again with an example:
>>  >> I am abroad, using a shared pc with arabic language as default. I send a
>>  >> request to the URL http://www.example.org/doc. By content negociation, a
>>  >> server will response with a page written in arabic. In that moment, I
>>  >> want to change the language of the content, and the return page should
>>  >> be again http://www.example.org/doc.
>>  >> What would be the correct approach ?
>>  >> - a link that invokes a HTTP GET method
>>  >> - a button that invokes a HTTP POST method

My preference would be to use both language-neutral URLs, that use
content negotiation to determine the language, and language-specific
URLs, that return a page in the language that corresponds to the URL.

For example,
   http://www.example.org/doc/
and
   http://www.example.org/lang=ar/doc

HTTP redirects from former to latter can be used.
Other properties (e.g. character set, locale) can be treated
in the same way.

>>  > It seems to be that you're changing the state of the server, thus  >
>> GET would be incorrect.
>>
>> I disagree.  The Accept-Language: header is responded to in the reply  
>> to the GET request containing it and does not alter state on the server.
>> The server is ready on the next hit from anyone to provide the same range
>> of languages as on this hit. With the same server defaults, not
>> defaulting to the last request satisfied.

State should be encoded into URLs as much as possible.

> You didn't tell us before that sessions are in use.
>
> But anyway, you're changing state, so GET is the wrong thing to do here.

I don't think so.  You're changing session state only, and as long as
the session state is fully encoded into the URL and/or request headers,
the request itself is stateless (its response is fully determined by the
request) so GET is the appropriate choice.

>> If you click on the flag of your national language on a site to get that
>> language version, that is changing the state of your session, yes.

But that doesn't necessarily make the requests themselves stateful.
Making them stateful without good reason is bad design practice,
according to many.

>> That's the problem: the way to interprete it. I am looking for a  
>> normative answer from W3C, but I haven't found yet anything in the  
>> documentation about it.
>
> You can't get a "normative" answer from the W3C. First of all, the W3C  
> isn't in charge (HTTP/1.1 is an IETF specification). So, what's relevant  
> is what RFC2616 has to say about GET.

This is a design level issue, an issue of how to apply the WWW
standards, not an issue to be decided by those standards themselves.

> BR, Julian

--
Reinier Post