Discussion:
[Wt-interest] Can one us wthttpd to mix internal paths and external links in the same "folder"?
K. Frank
2015-07-23 19:03:56 UTC
Permalink
Hi List!

(Resending due to a sourceforge bounce ...)

On Fri, Jul 17, 2015 at 4:01 PM, K. Frank <***@gmail.com> wrote:

Hello List!

First off, I am not asking for Wt to do something that it is not
designed to do. I'm trying to learn what Wt does do (and how
to do it).

So the answer to my question might well be no.

Is it possible to support both link1, an app-rendered internal
path, and page1.html, a plain, external html page, in the same
"folder"? That is

http://localhost/links/link
http://localhost/links/page1.html

(where "--deploy-path=/links")?

I have a simple Wt test app (links.cpp) (that links to libwthttp
so that it runs as a stand-alone web server) that implements
(I think correctly) various internal paths.

I deploy it to the "folder" links (i.e., "--deploy-path=/links").

The app implements a number of internal paths: link1, link2,
etc., so they show up as urls:

http://localhost/links/link1
http://localhost/links/link2

So far, so good.

The application itself (links.exe) resides in a directory:

...\wt_test

I use this directory (the current working directory) as the
docroot (i.e., "--docroot=.").

If I create a folder:

...\wt_test\links

and put a regular html file in it:

...\wt_test\links\page1.html

I cannot browse to it through my Wt app via the url:

http://localhost/links/page1.html

(If I try to, wthttpd starts a new session (?), calls my
WApplication constructor with internalPath() = "/page1.html",
and my onInternalPath internal-path handler function rejects
it as an unknown internal path.)

I CAN browse to (assuming they exist):

http://localhost/page1.html
http://localhost/links2/page1.html

and if I use "--deploy-path=/" (rather than "--deploy-path=/links"),
I CAN browse to:

http://localhost/links/page1.html

So it seems like I cannot mix internal and external links in the
same "folder," in this case "links". Is this the case?

I am not suggesting that Wt should support this. It's just that
I haven't found the documentation to be very clear about what
happens when you mix internal and external links, and I'm trying
to understand what is going on.


Thanks for any explanations.


K. Frank

------------------------------------------------------------------------------
Koen Deforche
2015-07-23 21:41:51 UTC
Permalink
Hey,
Post by K. Frank
Is it possible to support both link1, an app-rendered internal
path, and page1.html, a plain, external html page, in the same
"folder"? That is
http://localhost/links/link
http://localhost/links/page1.html
(where "--deploy-path=/links")?
Yes. But you have to explain to the wthttpd which 'paths' to consider
as static files to be fetched from the docroot. There's a special
syntax to do this when specifying the docroot, e.g.:

--docroot="docroot;/resources,/links/page1.html,/links/page2.html"

This configures the wthttpd to consider only the paths
/resources,/links/page1.html,/links/page2.html to be served as static
files, fetched
from the 'docroot' folder in the current working directory (thus
docroot/links/page1.html for example).

If you do not specify this additional information, then Wt will assume
that everything under the deployment path is dynamic, and everything
else is static.

Regards,
koen

------------------------------------------------------------------------------
K. Frank
2015-07-24 16:06:00 UTC
Permalink
Hi Koen!
Post by Koen Deforche
Hey,
Post by K. Frank
Is it possible to support both link1, an app-rendered internal
path, and page1.html, a plain, external html page, in the same
"folder"? That is
http://localhost/links/link
http://localhost/links/page1.html
(where "--deploy-path=/links")?
Yes. But you have to explain to the wthttpd which 'paths' to consider
as static files to be fetched from the docroot. There's a special
--docroot="docroot;/resources,/links/page1.html,/links/page2.html"
Thanks. This does accomplish my goal of putting both internal
and static links in the same "folder."
Post by Koen Deforche
This configures the wthttpd to consider only the paths
/resources,/links/page1.html,/links/page2.html to be served as static
files, fetched
from the 'docroot' folder in the current working directory (thus
docroot/links/page1.html for example).
If you do not specify this additional information, then Wt will assume
that everything under the deployment path is dynamic, and everything
else is static.
As a side note, I did find this bit of documentation:

http://www.webtoolkit.eu:3080/wt/doc/reference/html/overview.html#wthttpd

specifically, this example:

$ ../../build/examples/wt-homepage/Home.wt
--docroot=".;/favicon.ico,/css,/resources,/style,/icons" ...

which looks like is saying the same thing you just said.

I had tried it and couldn't get it to work, I'm sure, in hindsight, because of
some simple error like getting a path wrong. (Anyway, things work now.)
Post by Koen Deforche
Regards,
koen
Thanks again for your help getting started with Wt.


K. Frank

------------------------------------------------------------------------------
Loading...