Activiti-Rest-Client
view release on metacpan or search on metacpan
0.1254 2018-04-25 11:16:46 CEST
- add option timeout for client
0.1253 2015-09-28
- support for jobs
0.1252 2015-07-14
- add charset 'UTF-8' to default header Accept
0.1251 2015-04-30
- Activiti::Rest::Response: odd number of values in anonymous hash, due to the method content_type returning multiple values
0.125 2015-04-27
- change in activiti-rest 5.17: error response use 'exception' instead of 'errorMessage'
- send signal to execution
0.124 2014-12-05
- add support for retrieval of historic variable instances
0.123 2014-11-13
- add support for retrieval of one task variable
0.122 2014-10-16
- Extend Activiti::Rest::Error
- Bug in Activiti::Rest::Error : response content only used in Activiti::Rest::Error::InternalServerError, rest uses response message
0.121 2014-10-08
- add default header "Accept: application/json" to ensure that Activiti always returns json (in newer version XML can be returned)
lib/Activiti/Rest/Error.pm view on Meta::CPAN
package Activiti::Rest::Error;
use Activiti::Sane;
use Moo;
extends 'Throwable::Error';
has status_code => (
is => 'ro',
required => 1
);
#prior to activiti version 5.17, now exception
has error_message => (
is => 'ro',
required => 1
);
#from activiti version 5.17, formerly errorMessage
has exception => (
is => 'ro',
required => 1
);
has content_type => (
is => 'ro',
required => 1
);
has content => (
is => 'ro',
lib/Activiti/Rest/Response.pm view on Meta::CPAN
sub from_http_response {
my($class,$res)=@_;
#status code indicates 'failure'
unless($res->is_success){
my $code = $res->code;
#before version 5.17
# { "errorMessage": "<errorMessage>", "statusCode": "statusCode" }
#from version 5.17
# { "message": "<http message>", "exception": "<former errorMessage>" }
my $content_hash = JSON::decode_json($res->content);
my $exception = $content_hash->{exception} || $content_hash->{errorMessage};
#can return multiple values (e.g. 'application/json','charset=utf-8')
my $ct = $res->content_type;
my $args = {
status_code => $res->code,
message => $res->message,
content => $res->content,
content_type => $ct,
error_message => $exception,
exception => $exception
};
#The operation failed. The operation requires an Authentication header to be set. If this was present in the request, the supplied credentials are not valid or the user is not authorized to perform this operation.
if($code eq "401"){
Activiti::Rest::Error::UnAuthorized->throw($args);
}
#The operation is forbidden and should not be re-attempted. This does not imply an issue with authentication not authorization, it's an operation that is not allowed. Example: deleting a task that is part of a running process is not allowed and w...
lib/Activiti/Rest/Response.pm view on Meta::CPAN
#The operation failed. The operation causes an update of a resource that has been updated by another operation, which makes the update no longer valid. Can also indicate a resource that is being created in a collection where a resource with that ...
elsif($code eq "409"){
Activiti::Rest::Error::Conflict->throw($args);
}
#The operation failed. The request body contains an unsupported media type. Also occurs when the request-body JSON contains an unknown attribute or value that doesn't have the right format/type to be accepted.
elsif($code eq "415"){
Activiti::Rest::Error::UnsupportedMediaType->throw($args);
}
#The operation failed. An unexpected exception occurred while executing the operation. The response-body contains details about the error.
elsif($code eq "500"){
Activiti::Rest::Error::InternalServerError->throw($args);
}
#common error
else{
Activiti::Rest::Error->throw($args);
}
}
my $content_type = $res->header('Content-Type');
my $content_length = $res->header('Content-Length');
my(%new_args) = (
( run in 0.337 second using v1.01-cache-2.11-cpan-65fba6d93b7 )