e
manager. These nodes are converted into JSON instructions by the
ChangeManager, which are sent as the HTTP response. The JS client library
decodes the JSON instructions, populating the XUL DOM tree
nager converts any changes to
the POE::XUL::Nodes to JSON instructions, which are sent as the HTTP
response. The JS client library decodes the JSON instructions, modifying the
XUL DOM tree as necessar
\/ /\
HTTP/AJAX Request JSON
\/ /\
POE::Component::XUL decode
);
}
elsif( $ct eq 'application/json' or $ct eq 'text/json' ) {
# TODO : request might be an array of requests!
return $self->decode_json ( $C );
}
xwarn "Unable to par
#################
sub decode_json
{
my( $self, $C ) = @_;
my $args = eval {
if( $JSON::XS::VERSION > 2 ) {
return JSON::XS::decode_json( $C )
}
else {
return JSON::XS::from_json( $C )
}
};
if( $@ ) {
xwarn "JSON error: $@";
return RC_BAD_REQUEST;
}
unless( 'HASH' eq ref $a
yId.
#
use strict;
use warnings;
use Carp qw( carp confess croak cluck );
use HTTP::Status;
use JSON::XS;
use POE::XUL::Logging;
use POE::XUL::State;
use POE::XUL::Encode;
use Scalar::Util qw( weake
prepend => [],
other_windows => []
}, $package;
$self->build_json;
return $self;
}
##############################################################
sub current_
#################################
sub build_json
{
my( $self ) = @_;
my $coder = JSON::XS->new->space_after( 1 );
$coder->ascii;
$self->{json_coder} = $coder;
}
######################
or transmitting data
# to the browser. But JavaScript fails when it comes to binary formats
# so JSON is used
#
use strict;
use warnings;
use Encode ();
sub content_type { return "application/vnd.p