Hi,

On 17.03.2010 14:40, Justin Edelson wrote:
> On 3/17/10 9:20 AM, Bertrand Delacretaz wrote:
>> On Wed, Mar 17, 2010 at 2:08 PM, Justin Edelson
> <justinedel...@gmail.com> wrote:
>>> ... For example, if you think about how Google App Engine allows you to
>>> reference arbitrary versions of your application with a host name like
>>> version.appname.appspot.com (IIRC), one could imagine using the host
>>> header to select the workspace which corresponds to the requested
>>> version (and according to David's Model, this is a totally valid use of
>>> workspaces)....
>>
>> I like the idea of using an HTTP header to select workspaces
> 
> This is a naive implementation, but you can do this...
> 
> @Component
> @Service
> public class WorkspacePicker implements AuthenticationInfoPostProcessor {
>    public void postProcess(AuthenticationInfo info, HttpServletRequest
> request, HttpServletResponse response) {
>        String host = request.getHeader("Host");

(NB this is what request.getServerName() reports; I would prefer to use
the API)


>        if (host != null) {
>           String[] parts = host.split("\\.");
>           if (parts.length == 4) {
>                info.put(AuthenticationInfo.WORKSPACE, parts[0]);
>           }
>        }
>    }
> }

I wonder, whether and how this could be coordinated with the virtual
host configuration stuff we do in the ResourceResolver /etc/map
configuration. Maybe the ResourceResolverFactory knowing about the
mapping could implement the interface and use the /etc/map configuration
for this decision ?

> 
>> - and the
>> name of the "default scripts" workspace to use might be stored as a
>> property at the root node of the "private" workspace, or defined by
>> configuration of the script resource resolver.
> 
> I'll probably just implement a configuration property for now; even if
> we supported a root node property, we'll need a default.

I prefer the configuration property anyway because a repository property
is not congruent with how we do most of the configuration today (and
additionally opens the door for very wierd stuff like wsp selected by
client points to wspd1 for default resolution which in turn would point
to wspd2 for default resolution and so forth)

Regards
Felix

Reply via email to