Hi Janandith,

janandith jayawardena schrieb:
Hi Felix,


I do not exactly understand what you are trying to achieve. Do you have
three scripts -- html.jsp, selector.jsp and replace.jsp ? And you > request
http://host/something.html and have the html.jsp being called.

Now what is next ?


Thats what I want to do :).

Basically I want a way to write a test for SLING-475 which can test the
functionality of flush , replaceSelectors and replaceSuffix in
<sling:include /> tag. I'm still confused in  finding a way to use these
options in sling:include tag.

Well, I would assume, that testing the flush would not be that easy ...

Testing the replaceSelectors would mean being able to tell that the correct script has been included and for replaceSuffix you would check whether in the included script the new suffix is visible.

So in html.jsp you would do:

   <sling:include replaceSelectors="selector">

in selector.jsp you could do something like

   Hello this is selector.jsp

In the response check you would then see whether selector.jsp is contained in the response. If replaceSelectors would not work, the response would not contain the checker string.

Similar tests could be done for the replaceSuffix.

Actually, you probably only need two scripts - html.jsp and selector.jsp.

Hope this helps.

Regards
Felix

Janandith.



On Mon, Aug 4, 2008 at 3:05 PM, Felix Meschberger <[EMAIL PROTECTED]>wrote:

Hi,

janandith jayawardena schrieb:

Hi,

Thanks Bertrand.

When I use ,

<sling:include addSelectors="selector"  replaceSelectors="replace" />

I get the content of replace.jsp

Point is, that the addSelectors and replaceSelectors are also in fact
mutually exclusive in the sense that addSelectors is ignored if
replaceSelectors is set.

Hence the inclusion of replace.jsp is expected.


and

when I use ,

<sling:include addSelectors="selector"/>
<sling:include addSelectors="selector"  replaceSelectors="replace" />

I get both selector.jsp and replace.jsp content.

Similar here: The first include includes the selector.jsp, while the second
includes replace.jsp for the reasons explained above.


I tried this,

<sling:include addSelectors="selector"/>
<sling:include flush=true />
<sling:include addSelectors="selector"  replaceSelectors="replace" />

hoping flush will erase initial selector.jsp content but there is no
content
and the program fails.

This is a dangerouse one because of the second line with the "flush"
attribute: The flush attribute says to write the current contents of the
output buffer out to the response (and not erase the buffer as you might
expect). In addition this tag will recursively include the same script
again, which should result in an exception being thrown.


I want to test with all these tags in one html.jsp file. how can I use the
replaceSelector to replace selector.jsp with replace.jsp.

I do not exactly understand what you are trying to achieve. Do you have
three scripts -- html.jsp, selector.jsp and replace.jsp ? And you request
http://host/something.html and have the html.jsp being called.

Now what is next ?



Also why does the whole script fail when using flush. What is the correct
way to use it.

Due to a recursive inclusion of itself and the exception bein thrown. This
has nothing to do with the flush attribute but with the include itself,
which just includes the current resource with the same selectors and
extension and therefore resolves to the same script over and over again
until too many scripts are included and an exception is thrown.

Regards
Felix


Reply via email to