Client Rewritable Proxied Resource URLs

Summary

This extension provides a means of constructing a URL to a proxied resource, which may rewritten (or partially composed) by client-side scripting. The intent is to allow for commonly used means of URL rewriting. In particular, standard techniques of path manipulation and parameter additions, deletions, and updates should work. However, due to the nature of a resource URL and security concerns there are some limitations placed on what can be rewritten.

The URL is separated into three portions:

  1. The consumer-supplied portion including the consumer's:
    • host
    • port
    • path to the resource proxy
    • any additional state it chooses
  2. The producer's immutable portion, which includes the producer's:
    • host
    • port
    • any part of the path it chooses to make non-rewritable (optional)
    • any additional state it chooses to encode (optional)
  3. The producer's mutable portion, which may optionally include, based on the producer's policy:
    • The rewritable portion of its path
    • file/servlet name
    • query parameters

The client may only rewrite the producer's mutable portion of the URL. In fact the consumer may choose to compress, sign or encrypt or otherwise obfuscate the the consumer's and producer's immutable portions.

Sample Use cases:

Example URLs:

javascript

http://consumer:8000/resource/consumerState/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator/scripts/dojo/dojo.js

The same URL with compression

http://consumer:8000/tinyResource/1234/*wsrp*separator/scripts/dojo/dojo.js

A REST Style URL

http://consumer:8000/resource/consumerState/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator/REST/person/Smith/Joe

An image

http://consumer:8000/resource/consumerState/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator/images/small/flower.png

Base URL which the client may append to

http://consumer:8000/resource/consumerState/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator

* Base URL (above) with a path added by the client

http://consumer:8000/resource/consumerState/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator/REST/cars/chevy/camero

Requirements

QNames

XSD

Location

Required Fields:

The following fields MUST be in the templates and MUST be specified by the producer.

Optional Fields:

All optional fields in the WSRP specification for the standard resource URL may be specified as part of the rewritable URL. These include:

Separator

To allow the client to determine which portion of the URL is rewritable a separator is placed in the URL. The client MUST NOT rewrite any portion of the URL up to and including the separator. The client MAY rewrite any portion after the separator.

BNF

  RewritableProxiedResourceURL = "wsrp-urlType=wsrp-extra:rewritableProxiedResourceUrl" {("&" | "&") (CommonPair | RewritableProxiedResourcePair)}
  RewritableProxiedResourcePair = (RewritableProxiedResourceTextName "=" Text) | (RewritableProxiedResourceBooleanName "=" BooleanValue)
  RewritableProxiedResourceTextName = "wsrp-url-immutable" | "wsrp-url-mutable" | "wsrp-resourceCacheability" | "wsrp-sharedResource"
  RewritableProxiedResourceBooleanName = "wsrp-requiresRewrite"
  CommonPair = CommonTextPair | CommonBooleanPair
  CommonTextPair = CommonTextName "=" Text
  CommonTextName = "wsrp-fragmentID" | "wsrp-extensions"
  CommonBooleanPair = CommonBooleanName "=" BooleanValue
  CommonBooleanName = "wsrp-secureURL"

Note: The CommonPair is defined in the WSRP 2.0 Spec and repeated here for ease of reading.

Consumer URL Reconstruction

The consumer MUST reconstruct the mutable and immutable portions of the URL by concatenating the decoded immutable portion and the mutable portion.

Java Example:

   1     String url = new URLDecoder(immutable) + mutable;

URL on client:

Producer Rewriting

When using Producer rewriting (full or partial) the consumer MUST send additional templates with the names wsrp-extra:rewritableProxiedResourceUrl and wsrp-extra:secureRewritableProxiedResourceUrl.

Example:

Note: The <consumerState> would be replaced with whatever state the consumer wishes to include.

Template:

   1 <getMarkup>
   2   ...
   3   <runtimeContext>
   4     ...
   5     <templates>
   6       <defaultTemplate>...</defaultTemplate>
   7       ...
   8       <extensions>
   9         <wsrp-extra:templates xmlns:wsrp-extra="urn:oasis:names:tc:wsrp:extra" xsi:type="wsrp-extra:QNamedStringArray">
  10           <wsrp-extra:QNamedString qname="wsrp-extra:rewritableProxiedResourceUrl"
  11             value="http://consumer:8000/resource/<consumerState>/r_{wsrp-requiresRewrite}/s_{wsrp-sharedResource}/i_{wsrp-url-immutable}/c_{wsrp-resourceCacheability}/*wsrp*separator{wsrp-url-mutable}"/>
  12           <wsrp-extra:QNamedString qname="wsrp-extra:secureRewritableProxiedResourceUrl"
  13             value="https://consumer:8000/resource/<consumerState>/r_{wsrp-requiresRewrite}/s_{wsrp-sharedResource}/i_{wsrp-url-immutable}/c_{wsrp-resourceCacheability}/*wsrp*separator{wsrp-url-mutable}"/>
  14         </wsrp-extra:templates>
  15       </extensions>
  16     </templates>
  17     ...
  18   </runtimeContext>
  19   ...
  20 </getMarkup>

Markup to the consumer and client:

The following values are used in this example
* requiresRewrite - false
* sharedResource - <none>
* url-immutable - http://producer:9000/webapp
* url-mutable /images/my images?size=small
<img src="http://consumer:8000/resource/<consumerState>/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/c_/*wsrp*separator/images/my%20images?size=small" alt="Proxied Image"/>

Example 2 (Dual Rewriting):

Note: The <consumerState> would be replaced with whatever state the consumer wishes to include.

Template:

   1 <getMarkup>
   2   ...
   3   <runtimeContext>
   4     ...
   5     <templates>
   6       <defaultTemplate>...</defaultTemplate>
   7       ...
   8       <extensions>
   9         <wsrp-extra:templates xmlns:wsrp-extra="urn:oasis:names:tc:wsrp:extra" xsi:type="wsrp-extra:QNamedStringArray">
  10           <wsrp-extra:QNamedString qname="wsrp-extra:rewritableProxiedResourceUrl"
  11             value="wsrp_rewrite?wsrp-requireRewrite={wsrp-requiresRewrite}&wsrp-sharedResource={wsrp-sharedResource}&wsrp-url-immutable={wsrp-url-immutable}&wsrp-url-mutable={wsrp-url-mutable}/wsrp_rewrite"/>
  12           <wsrp-extra:QNamedString qname="wsrp-extra:secureRewritableProxiedResourceUrl"
  13 value="wsrp_rewrite?wsrp-secureURL=true&wsrp-requireRewrite={wsrp-requiresRewrite}&wsrp-sharedResource={wsrp-sharedResource}&wsrp-url-immutable={wsrp-url-immutable}&wsrp-resourceCacheability={wsrp-resourceCacheability}&wsrp-url-mutable={wsrp-url-mutable}/wsrp_rewrite"/>
  14         </wsrp-extra:templates>
  15       </extensions>
  16     </templates>
  17     ...
  18   </runtimeContext>
  19   ...
  20 </getMarkup>

Markup from the producer:

The following values are used in this example
* requiresRewrite - false
* sharedResource - <none>
* url-immutable - http://producer:9000/webapp
* url-mutable /images/my images?size=small
To Consumer
<img src="wsrp_rewrite?wsrp-requireRewrite=false&wsrp-sharedResource=&wsrp-url-immutable=http%3A%2F%2Fproducer%3A9000%2Fwebapp&wsrp-resourceCacheability=&wsrp-url-mutable=/images/my%20images?size=small/wsrp_rewrite" alt="Proxied Image"/>
To client:
<img src="http://consumer:8000/resource/<consumerState>/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/c_/*wsrp*separator/images/my%20images?size=small" alt="Proxied Image"/>

Markup sent to the client:

<img src="http://consumer:8000/resource/<consumerState>/r_false/s_/i_http%3A%2F%2Fproducer%3A9000%2Fwebapp/*wsrp*separator/images/my%20images?size=small" alt="Proxied Image"/>

Consumer Rewriting

The producer MAY include markup with wsrp_rewrite?.../wsrp_rewrite which refer to rewritable proxied resource URLs. The producer MUST set the wsrp-urlType parameter to either names wsrp-extra:rewritableProxiedResourceUrl or wsrp-extra:secureRewritableProxiedResourceUrl. In order to maintain consistency between Consumer rewriting and dual (producer and consumer post) rewriting:

Example 3 (consumer rewriting)

Note: The <consumerState> would be replaced with whatever state the consumer wishes to include.

Markup from the producer:

<img src="wsrp_rewrite?wsrp-urlType=wsrp-extra:rewritableProxiedResourceUrl&wsrp-requiresRewrite=false&wsrp-url-immutable=http%3A%2F%2Fproducer%3A9000%2F/webapp&wsrp-url-mutable=/images/my%20image?size=small/wsrp_rewrite" alt="Proxied Image"/>

Markup sent to client:

<img src="http://consumer:8000/resource/<consumerState>/r_false/id_/i_http%3A%2F%Fproducer%3A9000%2Fwebapp/*wsrp*separator/images/my%20image?size=small" alt="Proxied Image"/>

URL Compression & Security

/!\ Note: This applies to both regular consumer rewriting and dual rewriting, consumer processing.

The consumer may MAY use compression, security or other non-rewritable techniques on the immutable portion of then URL. The mutable portion MUST remain unchanged when sent to the client.

Example

Markup from the producer:

<img src="wsrp_rewrite?wsrp-urlType=wsrp-extra:rewritableProxiedResourceUrl&wsrp-requiresRewrite=false&wsrp-url-immutable=http%3A%2F/producer%3A9000/images/my%20image?size=small/wsrp_rewrite" alt="Proxied Image"/>

Markup sent to the client:

<img src="http://consumer:8000/compressedResource/12345/*wsrp*separator/images/my%20image?size=small" alt="Proxied Image"/>

THIS LINE AND BELOW ARE NOT INCLUDED IN THE FINAL SPEC:

Comments:

Rewritable_Proxied_Resource_URLs (last edited 2009-08-12 18:06:28 by localhost)