On 5/13/2011 4:01 AM, Nick Sabalausky wrote:
"Matthew Ong"<on...@yahoo.com>  wrote in message
news:iqgo17$2nqv$1...@digitalmars.com...
Hi Adam,

Thanks again for the sharp pointed answer.
What is the counterpart in D for replacing JSP/ASP/JRuby on Rail or
some sort of dynamic web base development?

I use D for web work by using the standard CGI interface and>sometimes
an embedded http server. It's the best thing I've ever used.
Could you share how or show an URL that provide sample code to do that in
D?


How to also code digitally sign the DLL  that was compiled in D?
The same way you sign any other dll/exe.
So we use external tool to do that and not a build in one??
In java, we use jarsigner with some keygen.

Please bear in mind I am new to D.


Here's a basic "Hello world" CGI app in D:

// hellocgi.d
import std.conv;
import std.stdio;

void main()
Hmm...Might be problem for it to be main... Security concerned because of the publicity done my M$ and others also. When they pushed for ASP/JSP...
{
     // Read in HTTP request headers
     string[] requestHeaders;
     while(true)
     {
         string line = readln();
         if(line.length<= 1)
             break;

         requestHeaders ~= line;
     }

     // Send response headers
     writeln("Status: 200 OK");
     writeln("Content-Type: text/html; charset=UTF-8");
     writeln();

     // Send content
     writeln("<b><i>Hello world</i></b>");
}

Compile with:
dmd hellocgi.d

And just stick the resulting "hellocgi.exe" (windows) or "hellocgi" (other)
in whatever "cgi-bin"-capable directory you have on your server.
Thanks for this Example also. I will keep it for later trial.

Everything else (such as fancy CGI libraries/frameworks like Adam's) can
ultimately be built out of that basic idea.

Keep in mind though, that since D is natively compiled, you'll have to
compile it on either the same OS and CPU architecture as your server, or an
OS/CPU that's compatible with your server. (This would be true of C/C++ as
well.)
yes. I am aware about that. Thanks very much.
I'm sure it's possible to make an ISAPI filter or Apache module in D, but
I've never really done that in any langauge, and I haven't really dealt with
DLLs much, so I wouldn't know how. But even as CGI, a web app in D is likely
to still be much faster than one in, for instance, PHP or Ruby.
Why I am looking for DLL as compare to exe is becuase it is a well know security concern
published and accepted as minimum by the industry for MNC.


--
Matthew Ong
email: on...@yahoo.com

Reply via email to