On 2013-07-29 11:20, Jukka Zitting wrote:
Hi,

It would be useful to be able to pass in extra parameters in a
Repository.login() call, in order to for example control the
auto-refresh or read-only status of the created session. Unfortunately
the standard JCR API doesn't provide any straightforward way to do
this, so I've come up with a few potential solutions:

1. Use the attribute feature of SimpleCredentials to pass such parameters:

     SimpleCredentials credentials = ...;
     credentials.setAttribute("AutoRefresh", true);
     Session session = repository.login(credentials, ...);

The downside is that it's tied to the specific Credentials class being used.

2. Use the URI query parameter syntax to pass such parameters as a
part of the workspace name:

     String workspace = ...;
     Session session = repository.login(..., workspace + "?AutoRefresh=true");

The downside is the extra complexity of parsing the workspace string
and the need to in many case look up the default workspace name
(unless we define "?..." to refer to the default workspace).
...

Can't workspace names contain a "?" already?

Best regards, Julian

Reply via email to