[undertow-dev] serving static files
Matthias Wessendorf
matzew at redhat.com
Mon Feb 3 01:39:11 EST 2014
HEllo,
that works fine - however trying the same in my 'test': does not work :-/
UndertowJaxrsServer ut = new UndertowJaxrsServer();
TestApplication ta = new TestApplication();
ut.deploy(ta);
ut.start(
Undertow.builder()
.addHttpListener(8080, "localhost")
.setHandler(resource(new FileResourceManager(new File(System.getProperty("user.home")), 100))
.setDirectoryListingEnabled(true))
);
try {
Thread.currentThread().join();
}
catch (InterruptedException e) {
logger.info("shutting down");
ut.stop();
}
-Matthias
----- Original Message -----
> From: "Stuart Douglas" <sdouglas at redhat.com>
> To: "Matthias Wessendorf" <matzew at redhat.com>
> Cc: undertow-dev at lists.jboss.org
> Sent: Sunday, February 2, 2014 6:37:59 PM
> Subject: Re: [undertow-dev] serving static files
>
> I just added a file serving example to the Undertow examples, can you try
> that out and let me know if it works for you?
>
> Just get the latest Undertow, build the examples, then run:
>
> mvn exec:exec
>
> And select the file serving one, it should serve up you home directory.
>
> Stuart
>
> ----- Original Message -----
> > From: "Matthias Wessendorf" <matzew at redhat.com>
> > To: undertow-dev at lists.jboss.org
> > Sent: Sunday, 2 February, 2014 1:58:14 PM
> > Subject: [undertow-dev] serving static files
> >
> > Hello,
> >
> > I might be just doing it wrong, but the following attempts are not
> > successful
> > for serving static files from a folder:
> >
> >
> > UndertowJaxrsServer ut = new UndertowJaxrsServer();
> >
> > MyRestApplication app = new MyRestApplication();
> >
> > ut.deploy(app);
> >
> > ut.start(
> > Undertow.builder()
> > .addHttpListener(8080, "0.0.0.0")
> >
> >
> > // first tried this:
> > .setHandler(path()
> > .addPrefixPath("/",resource(new
> > FileResourceManager(new
> > File("/some/folder/containing/html/files"),
> > 1024))))
> >
> >
> > // afterwards also tried this:
> > .setHandler(resource(new FileResourceManager(new
> > File("/some/folder/containing/html/files"), 1024)))
> > );
> >
> > try {
> > Thread.currentThread().join();
> > }
> > catch (InterruptedException e) {
> > logger.info("shutting down");
> > ut.stop();
> > }
> >
> >
> >
> >
> > Not sure, but none of the above handlers seems to server files from a
> > folder
> > on my box
> >
> >
> > Greetings,
> > Matthias
> >
> >
> >
> >
> >
> > --
> > Matthias Wessendorf
> > matzew at redhat.com
> >
> > JBoss, by Red Hat
> > _______________________________________________
> > undertow-dev mailing list
> > undertow-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/undertow-dev
> >
>
--
Matthias Wessendorf
matzew at redhat.com
JBoss, by Red Hat
More information about the undertow-dev
mailing list