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");
       if (host != null) {
          String[] parts = host.split("\\.");
          if (parts.length == 4) {
               info.put(AuthenticationInfo.WORKSPACE, parts[0]);
          }
       }
   }
}

> - 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.

Thanks,
Justin


>
> -Bertrand

Reply via email to