<div dir="ltr">Hi Stuart,<div><br></div><div>I am able to get it working finally! I was trying to write a sample application as Suart suggested and I tried using the latest undertow-core version (1.1.0.Beta7) and it worked magically! :) It was a bug in earlier version (1.0.1.Final) it seems! I confirmed the bug by reverting to older version (1.0.1.Final) and got the same issue (it was not serving the index.html).</div><div><br></div><div>I really wish to thank all who guided me in this - special thanks to Stuart, Tomaz and Bill!</div><div><br></div><div>Note: Anybody who wish to use a sample application to test the file serve from classpath can use <a href="https://github.com/vworld4u/undertow-fileserve-sample">https://github.com/vworld4u/undertow-fileserve-sample</a></div><div><br></div><div><br></div><div><b>Thanks and Regards,</b></div><div>Venkatesha T R</div><div><span style="font-family:arial,sans-serif;font-size:13px"> </span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 8, 2014 at 3:20 AM, Stuart Douglas <span dir="ltr"><<a href="mailto:sdouglas@redhat.com" target="_blank">sdouglas@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">io.undertow.examples.chat.<u></u>ChatServer does something similar to what you are talking about, and it definitely works in jar form.<br>
<br>
Do you have some kind of reproducer that I can debug?<br>
<br>
Stuart<br>
<br>
Venkatesha T R wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Tomaz,<br>
<br><span class="">
I have the following structure in my maven project<br>
<br>
Classes are in src/main/java folder in the package com.xxx.yyy.zzz and<br>
the html is there inside the src/main/resources folder inside the folder<br>
com/xxx/yyy/zzz folder itself. I have checked the jar file also in which<br>
the html is packaged into correct classpath too.<br>
<br>
I am using the following code to set the Resource path :<br>
<br>
ClassPathResourceManager resourceManager = new<br>
ClassPathResourceManager(<u></u>MyUndertowServer.class.<u></u>getClassLoader(), MyUndertowServer.class.<u></u>getPackage());<br>
// MyUndertowServer is in same com.xxx.yyy.zzz path<br>
<br>
then I am creating<br>
<br>
ResourceHandler resourceHandler =<br>
Handlers.resource(<u></u>resourceManager).<u></u>addWelcomeFiles("index.html").<u></u>setDirectoryListingEnabled(<u></u>true);<br>
<br>
<br>
& then finally adding<br>
deploymentInfo.<u></u>setResourceManager(<u></u>resourceManager);<br>
<br>
<br>
Can you please figure out whether I am doing something wrong above?<br>
Please paste a sample working code for this part so that I can check it out.<br>
<br>
Thanks a lot for your patience and time<br>
<br>
<br>
On Fri, Sep 5, 2014 at 3:54 PM, Tomaž Cerar <<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a>><u></u>> wrote:<br>
<br>
So show as the code that you use to setup ClassPAthResourceManager<br>
also some locations of classes / resources would be welcome.<br>
<br>
<br>
On Fri, Sep 5, 2014 at 11:52 AM, Venkatesha T R <<a href="mailto:vworld4u@gmail.com" target="_blank">vworld4u@gmail.com</a><br></span><span class="">
<mailto:<a href="mailto:vworld4u@gmail.com" target="_blank">vworld4u@gmail.com</a>>> wrote:<br>
<br>
Hi Tomaz,<br>
<br>
I have seen and confirmed that resources are present in right<br>
packages inside the packaged jar. But I am not able to get the<br>
resource served! :(<br>
<br>
Thanks,<br>
Venkatesha T R<br>
<br>
<br>
On Fri, Sep 5, 2014 at 3:20 PM, Tomaž Cerar<br></span><span class="">
<<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a> <mailto:<a href="mailto:tomaz.cerar@gmail.com" target="_blank">tomaz.cerar@gmail.com</a>><u></u>> wrote:<br>
<br>
Maybe problem is that you are not properly packaging<br>
resources in your jar.<br>
For maven project that should be in main/java/resources<br>
(standard jar module type)<br>
otherwise you can easily add any custom path as resource<br>
that will be packed into your war.<br>
<br>
In short, open the resulting jar and see if resources are there.<br>
<br>
<br>
On Fri, Sep 5, 2014 at 6:56 AM, Bill O'Neil<br></span><span class="">
<<a href="mailto:bill@dartalley.com" target="_blank">bill@dartalley.com</a> <mailto:<a href="mailto:bill@dartalley.com" target="_blank">bill@dartalley.com</a>>> wrote:<br>
<br>
Could you provide a little more info.<br>
<br>
1. Are the html pages in a non standard location that<br>
may not be added to the class path in the jar?<br>
2. Are you setting a resource base path?<br>
<br>
I just tested serving files from an executable jar and<br>
it works as expected for me.<br>
<br>
<br>
On Fri, Sep 5, 2014 at 12:30 AM, Venkatesha T R<br></span><span class="">
<<a href="mailto:vworld4u@gmail.com" target="_blank">vworld4u@gmail.com</a> <mailto:<a href="mailto:vworld4u@gmail.com" target="_blank">vworld4u@gmail.com</a>>> wrote:<br>
<br>
Hi,<br>
<br>
I am seeing this behavior in undertow - I have<br>
written a simple web application using undertow<br>
which processes 3 requests and provides a single<br>
(may be two in future) page (s) to see. These pages<br>
are just html pages and 3 requests are GET/POST<br>
requests. I am using ClassPathResourceManager class<br>
to serve the index.html file which is present inside<br>
classpath in one of my package (I am using a maven<br>
project). It works fine when I run this application<br>
in the Eclipse environment (where there is no jar<br>
used for running). But when I package this<br>
application as a jar file and run it in standalone<br>
mode, ClassPathResourceManager fails to pick the<br>
resource and serve it.<br>
<br>
ClassPathResourceManager reports Resource instance,<br>
but I see a blank page (404) error when I see it in<br>
browser. If somebody has any clue about what is<br>
going on, or knows about this possible bug, please<br>
let me know. It will help me a lot.<br>
<br>
Thanks in advance..<br>
<br>
--<br>
<br></span>
*Thanks and Regards*<br>
*-----------------------------<u></u>------------------------------<u></u>------------------------------<u></u>---------------------------*<br>
*Venkatesh T R*<br>
*9945040858*<span class=""><br>
A Man with Many Dimensions...<br>
<br>
<br>
______________________________<u></u>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br></span>
<mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>><span class=""><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a><br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
undertow-dev mailing list<br>
<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.jboss.org</a><br></span>
<mailto:<a href="mailto:undertow-dev@lists.jboss.org" target="_blank">undertow-dev@lists.<u></u>jboss.org</a>><br>
<a href="https://lists.jboss.org/mailman/listinfo/undertow-dev" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a><br>
<br>
<br>
<br>
<br>
<br>
--<br>
<br>
*Thanks and Regards*<br>
*-----------------------------<u></u>------------------------------<u></u>------------------------------<u></u>---------------------------*<br>
*Venkatesh T R*<br>
*9945040858*<span class=""><br>
A Man with Many Dimensions...<br>
<br>
<br>
<br>
<br>
<br>
--<br>
<br></span>
*Thanks and Regards*<br>
*-----------------------------<u></u>------------------------------<u></u>------------------------------<u></u>---------------------------*<br>
*Venkatesh T R*<br>
*9945040858*<span class=""><br>
A Man with Many Dimensions...<br>
<br>
______________________________<u></u>_________________<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" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/undertow-dev</a><br>
</span></blockquote>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><br></div><div><b><font size="4" color="#336666">Thanks and Regards</font></b></div><font color="#000099"><b>--------------------------------------------------------------------------------------------------------------------</b></font><div><b><font color="#333399">Venkatesh T R</font></b></div><div><b>9945040858</b></div><div><font color="#330099" face="'comic sans ms', sans-serif">A Man with Many Dimensions...</font></div><div><br></div>
</div>