Project

General

Profile

Using external resources (like CSS) with Wt's HTTP server

Added by Andres Jaimes about 12 years ago

Hello,

My apoligies if this quiestion has been asked before, but I could not find it.

I want to know if there is a way to use an external CSS file when using Wt's HTTP server. I have tried several things like placing them in the same folder where my executable resides without any luck.

I'm using WApplication::useStyleSheet to add an external reference to my CSS file and the code is working fine. However when my browser looks for the resource it just gets a 404 error.

I appreciate your help.


Replies (2)

RE: Using external resources (like CSS) with Wt's HTTP server - Added by Wim Dumon about 12 years ago

Hello Andres,

The wthttpd connector serves all files within the so-called docroot directory. When you start your wt application, you have to specify a docroot startup parameter (or put it in wthttp's configuration file). Files within that docroot directory are available for fetching by HTTP requests through wthttpd.

So: put your CSS file inside the directory that is pointed to by the docroot parameter.

Best regards,

Wim.

RE: Using external resources (like CSS) with Wt's HTTP server - Added by Andres Jaimes about 12 years ago

Great!, thanks Wim... I'm putting my parameter list as reference for others:

--http-address=0.0.0.0 --http-port=8080 --deploy-path=/ --docroot=C:\opt\tdem

In this case, all files like CSS's have to be in C:\opt\tdem.

Thanks again

    (1-2/2)