Hi Ian,

Replying to this, though I only completely understood your request after
reading your second post.

So what you really want is, that if a request comes in prefixed with

   /_user/private/

to be redirected to

   /_private/-some-path-/private/

where -some-path- is dynamic and includes the user id of the current
user. Right ?

This sounds similar to an earlier issue, which I recently closed
SLING-251 [1]. I closed this because it is rather old. In addition
resolving some prefix (be it "~" or "/_user/private") depends heavily on
how "user home" locations are managed. And this is outside of the scope
of the ResourceResolver.

I could imaging a plugable solution, though, in that for example we
enhance the mapping functionality of the ResourceResolver2. Currently
there is such functionality to generate internal or external redirects
based on configuration in /etc/map.

We could extend this such, that it would be possible to bind a service
to such a configuration: the configuration value is an OSGi filter
expression to be used with the BundleContext.getServiceReference(String
name, String filter) method.

In addition a service interface would be defined:

   public interface MappingResolver {
       ResultType resolve(HttpServletRequest, String);
       ResultType map(HttpServletRequest, String);
   }

Configuration would be

   /etc/map/http/myhost/~
           -> sling:mapper = "(prefix='~')"

This would use the MappingResolver service registered with a
registration property "prefix" set to "~".

This would allow you to register a MappingResolver service for
/_user/private and have it called to resolve requests to /_user/private
and also to have it called for creating the URL when calling the
ResourceResolver.map method.

WDYT ?

[1] https://issues.apache.org/jira/browse/SLING-251

Ian Boston schrieb:
> Hi,
> 
> Is it possible to internally Proxy an existing Sling Resource from
> another ResourceProvider ?
> 
> eg
> 
> I have a PrivateResourceProvider that matches /_user/private
> 
> From that it builds a path based on the logged in user and the rest of
> the url
> eg
> /_private/A3/D0/33/admin
> 
> eg
> /_user/private/test1.html
> results in
> /_private/A3/D0/33/admin/test1.html
> 
> at that point I would like to internally get hold of the resource for
> /_private/A3/D0/33/admin/test1.html and return with that from the
> PrivateResourceProvider so that it handles everything. But, I get an
> external redirect (302) to _private/A3/D0/33/admin/test1.html
> 
> Ian
> 
> 
> 

Reply via email to