#!/usr/bin/perl -w
package Apache::Sling::JsonQueryServletUtil;
use 5.008001;
use strict;
use warnings;
use Carp;
use Apache::Sling::URL;
require Exporter;
use base qw(Exporter);
our @EXPORT_OK =
( !defined $base_url ) { croak 'No base url defined!'; }
return "get $base_url/content.query.json?queryType=xpath&statement=//*";
}
#}}}
#{{{sub all_nodes_eval
sub all_nodes_eval {
my ($re
s) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
1;
__END__
=head1 NAME
Apache::Sling::JsonQueryServletUtil - Methods to generate and check HTTP requests required for querying.
=head1 ABST
che::Sling::Content;
use Apache::Sling::GroupMember;
use Apache::Sling::Group;
use Apache::Sling::JsonQueryServlet;
use Apache::Sling::LDAPSynch;
use Apache::Sling::User;
# Fail if args are empty or
he::Sling::GroupMember',
'group', 'Apache::Sling::Group',
'json_query_servlet', 'Apache::Sling::JsonQueryServlet',
'ldap_synch', 'Apache::Sling::LDAPSynch',
'user'
run group membership related actions
group - run group related actions
json_query_servlet - run json query servlet related actions
ldap_synch - run ldap synchronization related
l_setup
Returns a textual representation of the request needed to retrieve the ACL for
a node in JSON format.
=cut
sub get_acl_setup {
my ( $base_url, $remote_dest ) = @_;
croak "No base ur
to view ACL for defined!" unless defined $remote_dest;
return "get $base_url/$remote_dest.acl.json";
}
#}}}
#{{{sub get_acl_eval
=pod
=head2 get_acl_eval
Inspects the result returned from iss
e_setup
Returns a textual representation of the request needed to retrieve the ACL for
a node in JSON format.
=cut
sub delete_setup {
my ( $base_url, $remote_dest, $principal ) = @_;
croak
:ParseJsonIodef;
require CIF::Archive;
require JSON;
sub Prepare { return 1; }
sub Commit {
my $self = shift;
my $r = $self->TicketObj->IODEF();
my $ret = CIF::FeedParser::ParseJsonIodef:
:parse({},JSON::to_json([$r->to_tree()]));
foreach(@$ret){
$_->{'severity'} = 'low';
$_->{'detecttime'} = DateTime->from_epoch(epoch => time());
my ($err,$id) = CIF::Archi
n',
htm => 'text/html',
html => 'text/html',
js => 'application/javascript',
json => 'application/json',
latex => 'application/x-latex',
lsp => 'application/x-lisp',
lua => 'text/x-l
warnings;
use URI::Escape;
use LWP::UserAgent;
use HTTP::Request;
use Class::Field 'field';
use JSON::XS;
use Readonly;
our $VERSION = '0.38';
=head1 NAME
Socialtext::Resting - module for access
nt';
field 'query';
field 'etag_cache' => {};
field 'http_header_debug';
field 'response';
field 'json_verbose';
field 'cookie';
field 'agent_string';
field 'on_behalf_of';
field 'additional_headers'
ommon representations:
=over 4
=item text/x.socialtext-wiki
=item text/html
=item application/json
=back
=head2 get_page
$Rester->workspace('wikiname');
$Rester->get_page('page_name');
ck existence of defined!';
}
return "get $base_url/system/userManager/group/$act_on_group.json";
}
#}}}
#{{{sub exists_eval
sub exists_eval {
my ($res) = @_;
return ( ${$res}->code
group to view defined!'; }
return "get $base_url/system/userManager/group/$act_on_group.tidy.json";
}
#}}}
#{{{sub view_eval
sub view_eval {
my ($res) = @_;
return ( ${$res}->code eq '
Output::JSON;
# or: use IRC::Indexer::Output::YAML;
# or: use IRC::Indexer::Output::Dumper;
## Convert trawler output into JSON, for example:
my $output = IRC::Indexer::Output::JSON->new(
as L<IRC::Indexer::Output::JSON>.
=head1 METHODS
=head2 new
Create an output encoder; the reference to serialize must be specified:
my $out = IRC::Indexer::Output::JSON->new(
Input => $ref,
);
=head2 dump
Return the serialized output as a scalar.
my $json = $out->dump;
=head2 write
Write serialized output to a file path or an opened FH.
$out->write($path);
Will croak() on er
};
__PACKAGE__->meta->make_immutable;
}
{
package Count;
use MooseX::Coro;
use JSON::Any qw(XS);
with qw(MooseX::Workers);
sub BUILD { POE::Kernel->run }
has sender =>
print JSON::Any->encode($count);
}
);
};
sub worker_stdout {
my ( $self, $out ) = @_;
warn $out;
my $count = JSON::Any->decode($out);
b} <=> $count->{$a} } keys %$count;
};
}
{
package Count;
use MooseX::POE;
use JSON::Any qw(XS);
with qw(MooseX::Workers);
my $rx = qr|GET /ongoing/When/\d\d\dx/(\d\d\d\d/\
nk) {
$count->{$1}++ if $line =~ $rx;
}
print JSON::Any->encode(
{ sender => $sender->ID, count => $count } );
}
r => 'loop' );
};
sub worker_stdout {
my ( $self, $out ) = @_;
my $msg = JSON::Any->decode($out);
POE::Kernel->post( $msg->{sender} => 'inc' => $msg->{count} );
}
using MetaCPAN JSON API
$self->{model} = $self->metacpan_autocomplete($query);
} elsif ( $command eq 'pod' ) {
# Find the POD's HTML and SYNOPSIS section
# using MetaCPAN JSON API
$self->{m
,
);
# Convert ElasticSearch Perl query to a JSON request
require JSON::XS;
my $json_request = JSON::XS::encode_json( \%payload );
# POST the json request to api.metacpan.org
require LWP::User
Content => $json_request,
);
unless ( $response->is_success ) {
TRACE( sprintf( "Got '%s' from metacpan.org", $response->status_line ) )
if DEBUG;
return [];
}
# Decode json response the
e preprocessed
java => 'text/x-java-source',
js => 'application/javascript',
json => 'application/json',
lsp => 'application/x-lisp',
lua => 'text/x-lua',
mak => 'text/x-makefil
=> 'JavaScript',
lexer => Wx::wxSTC_LEX_ESCRIPT, # CONFIRMED
},
'application/json' => {
name => 'JSON',
lexer => Wx::wxSTC_LEX_ESCRIPT, # CONFIRMED
},
'application/x-latex' => {
up;
use 5.008001;
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config bundling);
use JSON;
use Text::CSV;
use Apache::Sling;
use Apache::Sling::GroupUtil;
use Apache::Sling::Print;
use Ap
ase verbosity of output.
--view or -V (actOnGroup) - view details for specified group in json format.
Options may be merged together. -- stops processing of options.
Space is not required be
array,$r->IODEF->to_tree());
}
return ('') unless($#array > -1);
require JSON;
return(JSON::to_json(\@array));
}
{
my %cache;
sub GetCustomField {
my $field = shift or
=head1 METHODS
=head2 authority ($pause_id)
Adds an C<x_authority> key to your META.yml or META.json
=head1 BUGS
This module should be able to take x_authority from the $AUTHORITY variable in the
s;
}
#}}}
#{{{sub get_acl
=pod
=head2 get_acl
Return the access control list for the node in JSON format
=cut
sub get_acl {
my ( $content, $remoteDest ) = @_;
my $res = Apache::Sling::R
read and write privileges to the g-testgroup principal, log the results, including the resulting JSON, to authz.log:
perl $0 -U http://localhost:8080 -r /testdata -P g-testgroup --read --write -u ad
se_url/$remote_dest.json";
}
#}}}
#{{{sub exists_eval
sub exists_eval {
my ($res) = @_;
return ( ${$res}->code eq '200' );
}
#}}}
#{{{sub full_json_setup
sub full_json_setup {
my ( $
'No position or ID to retrieve full json for specified!';
}
return "get $base_url/$remote_dest.infinity.json";
}
#}}}
#{{{sub full_json_eval
sub full_json_eval {
my ($res) = @_;
ret
alse.
=head2 full_json_setup
Returns a textual representation of the request needed to retrieve the full JSON
representation of a piece of content in the system.
=head2 full_json_eval
Inspects the
er;
use 5.008001;
use strict;
use warnings;
use Carp;
use Getopt::Long qw(:config bundling);
use JSON;
use Text::CSV;
use Apache::Sling;
use Apache::Sling::GroupUtil;
use Apache::Sling::GroupMemberUt
g::GroupUtil::view_eval($res);
my $message;
if ($success) {
my $group_info = from_json( ${$res}->content );
my $is_member = 0;
foreach my $member ( @{ $group_info->{'m
roupUtil::view_eval($res);
my $message;
if ($success) {
my $group_info = from_json( ${$res}->content );
my $number_members = @{ $group_info->{'members'} };
my $memb
ings;
our $VERSION = '1.005';
use constant API_URI => 'https://api.sailthru.com';
use LWP;
use JSON::XS;
use URI::Escape;
use HTTP::Request;
use Digest::MD5 qw( md5_hex);
use Params::Validate qw( :
ata->{'format'} = 'json';
$data->{'sig'} = $self->_getSignatureHash($data);
my $result = $self->_httpRequest( API_URI . "/" . $action, $data, $method );
my $json = JSON::XS->new->ascii->pr
etty->allow_nonref;
my $decoded = $json->decode( $result->content );
return $decoded ? $decoded : $result;
}
sub _httpRequest {
validate_pos( @_, { type => HASHREF }, { type => SCALAR }, { type =>
- view the full script documentation.
--me or -m - me returns json representing authenticated user.
--new-password or -n (newPassword) - Used with -c, new passwor
se verbosity of output.
--view or -V (actOnUser) - view details for specified user in json format.
Options may be merged together. -- stops processing of options.
Space is not required be