Grzegorz Kossakowski-3 wrote:
> 
> xweber pisze:
> [..]
>> is there a possibility to check for existence of a file in filestructure
> [..]
> Yes, you can use ResourceExistsSelector:
> http://cocoon.apache.org/2.1/userdocs/resourceexists-selector.html (it
> will work in C2.2)
> [..]
> 

I did some tests with different kind and combinations of selector
"resource-exists".It seems I got a bug  when using servlet:xxxx to get the
file from a different block.

What is working
==========
(sitemap from myBlock1 - the myBlock2 is a bean id):
      <map:match pattern="filename.txt">
        <map:select type="resource-exists">
          <map:when test="resource/external/filename.txt">
            <map:read src="resource/external/filename.txt"/>
          </map:when>
          <map:otherwise>
            <map:read
src="servlet:myBlock2:/resource/external/filename.txt"/>
          </map:otherwise>
        </map:select>
      </map:match>

and I can get the correct filename.txt. 

What is *NOT* working 
===============
(sitemap from myBlock1-the filename.txt exist at
resource/external/filename.txt - the myBlock2 is a bean id - myBlock3 id
does not exist or the file does not exists in myBlock3):
      <map:match pattern="filename.txt">
        <map:select type="resource-exists">
          <map:when test="servlet:myBlock3:resource/external/filename.txt">
            <map:read
src="servlet:myBlock3:resource/external/filename.txt"/>
          </map:when>
          <map:otherwise>
            <map:read
src="servlet:myBlock2:/resource/external/filename.txt"/>
          </map:otherwise>
        </map:select>
      </map:match>

Since myBlock3 does not exist, i am expecting that "test=" returns false and
map:otherwise is used. But unfortunately it _always_ returns true. It is
acting as if the "servlet:myBlock3:" part is completely ignored.

Maybe it is a syntax problem (found no documentation how it should look like
in 2.2), but i thought because of the working of the syntax inside map:read
it must be ok.

Alex
-- 
View this message in context: 
http://www.nabble.com/-cocoon-2.2.x--site-can-check-for-file-exists--tf4040666.html#a11709990
Sent from the Cocoon - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to