Hi Roy

Yes, you can set the property like this. But this basically just becomes a 
framework property which is used directly by the Felix Http Service Jetty 
bundle. Having it as a command line option is merely a convenience.

Regards
Felix

> Am 13.12.2016 um 08:57 schrieb Roy Teeuwen <[email protected]>:
> 
> Hey Felix,
> 
> Yeah, my problem has been resolved :)! Just thinking out loud a bit here. 
> 
> Seeing as you can specify the context path with a launchpad command line 
> option when starting the jar (-r path) and you can also specify it in the 
> sling.properties file, I thought it might be a nice addition to the sling 
> settings service to also be exposed in some way after startup. 
> 
> Greetings,
> Roy
> 
>> On 13 Dec 2016, at 08:37, Felix Meschberger <[email protected]> wrote:
>> 
>> Hi Roy
>> 
>> While the approach sounds interesting with some caveats: It has the 
>> whiteboard.listener property twice and it attaches to the default Http 
>> Context which may or may not reflect Sling’s own servlet context (mostly it 
>> does, but there is no guarantee). What you could do is use the 
>> CONTEXT_SELECT property and select the org.apache.sling context.
>> 
>> But then, I don’t think we should expose the Servlet Context Path in the 
>> Sling Settings. IMHO Sling Settings is about the Sling Application as a 
>> whole and not a specific aspect of Sling.
>> 
>> And if the context path is properly exposed to your TransformerFactory, I 
>> think you just have everything you need. As I expect your TransformerFactory 
>> to only be used as part of request processing anyway, right ?
>> 
>> Regards
>> Felix
>> 
>>> Am 12.12.2016 um 22:07 schrieb Roy Teeuwen <[email protected]>:
>>> 
>>> Hey Carsten,
>>> 
>>> Ok cool, thanks for the info! Maybe it would be useful to add the context 
>>> path to the SlingSettingsService? I created an initial patch:
>>> 
>>> https://github.com/apache/sling/compare/trunk...royteeuwen:feature/add-context-path-to-sling-settings-service
>>>  
>>> <https://github.com/apache/sling/compare/trunk...royteeuwen:feature/add-context-path-to-sling-settings-service>
>>> 
>>> What do you think?
>>> 
>>> Greets,
>>> Roy
>>> 
>>>> On 12 Dec 2016, at 16:14, Carsten Ziegeler <[email protected]> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> you either need a servlet request or servlet context, you can get a
>>>> servlet context through the init method of a servlet or by registering a
>>>> servlet context listener (assuming you use latest Sling which is using
>>>> the http whiteboard).
>>>> Other than those, I think there is no good way
>>>> 
>>>> Regards
>>>> Carsten
>>>> 
>>>> Roy Teeuwen wrote
>>>>> Hey all,
>>>>> 
>>>>> It seems I was able to fix it by using the sling request fro 
>>>>> ProcessingContext that is available in the TransformerFactory init method 
>>>>> :). 
>>>>> But it would still be nice to know if it is possible to get the context 
>>>>> path without a sling request!
>>>>> 
>>>>> Greets,
>>>>> Roy
>>>>> 
>>>>> 
>>>>>> On 9 Dec 2016, at 17:14, Roy Teeuwen <[email protected]> wrote:
>>>>>> 
>>>>>> Hey all,
>>>>>> 
>>>>>> I am trying to get the context path of the sling application somewhere 
>>>>>> where I don't have a HttpServletRequest at hand, so I cant call 
>>>>>> request.getContextPath(). 
>>>>>> 
>>>>>> More specifically I have a bug in a TransformerFactory that transforms 
>>>>>> links to versioned clientlibs (acs-aem-commons 
>>>>>> VersionedClientlibsTransformerFactory), but my application has a context 
>>>>>> path, so this doesn't work. 
>>>>>> I want to try and see if I can fix it myself and create a PR instead 
>>>>>> reporting a bug, but I'm a bit lost in how to get the context path. 
>>>>>> Anyone can help?
>>>>>> 
>>>>>> Greets,
>>>>>> Roy
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Carsten Ziegeler
>>>> Adobe Research Switzerland
>>>> [email protected]
>>>> 
>>> 
>> 
> 

Reply via email to