Skip to content
This repository has been archived by the owner on Jan 25, 2019. It is now read-only.

Public HTML for embedded http broker? #31

Closed
tcaduto opened this issue Apr 22, 2013 · 11 comments
Closed

Public HTML for embedded http broker? #31

tcaduto opened this issue Apr 22, 2013 · 11 comments

Comments

@tcaduto
Copy link

tcaduto commented Apr 22, 2013

Hi,
When using the embedded http broker how can I set a public html directory for Javascript libraries, images etc

@michaelvanham
Copy link
Collaborator

You can see some discussion about ways to handle static files in issue #20.

Currently I am using:

procedure tstatic.get;
var
  f,b:string;
  contenttype:string;
begin
  f := rightstr(GetRequest.URI,pred(length(GetRequest.URI)));
  if FileExistsUTF8(f) then begin
    with TFileStream.Create(f,fmOpenRead) do
      try
        setlength(b,size);
        read(b[1],size);
        self.write(b);
      finally
        free;
      end;
  end
  else
    writeln('not found: ' + f); //todo raise 404 instead
end;

initialization
  tstatic.register('*');  

@leledumbo
Copy link
Collaborator

Use static action broker (has it been commited, @silvio?)

Sent from my Android phone with mail.com Mail. Please excuse my brevity.

tcaduto notifications@github.com wrote:

Hi,
When using the embedded http broker how can I set a public html directory for Javascript libraries, images etc


Reply to this email directly or view it on GitHub.

@silvioprog
Copy link
Owner

Hm... I was waiting for you to send a broker or a new unit implementing this feature (#20 (comment)). :)

Feel free to send it (in working branche). ;)

@leledumbo
Copy link
Collaborator

We're waiting each other then :p #deadlock

I'll commit tonight with an example

Sent from my Android phone with mail.com Mail. Please excuse my brevity.

Silvio Clecio notifications@github.com wrote:

Hm... I was waiting for you to send a broker or a new unit implementing this feature (#20). :)

Feel free to send it (in working branche). ;)


Reply to this email directly or view it on GitHub.

@tcaduto
Copy link
Author

tcaduto commented Apr 23, 2013

I would only need to use that when running in the embedded http server correct?

@tcaduto tcaduto closed this as completed Apr 23, 2013
@leledumbo
Copy link
Collaborator

Yes, but for portability I suggest using it anyway. So you can switch between CGI, FCGI and embedded server easily.

Sent from my Android phone with mail.com Mail. Please excuse my brevity.

tcaduto notifications@github.com wrote:

I would only need to use that when running in the embedded http server correct?


Reply to this email directly or view it on GitHub.

@tcaduto tcaduto reopened this Apr 23, 2013
@tcaduto
Copy link
Author

tcaduto commented Apr 23, 2013

Is the static broker in the git master yet?

@leledumbo
Copy link
Collaborator

Forgive me, I forgot. Please wait a minute.

EDIT: Done in working branch, no example yet (take it from previous issue).

Sent from my Android phone with mail.com Mail. Please excuse my brevity.

tcaduto notifications@github.com wrote:

Is the static broker in the git master yet?


Reply to this email directly or view it on GitHub.

@silvioprog
Copy link
Owner

@leledumbo , Can you send a demo using this feature? If yes, I'll refactore the code and add it in RT package?

@silvioprog
Copy link
Owner

Related to: #20

@silvioprog
Copy link
Owner

Done. Please follow issue #20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants