<div dir="ltr"><div>Basically it was added for backward compatibility with JBoss Web.</div><div><br></div><div>Stuart<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, 10 Jul 2020 at 06:48, Brad Wood &lt;<a href="mailto:bdw429s@gmail.com">bdw429s@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">While I&#39;m asking about rewrites, I should mention I have come across the io.undertow.servlet.compat.rewrite package, however<div><ul><li>It&#39;s not mentioned anywhere in the docs</li><li>The code itself has no comments of any kind explaining it</li><li>There&#39;s no handlerbuilder so it doesn&#39;t appear the RewriteHandler can be used with Undertow&#39;s predicate language</li></ul><div>I am intrigued by it since it appears to be specifically written to fire in the servlet&#39;s handler chain and it appears to be a rather robust implementation, I just can&#39;t find any docs on how to use it!  </div></div><div><br></div><div>What is the backstory with Undertow core rewrite handler and servlet rewrite handler?</div><div><br clear="all"><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div></div><div>Thanks!</div><div><br></div><div>~Brad</div><div><br></div><div><b>Developer Advocate</b></div><div><i>Ortus Solutions, Corp </i></div><div><b><br></b></div><div>E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a></div><div>ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a> </div><div>Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.com</a></div><div><br></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jul 9, 2020 at 11:42 AM Brad Wood &lt;<a href="mailto:bdw429s@gmail.com" target="_blank">bdw429s@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">So, in my bid to put the predicate language through the paces, I&#39;ve been testing out all the rewrite rules I&#39;ve ever used with mod_rewrite or Tuckey Rewrite to see if Undertow&#39;s handlers are up to the task.  <div><br></div><div>I&#39;ve run into an issue again with probably the most common rewrite rule of any CFML app using an MVC framework, which is a rule that creates so-called &quot;SES&quot; URLs and force all requests through a front controller design pattern.  </div><div><br></div><div>Basically</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace"><a href="http://site.com/home/about" target="_blank">site.com/home/about</a></font></blockquote><div><br></div><div>gets rewritten to</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace"><a href="http://site.com/index.cfm/home/about" target="_blank">site.com/index.cfm/home/about</a></font></blockquote><div><br></div><div>Here you can see how this rule is typically accomplished in Apache httpd, Nginx, IIS, and Tuckey:</div><div><br></div><div><a href="https://coldbox.ortusbooks.com/the-basics/routing/requirements/rewrite-rules" target="_blank">https://coldbox.ortusbooks.com/the-basics/routing/requirements/rewrite-rules</a> </div><div> <br></div><div>The hang up is that<i> any incoming path that maps to an actual file</i> skips the rewrite rule.  That way<b> /images/logo.jpg</b> doesn&#39;t get rewritten. </div><div><br></div><div>So here was my first stab at it with Undertow&#39;s predicate language-- it seemed simple enough:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="monospace">not file and not directory -&gt; rewrite(&#39;/index.cfm/%{RELATIVE_PATH}&#39;)</font></blockquote><div><br></div><div>But our old friend the servlet of course is nowhere to be found since my &quot;file&quot; and &quot;directory&quot; predicates were executing in the root handler chain so there is no concept of a servlet&#39;s context root with which to resolve file system paths. </div><div><br></div><div>So basically, I understand exactly why this doesn&#39;t work, but I feel that we need to find a way to make this work.  This is a feature that pretty much every rewrite engine I&#39;ve ever used has-- the ability to test the file system to see if a file or directory exists.  Can we discuss the following options?</div><div><ul><li>Find a way for the root handler chain to access the deployment&#39;s resource manager </li><li>Find a way for the rewrite handler to correctly affect not only the exchange but also (optionally) the HttpServletRequest so it&#39;s possible to rewrite the URL inside of the servlet&#39;s handler chain. I know for certain this is possible because the Tuckey Rewrite engine is implemented as a servlet filter.</li></ul></div><div><div><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div>I would prefer the first option since I do like having the predicates in the root handler chain so it can run as early as possible.</div><div><br></div><div>Thanks!</div><div><br></div><div>~Brad</div><div><br></div><div><b>Developer Advocate</b></div><div><i>Ortus Solutions, Corp </i></div><div><b><br></b></div><div>E-mail: <a href="mailto:brad@coldbox.org" target="_blank">brad@coldbox.org</a></div><div>ColdBox Platform: <a href="http://www.coldbox.org" target="_blank">http://www.coldbox.org</a> </div><div>Blog: <a href="http://www.codersrevolution.com" target="_blank">http://www.codersrevolution.com</a></div><div><br></div></div></div></div></div></div></div></div>
</blockquote></div>
_______________________________________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a></blockquote></div>