Re: [wsrp-interop] wsrp-extension value encoding clarification

From
Nathan Lipke <>
Date
2009-12-09T04:16:20+00:00
ID
Thread
Re: [wsrp-interop] wsrp-extension value encoding clarification
So both + (%2b) and %20 (%2520) mean space. It just depends on what you implementation prefers. 

Its all part of the fun of http.

Nate

On Dec 8, 2009, at 8:50 PM, Nader Oteifa wrote:

I got this value instead:

 

param1%3dvalue1%26param1%3dvalue2%26param%253d2%3dthis%2b%2526%2bthat

 

I used this code in .NET:

 

string x = HttpUtility.UrlEncode("param1") + "=" + HttpUtility.UrlEncode("value1");

x += "&" + HttpUtility.UrlEncode("param1") + "=" + HttpUtility.UrlEncode("value2");

x += "&" + HttpUtility.UrlEncode("param=2") + "=" + HttpUtility.UrlEncode("this & that");

Console.WriteLine(HttpUtility.UrlEncode(x));

 

Nader

 

From: Nathan Lipke [mailto:] 
Sent: Tuesday, December 08, 2009 4:45 PM
To: 
Cc: Andrew Wright
Subject: [wsrp-interop] wsrp-extension value encoding clarification

 

I was reading the wsrp-extensions part of the spec: 9.2.1.9 and I am assuming parameter names and values should be encoded.

 

Here's the relevant section:

9.2.1.9 wsrp-extensions

Extensions to the data supplied on the URL which this protocol defines MUST use the following sequence to encode the additional information into the wsrp-extensions portlet URL parameter:

A querystring-like [20] value is built from the parameter identifiers and values to be set. Parameters that are an array of strings can be specified by repeating the parameter. For example, if a Portlet has two additional parameters, one is an array of strings (parameter name is "param1") and and the other a simple string (parameter name is "param2"), results in;

"param1=value1&param1=value2&param2=value3

The string built in step #1 is url-encoded so that it can appear as a querystring value or part of the path portion of the URL. The example becomes;

param1%3Dvalue1%26param1%3Dvalue2%26param2%3Dvalue3

The url-encoded string is then used as the value of the wsrp-extensions portlet url parameter or to replace it within a template.

 

So for example if param1=value1 were more complex:

Replace "param2" with "param=2"

Replace "value3" with "this & that"

I would expect the resulting string to be:

param1%3Dvalue1%26param1%3Dvalue2%26param%253D2%26%3Dthis%2520%2526%2520that

 

Is this correct?

 

Thanks,

 

Nate