code: public static void rewriteURL( ServletContext servletContext, ServletRequest request,
                                     ServletResponse response, MutableURI url, URLType type,
                                     boolean needsToBeSecure )
      {
          ArrayList/*< URLRewriter >*/ rewriters = getRewriters( request );
  
          if ( rewriters != null )
          {
              for ( Iterator i = rewriters.iterator(); i.hasNext(); )  
              {
                  URLRewriter rewriter = ( URLRewriter ) i.next();
                  rewriter.rewriteURL( servletContext, request, response, url, type, needsToBeSecure );
              }
          }
  
          if ( url instanceof FreezableMutableURI )
          {
              ( ( FreezableMutableURI ) url ).setFrozen( true );
          }
      }
docs: Rewrite the given URL, looping through the list of registered URLRewriters.
  
  <p> Once the MutableURI has been rewritten, and if it is an instance of
  {@link FreezableMutableURI}, then this method will set the URI to a frozen
  state. I.e. immutable. If a user then tries to use a setter method on the
  rewritten URI, the FreezableMutableURI will throw an IllegalStateException. </p>
  
  <p> Note that after the rewritting the caller should run the rewritten URI
  through the templated URI formatting process as the last step in rewriting.
  See {@link #getTemplatedURL} </p>
  
  @param servletContext the current ServletContext.
  @param request        the current ServletRequest.
  @param response       the current ServletResponse.
  @param url            the URL to be rewritten.
  @param type           the type of URL to be rewritten.  This is one of the following values:
  <ul>
  <li><code>action</code>: a standard (non-resource) URL
  <li><code>resource</code>: a resource (e.g., image) URL
  </ul>
  @param needsToBeSecure a flag indicating whether the URL should be secure (SSL required) or not
  @see #registerURLRewriter