views:

67

answers:

1

I configured my Spring web app with a servlet to serve images at the URL:

/imgsrv?imgid=12345

I also have Sitemesh installed and now when I call this image servlet, I get a decorator exception related to this servlet, which does not need a decorator applied to it.

According to the Sitemesh docs, you can exclude certain URLs from having a decorator applied to them but the syntax is not clear to me.

Which of the following patterns would seem to be most correct to exclude the URL above from being "decorated":

<decorators defaultdir="/WEB-INF/view/decorators">
    <excludes>
        <pattern>/imgsrv*</pattern>
        <pattern>/imgsrv/*</pattern>
        <pattern>/imgsrv**</pattern>
        <pattern>/imgsrv/**</pattern>
        <pattern>/imgsrv*.*</pattern>
        <pattern>/imgsrv/*.*</pattern>
    </excludes>
    <decorator name="main" page="main.jsp">
        <pattern>/*</pattern>
    </decorator>
</decorators>
+1  A: 

I think that this would be enough:

<decorators defaultdir="/WEB-INF/view/decorators">
    <excludes>
        <pattern>/imgsrv</pattern>
    </excludes>
    <decorator name="main" page="main.jsp">
        <pattern>/*</pattern>
    </decorator>
</decorators>

You are mapping directly to a known servlet path. You don't need wildcard to handle the parameters ( as in ?imgid=12345 ).

Tomas Narros