Re: Apache plug-in connecting to a Cocoa application?
Re: Apache plug-in connecting to a Cocoa application?
- Subject: Re: Apache plug-in connecting to a Cocoa application?
- From: Greg Titus <email@hidden>
- Date: Sun, 10 Jun 2001 11:25:28 -0700
On Sunday, June 10, 2001, at 01:30 AM, Chilton Webb wrote:
>
> On Saturday, Chilton Webb confused the masses by asking:
>
> I'd like to connect my Cocoa app to the built-in web server in OSX.
>
Any suggestions?
>
>
>
On Sunday, June 10, 2001, at 02:52 AM, Scott Anguish wrote:
>
I think you'd need to define 'connect' a bit better.
>
Do you want to make a Cocoa app a CGI or Apache plugin?
>
If so, you're probably actually referring to a Foundation tool, since
>
you don't want a UI, and because you can't use anything related to the
>
windowserver if nobody is logged in.
>
>
And...
>
On Sunday, June 10, 2001, at 03:18 AM, Finlay Dobbie wrote:
>
> you really need to be more specific. what exactly do you need to do?
>
>
Frankly, this seems to point to something I feared about OSX, which is
>
that this paradigm simply does not exist in the context of Unix-based
>
OSes. If you're familiar with CGI applications in OS9, tools can be
>
built such as Flamethrower that allow you to mix an application with a
>
web CGI app, so that you can create TRUE applications, complete with
>
interfaces, and allow them to interact with connected web users.
No, it exists, but like the other people that responded to you, I wasn't
quite sure what it was you were asking because it was quite vague. The
range of difficulty of the questions asked here varies enormously, so I
think it was perfectly reasonable for Scott to assume that maybe you
were asking about a simple CGI.
>
If you're still confused by what I want to do, just ignore my previous
>
question, and instead tell me this: is it possible to create a CGI /
>
Apache plug-in that can send/receive Carbon Events and/or AppleEvents?
Absolutely. With Cocoa you would want to use Distributed Objects though.
(See the class documentation on NSConnection.)
The easy (but slower) way is to make a Foundation tool to do a simple
CGI program which does whatever parsing needs to be done with an
incoming web request, connects to your running application via
Distributed Objects, sends a message, waits for a reply, and formats the
reply as HTML going back to the web user.
Or build an Apache plugin that can stay resident in the Apache server so
you don't need to do the startup and connect steps for every request.
(More efficient, but you need to deal with writing a plugin instead of a
simple CGI.)
I'd start with the first way and maybe transition to the second way if I
had enough traffic to matter. (Maybe even make the CGI/Apache side of it
completely generic - just wrapping up form arguments, et cetera, and
connecting to a DO server with a configurable name, or name based on
part of the URL. That way you could reuse the same Apache integration
piece with multiple GUI apps.) Anyway, either way the application side's
implementation doesn't need to change at all.
Are there more specific questions, or were you basically looking for an
interprocess communication mechanism?
Hope this helps,
--Greg