Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-// UrlRewrite 3.1//EN"


    Configuration file for UrlRewriteFilter


            The rule means that requests to /test/status/ will be redirected to /rewrite-status
            the url will be rewritten.
        <to type="redirect">%{context-path}/rewrite-status</to>

            The outbound-rule specifies that when response.encodeURL is called (if you are using JSTL c:url)
            the url /rewrite-status will be rewritten to /test/status/.

            The above rule and this outbound-rule means that end users should never see the
            url /rewrite-status only /test/status/ both in thier location bar and in hyperlinks
            in your pages.



        in your web.xml add...



     Redirect one url
            <to type="redirect">/very/new/page.html</to>

    Redirect a directory
            <to type="redirect">/very/newdir/$1</to>

    Clean a url
    eg, /products/1234 will be passed on to /products/index.jsp?product_id=1234 without the user noticing.

    Browser detection
            <condition name="user-agent">Mozilla/[1-4]</condition>
    eg, will pass the request for /some/page.html on to /some/page-for-old-browsers.html only for older
    browsers whose user agent srtings match Mozilla/1, Mozilla/2, Mozilla/3 or Mozilla/4.

    Centralised browser detection
            <condition name="user-agent">Mozilla/[1-4]</condition>
            <set type="request" name="browser">moz</set>
    eg, all requests will be checked against the condition and if matched
    request.setAttribute("browser", "moz") will be called.



New to GrepCode? Check out our FAQ X