httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin nylin <martin.ny...@gmail.com>
Subject Re: maintaining sessions among multiple processes
Date Sun, 04 Oct 2009 10:47:50 GMT
yes, serialization would indeed solve my problem and give me several
options for storing session data on the server side (or even send the
session object back and forth to the client in cookies). BUT, i think
that in order to serialize an object you have to know its true type.
what i'm trying to do is a framework that is very similar to java
servlets, but for c++. consider the HttpSession class in java, it has
a method like this:

void 	setAttribute(java.lang.String name, java.lang.Object value)

using c++ that would be something like this:

void 	setAttribute(const std::string& name, void* value)

now, when implementing the setAttribute method comes the tricky part:
you have been passed an object that has been cast to void* and to my
knowledge there is no way to determine its true type or size. there
lies my problem.

/martin

On Sun, Oct 4, 2009 at 3:22 AM, Yoichi Kawasaki <yokawasa@gmail.com> wrote:
>>
>> i find your book to be one of the most enlightening ones written in
>> recent years, but i haven't found the answers to my question in there.
>> the closest you get to touching the subject is perhaps the section on
>> "session management with SQL", which as jim jagielski also points out,
>> might be the way forward. it's just that my session objects contains
>> objects of unknown types so i don't know how to store them in a
>> traditional rdbms. maybe i can figure out a way to convert them to
>> blobs if you tell me that there is no way to do what i originally
>> suggested: interfere with the request dispatching in apache.
>>
>
> why don't you serizlie the session objects and store them in rdmbs,
> memcached, etc?
> I use the term "seralize" and "deserialize" to mean the deconstruction
> of "sessionObject"
> to  a sequence of bytes, and reverse construction from a sequece of
> bytes to "sessionObject"
> respectively.
> for serialization, you can use any famouse libraries like
> "boost::serialization"
> or create a converter that can achive this kind of thing by yourself
> if the structure of
> "sessionObject" is simple enough.
>
> Yoichi
>
> --
> Yoichi Kawasaki <yokawasa@gmail.com>
>



-- 
"A Catholic is more capable of evil than anyone"
Graham Greene

Mime
View raw message