RTC Forums
April 29, 2024, 10:15:39 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Web/CSS/JavaScript pages in subfolder  (Read 5081 times)
HalcyonLogic
Newbie
*
Posts: 45


« on: April 27, 2013, 09:17:17 PM »

Please help me understand how to do this.

I have an RTC server which is essentially a webserver. The application can be installed anywhere on the computer, for that reason, the html, CSS, javascript pages are saved in a subfolder where my app will be installed , let's say in C:\MyAppDir\Bin\WebPages (where the Bin folder is where my app will be installed). So the "WebPages" folder will include all the html pages as well as a few more subfolders that will include some CSS and JS files.

Now, in my webserver, I have a dataprovider routine that is used to simply display the index.html page (i.e. www.mysite:8081/DisplayIndex ).

When I used it, the index.html IS displayed, however, all it's included references to any CSS or JS files are broken:
Failed to load resource http://mysite:8081/settings.js
Failed to load resource http://mysite:8081/inc/css/slides.css


I looked at the WebForum example and saw some RepairFileName and GetRoot routine but I must admit, I am not too sure of their purposes.

What do I need to do to fix the broken CSS/JS broken links?
Or in other words, what do I need to do to have all my webpages and included files in a subfolder of my application?

Please pardon my ignorance as I am new to RTC.

Thanks in advance,
Richard

Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: April 27, 2013, 09:21:30 PM »

Look at the File_Server (simpler) or RTC_WebServer (more complex) Demo Projects, which use a fully functional DataProvider (implemented in the Demos\DataProviders\rtcFileProvider.pas unit) for hosting static files from a folder.

Best Regards,
Danijel Tkalcec
Logged
HalcyonLogic
Newbie
*
Posts: 45


« Reply #2 on: April 27, 2013, 11:24:06 PM »

Sorry but I am going to need a more detailed explanation. I did look at the File_Server project, but like I said, I do not understand why one would need all those routines (GetDocRoot, RepairwebFileName, etc.), hence my post/question.

Question
Are you saying that, for some reason, I too need to have a CheckDisk routine?

1. What is CheckDiskFile supposed to archive? Why do we need it?
2. What is RepairFileName supposed to archive? Why do we need it?
3. What is RepairFileName expecting as a parameter, my index.html?
3. What is ParseRange supposed to archive? Why do we need it?

In an attempt to analyse your demo code and implement it on my server, I copied those routines into my server and re-ran the project. Same result.

Totally confused  Embarrassed



Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: April 28, 2013, 12:04:07 AM »

For every URL you are using in your HTML file, the Web Browser will send a new request to the Server, requesting that specific file. You don't need to use all those functions, but you need to Accept each one of those requests on the OnCheckRequest event and send out the content of the appropriate file out, just like you did for the "/DisplayIndex" request. Functions used in that example simply make the code general, so that anything you drop inside the folder will be handled by that DataProvider.

Best Regards,
Danijel Tkalcec
Logged
HalcyonLogic
Newbie
*
Posts: 45


« Reply #4 on: April 28, 2013, 12:10:24 AM »

Somehow, I got it to work. What I wanted to do was to be able to use a routine name in my request like www.mysite.com:8080/DisplayIndex which would have displayed the index.html

Again, I am new to this stuff so (obviously) I was wrong and should have simply called the page I wanted (i.e. www.mysite.com:8080/index.html)

The reason I wanted to use a "specific" routine name was to make sure this specific dataprovider isn't invoked when the other routines are called, but I guess it won't since those will be using a different argument (i.e. the name of the routine).

Please feel free to shed some light on this as I am still a bit confused about the whole thing, it's working, but I'd like to fully understand why.

Thanks
Logged
HalcyonLogic
Newbie
*
Posts: 45


« Reply #5 on: April 28, 2013, 12:11:21 AM »

Looks like you were responding as I was typing :-)

Thanks Danijel.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #6 on: April 28, 2013, 12:15:52 AM »

Does this mean the question was answered, or do you still have a question?
Logged
HalcyonLogic
Newbie
*
Posts: 45


« Reply #7 on: April 28, 2013, 12:20:45 AM »

No, I'm good (all make sense now). You learn something new everyday.

My app is getting nicer and nicer by the day, really glad I came across RTC.

BTW, do you ever sleep?

Thanks for the top notch support. I see great things in RTC's future.

Kind Regards,
Richard
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #8 on: April 28, 2013, 12:29:48 AM »

I'm glad things are clear now.

Sleep? What's that? Wink

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.026 seconds with 16 queries.