Discussion:
[Wt-interest] Can't get docroot to work within deploy-path
K. Frank
2016-06-13 17:22:33 UTC
Permalink
Hello List!

I am trying to serve some static html files from urls "parallel" to
internal-path urls. This is really just a cosmetic issue, but I
would like to understand how to make it work they way I want,
or understand why it isn't possible.

Here's an example that illustrates what I mean by "parallel" urls:

I have a wthttpd application, mixed_links.exe (this is on windows).
Let {app-path} be the directory that contains the executable
mixed_links.exe, and the directory from which I launch it. (So
{app-path} becomes the current working directory of the running
application.)

I've tried a number of things, but I currently launch the
application as follows:

mixed_links --http-address=0.0.0.0 --http-port=80
--deploy-path=/mixed_links --docroot=".;/static_links"

I have a subdirectory

{app-path}/static_links

that contains some static html files, sl1.html, sl2.html, etc.

My dynamic wt web page has some internal-path links:

t = new WText ("link to <a href='#/internal_paths/ip1'>ip1</a>");
t->setInternalPathEncoding (true);
root()->addWidget (t);
root()->addWidget (new WBreak);

It also has some static-content links:

t = new WText ("link to <a
href='/mixed_links/static_links/sl1.html'>sl1</a>");
root()->addWidget (t);
root()->addWidget (new WBreak);
t = new WText ("link to <a href='/static_links/sl2.html'>sl2</a>");
root()->addWidget (t);
root()->addWidget (new WBreak);

The link to sl1.html is what I want to do, but it doesn't work.
The link to sl2.html works, but isn't what I want.

To be clear what I mean by parallel urls, here are the urls the
user sees:

http://localhost/mixed_links/ -- home page
http://localhost/mixed_links/internal_paths/ip1 -- internal path, works
http://localhost/mixed_links/static_links/sl1.html -- static
link, doesn't work
http://localhost/static_links/sl2.html -- static link, works

The link to sl1.html is of the form I want. It is parallel to the ip1 link
in that they both start with:

http://localhost/mixed_links/

but it doesn't work. (It gets processed as an internal link, causing
the internalPathChanged signal to fire.)

The link to sl2.html works, but isn't parallel to ip1 link, in the sense
described above.

The documentation for the docroot argument:

--docroot arg document root for static files, optionally followed by a
comma-separated list of paths with static files (even if they are within
a deployment path), after a ';'

e.g. --docroot=".;/favicon.ico,/resources,/style"

makes me think that this should work.

I assume that I'm doing something wrong, probably with docroot.
(Maybe the documentation example shows linux command-line
quoting, and I need something different because I'm on windows,
launching from the built-in cmd.exe.) Or maybe my wt code for
the links is wrong somehow.

Could someone explain how to get parallel links like this to work?

Again, this is purely cosmetic. If it's not possible to do what I want,
that's fine too. But if that's the case, could someone confirm that
it's not possible (because my reading of the documentation makes
me think that it should be).


Thanks for any advice and explanations.


K. Frank

Loading...