Re: netWindow - PHP data transfer model
Alex Russell <[email protected]>
| Newsgroups | gmane.comp.windows.devel.netwindows |
|---|---|
| Organization | netWindows.org |
| Message-ID | <[email protected]> |
On Tuesday 12 August 2003 04:08, Christian Boulanger wrote:
> > You will want to make sure that your server sends appropriate cache
>
> > headers so that no roundtrip is needed (or just a If-Modified-Since
> > check). Note that this means that you can *not* be setting cookies in your
> > data url handler, because cookies kill caching.
>
> > Whether you use Last-Modified, Expires, or Cache-Control depends on the
> > nature of your requests.
>
> Does this basically rule out PHP Session management? (Which sets the cookie
> "phpsessionid").
From a purely security standpoint, at no time should you ever use PHP's built
in session managment code. It makes some VERY optimistic assumptions about
the server it's on, the location of temp files, etc... These assumptions
break very badly in shared hosting environments and the like. There are other
problems with it, but they are covered by other more complete sources. Google
is your friend = )
Let me know if you need assistance with session managment. I do web
application security as my "day job".
> I do not know if I fully understand you. Is the cache
> destroyed even if a Sub-Window (i.e. a window created by NetWindows) is
> loaded with data?
netWindows window widgets use the netWindows content loader to host content.
This is a queue mechanism built around an inline frame. Any rules about
caching that hold true for loading data into inline frames hold for the
content loader.
> Users aren't supposed to press the refresh button, if
> they do, it is not the fault of the application if the data is lost, no?
> The "Last-Modified, Expires, or Cache-Control"- header-stuff is greek to
> me, if it is important, I would be happy about a reference on that (maybe
> off-line).
MDA is pretty intimately familiar with this stuff thanks to a recent project.
He should be able to better direct you to information.
> > - How large is the data? Is it more than a 100Kbytes?
> > You'll want to make sure your server accepts a gzip transfer encoding.
>
> No, the data is not that large, but it would contain two-dimensional arrays
> (array[x][y]) which are difficult to collaps..
Eh, we've done that, and for upwards of 100K. This is totally managable.
> > - Will a single page be making multiple data requests? How many? In
> > series or parallel?
>
> I think serial requests are sufficient. I want to make few and large
> data-requests, the result of which is shown in windows, and many short
> ("just a question...")- requests, for example, "is this user registered?",
> "please update record no. X with data y".., the response to which should
> not show in any window.
>
> > - What browser makes and versions are you targeting?
>
> The same that netWindows runs on.
Handy, that = )
> > - What will the data sent back be? A text string you parse? A
> > javascript expression? html?
>
> This should depend on the type of request. If I make a LoadURL-Request, the
> data is obviously going to be HTML/Javascript. If it is a data-request, I
> want the answer to be in a format that Javascript can convert instantly to
> variables. And I am still uncertain how this should be done.
Give me until tonight to finish my rework of the __data__ object and I'll send
you an example of how you can get this result if you don't mind going through
a parsing step in the response. It's not quite XML-RPC style, as requests are
still made through URL GETs, but the response resembles XML in some senses.
> Send Javascript to be evaluated? (That is my current solution)
This scales better than anything else. It does require XMLHTTP support in the
browser, which counts some of the more esoteric platforms that netWindows has
been known to load on (Konq, Safari, Opera) out of the running.
There is an example of how to do this style of data loading in the combo box
widget. I'll try to distill that code a bit if I get a few spare hours
sometime this comming week (although I wouldn't hold my breath).
> Or find some mid-range format which could be the same on client and server
> side (for example, Python-type dictionaries "{'key1':'value1', 'key2':
> {'key2.1':'value2.1', 'key2.2':'value2.2'}, 'key3':'value3'}". I don't
> know. Javascript could send PHP-Arrays to be eval'd
> ("array('key1'=>'value1',...."), but I do not like this for aestetic
> reasons. I might have found a array to string / string to array solution at
> http://www.flashforum.de/archiv/topic/62187-1.html , the logic of which I
> can convert to PHP.
This is essentially with the __data__ object rework will buy you. I _really_
need to finish that = )
> > __env__.addToPageQueue(url, dest_div_node, false, notifyobj,
> > notifymeth)
> >
> > dest_div_node is a DOM node whose content you want set to what is
> > fetched from the url. notifyobj[notifymeth] will be called when it is
> > ready.
>
> > you can get the content back by doing dest_div_node.innerHTML
> > if it is html content.
>
> The part about the callback function is good to know!
It's new in the last week or two, which I think is why it wasn't mentioned
earlier. (you can thank Michael Flanagan for it's addition)
> Where are the access points of the different widgets? What is the difference
> between "domnode" and "contentnode"?
domNode is a property of every widget. It is the root node of the widget's
visible DOM tree, whereas contentNode is a convenience in the window widget
to provide you with a reference to the main content area. You can try to
assign a data load to a window's domNode just to see what happens. Should be
entertaining = )
> So should I use "_env__.addToPageQueue" always when making a request? If I
> do not want the response to be shown in any window, what should the
> "dest_div_node"be?
null is an accepted value.
> How do I create a non-visible dest_div_node? Simple
> create a DOMnode? Sorry for all of these questions, I wish I could look it
> up myself...
__data__ will take care of this for you. If you can hold on a little bit more,
I can probably get you a much better answer for all of this. Sorry for the
delay. I guess it's true what they say: "Open Source is always late". = )
Regards
--
Alex Russell
[email protected]
[email protected]
_______________________________________________
The netWindows developers list: [email protected]
http://netwindows.org/mailman/listinfo/devel_netwindows.org