<div dir="ltr">For a few reasons:<div><ol><li><font size="2">I&#39;d have to insulate the resource handler and directly call it from the authenticated resource (so that someone couldn&#39;t call the modified path and get the resource bypassing security). Though that wouldn&#39;t be terrible, it adds an additional stage in the process where I&#39;d like to handle everything at once.</font></li><li><font size="2">In my specific use-case the security validation will be hitting the database so I&#39;d prefer it not occur on the IO thread anyway.</font></li><li><font size="2">I&#39;m working towards a more simplistic mapping of (path: String) =&gt; Option[Resource] to allow some paths to have different handling based on the context or state of the server and add modularity in so much as they don&#39;t need to know about each other.</font></li><li><font size="2">It didn&#39;t occur to me until after I had almost finished writing it. :)</font></li></ol><div><font size="2">It doesn&#39;t seem Undertow has a convenient capability to just serve up a File easily.  That would be very useful for explicit files with explicit mappings without requiring a ResourceManager.</font></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 30, 2016 at 7:57 PM Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com">sdouglas@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Why can&#39;t you just add a handler before the resource handler to modify<br>
the path and verify the user is authenticated?<br>
<br>
Stuart<br>
<br>
On Wed, Aug 31, 2016 at 10:36 AM, Hicks, Matt &lt;<a href="mailto:matt@matthicks.com" target="_blank">matt@matthicks.com</a>&gt; wrote:<br>
&gt; That&#39;s unfortunate, so I completely translated ResourceHandler into Scala to<br>
&gt; be able to add the functionality I need:<br>
&gt;<br>
&gt; <a href="https://github.com/outr/hyperscala/blob/master/core/jvm/src/main/scala/org/hyperscala/FunctionalResourceManager.scala#L125" rel="noreferrer" target="_blank">https://github.com/outr/hyperscala/blob/master/core/jvm/src/main/scala/org/hyperscala/FunctionalResourceManager.scala#L125</a><br>
&gt;<br>
&gt; It&#39;s not the ideal solution, but it does work.  I still need to do some<br>
&gt; cleanup as well, but a simple mechanism to allow some overrides or some<br>
&gt; separation of this massive block of logic into modular utilities would make<br>
&gt; Undertow far easier to customize.<br>
&gt;<br>
&gt; On Tue, Aug 30, 2016 at 6:03 PM Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; The ResourceManager interface was not expected to be able to handle<br>
&gt;&gt; that, you should probably do that in a handler before the resource<br>
&gt;&gt; manager is invoked.<br>
&gt;&gt;<br>
&gt;&gt; Stuart<br>
&gt;&gt;<br>
&gt;&gt; On Wed, Aug 31, 2016 at 6:11 AM, Hicks, Matt &lt;<a href="mailto:matt@matthicks.com" target="_blank">matt@matthicks.com</a>&gt; wrote:<br>
&gt;&gt; &gt; Thanks Stuart, that did the trick.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;m extending FileResourceManager to convert from the web path to an<br>
&gt;&gt; &gt; internal storage path and also trying to validation against the session<br>
&gt;&gt; &gt; to<br>
&gt;&gt; &gt; verify the logged-in state.  However, I&#39;m running into a roadblock<br>
&gt;&gt; &gt; because<br>
&gt;&gt; &gt; `getResource` doesn&#39;t have access to the exchange to be able to get the<br>
&gt;&gt; &gt; cookie value.  I tried using ThreadLocal, but it&#39;s dispatched to another<br>
&gt;&gt; &gt; thread so that won&#39;t work either.  How am I supposed to access a cookie<br>
&gt;&gt; &gt; or<br>
&gt;&gt; &gt; session from within a ResourceManager.getResource?<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; On Mon, Aug 29, 2016 at 8:05 PM Stuart Douglas &lt;<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>&gt;<br>
&gt;&gt; &gt; wrote:<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; For servlet or Undertow native?<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; For native it is controlled by the<br>
&gt;&gt; &gt;&gt; io.undertow.server.session.SessionCookieConfig implementation that is<br>
&gt;&gt; &gt;&gt; passed to the session manager.<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; For Servlet the standard way to do it is to use a<br>
&gt;&gt; &gt;&gt; ServletContextListener to modify the domain under<br>
&gt;&gt; &gt;&gt; javax.servlet.ServletContext#getSessionCookieConfig<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; Stuart<br>
&gt;&gt; &gt;&gt;<br>
&gt;&gt; &gt;&gt; On Fri, Aug 26, 2016 at 11:31 PM, Hicks, Matt &lt;<a href="mailto:matt@matthicks.com" target="_blank">matt@matthicks.com</a>&gt;<br>
&gt;&gt; &gt;&gt; wrote:<br>
&gt;&gt; &gt;&gt; &gt; I can&#39;t seem to figure out any way to configure the session manager<br>
&gt;&gt; &gt;&gt; &gt; to<br>
&gt;&gt; &gt;&gt; &gt; define the domain of the cookie.  I want the domain to be<br>
&gt;&gt; &gt;&gt; &gt; *.<a href="http://mydomain.com" rel="noreferrer" target="_blank">mydomain.com</a><br>
&gt;&gt; &gt;&gt; &gt; so<br>
&gt;&gt; &gt;&gt; &gt; the cookie is shared across multiple sub-domains.  Can someone give<br>
&gt;&gt; &gt;&gt; &gt; me<br>
&gt;&gt; &gt;&gt; &gt; an<br>
&gt;&gt; &gt;&gt; &gt; example of how to do this?<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; Thanks<br>
&gt;&gt; &gt;&gt; &gt;<br>
&gt;&gt; &gt;&gt; &gt; _______________________________________________<br>
&gt;&gt; &gt;&gt; &gt; undertow-dev mailing list<br>
&gt;&gt; &gt;&gt; &gt; <a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br>
&gt;&gt; &gt;&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/undertow-dev</a><br>
</blockquote></div>