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