You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by mandeep gandhi <we...@gmail.com> on 2015/12/18 08:00:55 UTC
[Sling Main Servlet] Expose sling max calls in request attribute
I have a use case where we have quite complex node structure hierarchy. On
the first request iterate all the nodes of the structure and cache what
ever is required.
So what is happening is that for the first render, the default sling max
calls fails me I start getting too many calls exception[0].
I know this configuration is dangerous to play with but what I want to do
is check the current value of the sling.max.calls. If the value is less
that what I expect, then set it to my estimated value.
I just don't want to blindly set some value in request attribute. Only
when I see that the current system wide value is less that I would need for
this call, then only I want to set a new value in the request attribute.
Now this configuration ( configurations of Sling Main Servlet ) are not
exposed in request but rather kept safe in a internal object RequestData
[1] .
Would it be fine if I submit a patch exposing it like a request attribute ?
Or are there better way to achieve my use case ?
Thanks,
Mandeep Gandhi
[0] -
https://sling.apache.org/apidocs/sling7/org/apache/sling/api/request/TooManyCallsException.html#TooManyCallsException-java.lang.String-
[1] -
https://github.com/apache/sling/blob/trunk/bundles/engine/src/main/java/org/apache/sling/engine/impl/request/RequestData.java
Re: [Sling Main Servlet] Expose sling max calls in request attribute
Posted by mandeep gandhi <we...@gmail.com>.
Thank you so much :)
On Fri, Dec 18, 2015 at 3:46 PM, Robert Munteanu <ro...@apache.org> wrote:
> Hi,
>
> On Fri, 2015-12-18 at 12:30 +0530, mandeep gandhi wrote:
> > I have a use case where we have quite complex node structure
> > hierarchy. On
> > the first request iterate all the nodes of the structure and cache
> > what
> > ever is required.
> >
> > So what is happening is that for the first render, the default
> > sling max
> > calls fails me I start getting too many calls exception[0].
> >
> > I know this configuration is dangerous to play with but what I want
> > to do
> > is check the current value of the sling.max.calls. If the value is
> > less
> > that what I expect, then set it to my estimated value.
> >
> > I just don't want to blindly set some value in request
> > attribute. Only
> > when I see that the current system wide value is less that I would
> > need for
> > this call, then only I want to set a new value in the request
> > attribute.
> >
> > Now this configuration ( configurations of Sling Main Servlet ) are
> > not
> > exposed in request but rather kept safe in a internal object
> > RequestData
> > [1] .
>
> You can always read the data using the OSGi ConfigAdmin - you need to
> get your hands on the config for the SlingMainServlet and read the
> sling.max.calls property.
>
> Robert
>
> >
> > Would it be fine if I submit a patch exposing it like a request
> > attribute ?
> > Or are there better way to achieve my use case ?
> >
> > Thanks,
> >
> > Mandeep Gandhi
> >
> >
> >
> > [0] -
> > https://sling.apache.org/apidocs/sling7/org/apache/sling/api/request/
> > TooManyCallsException.html#TooManyCallsException-java.lang.String-
> >
> > [1] -
> > https://github.com/apache/sling/blob/trunk/bundles/engine/src/main/ja
> > va/org/apache/sling/engine/impl/request/RequestData.java
>
>
Re: [Sling Main Servlet] Expose sling max calls in request attribute
Posted by Robert Munteanu <ro...@apache.org>.
Hi,
On Fri, 2015-12-18 at 12:30 +0530, mandeep gandhi wrote:
> I have a use case where we have quite complex node structure
> hierarchy. On
> the first request iterate all the nodes of the structure and cache
> what
> ever is required.
>
> So what is happening is that for the first render, the default
> sling max
> calls fails me I start getting too many calls exception[0].
>
> I know this configuration is dangerous to play with but what I want
> to do
> is check the current value of the sling.max.calls. If the value is
> less
> that what I expect, then set it to my estimated value.
>
> I just don't want to blindly set some value in request
> attribute. Only
> when I see that the current system wide value is less that I would
> need for
> this call, then only I want to set a new value in the request
> attribute.
>
> Now this configuration ( configurations of Sling Main Servlet ) are
> not
> exposed in request but rather kept safe in a internal object
> RequestData
> [1] .
You can always read the data using the OSGi ConfigAdmin - you need to
get your hands on the config for the SlingMainServlet and read the
sling.max.calls property.
Robert
>
> Would it be fine if I submit a patch exposing it like a request
> attribute ?
> Or are there better way to achieve my use case ?
>
> Thanks,
>
> Mandeep Gandhi
>
>
>
> [0] -
> https://sling.apache.org/apidocs/sling7/org/apache/sling/api/request/
> TooManyCallsException.html#TooManyCallsException-java.lang.String-
>
> [1] -
> https://github.com/apache/sling/blob/trunk/bundles/engine/src/main/ja
> va/org/apache/sling/engine/impl/request/RequestData.java