View _auth_failure_handler_.xml
<sequence name="_auth_failure_handler_" xmlns="http://ws.apache.org/ns/synapse">
<switch source="$trp:Accept">
<case regex="application/json">
<property name="error_message_type" value="application/json"/>
</case>
<default>
<property name="error_message_type" value="application/xml"/>
</default>
</switch>
<sequence key="_build_"/>
View blockchainID.txt
Verifying that +vanjikumaran is my blockchain ID. https://onename.com/vanjikumaran
View NxNPattern.java
import java.lang.Math;
public class NxNPattern
{
public static void main(String[] args)
{
for (int i = 0, j = 0; i < 49; i++) {
if (i % 7 == 0) {
if (j > 0) System.out.println();
j++;
View RecursiveValueFetch
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
name="RecursiveValueFetch"
transports="https,http"
statistics="disable"
trace="disable"
startOnLoad="true">
<target>
<inSequence>
<property name="Key" value="Location" scope="default" type="STRING"/>
View SynapseConfigSimpleServiceChaining
<api xmlns="http://ws.apache.org/ns/synapse" name="TestApi" context="/TestContext">
<resource methods="POST GET">
<inSequence>
<log level="custom">
<property name="Message Flow" value="Roovershof Plant Search API - IN"></property>
<property name="HTTP_METHOD IS###########" expression="$axis2:HTTP_METHOD"></property>
<property name="ip address" expression="get-property('axis2','REMOTE_ADDR')"></property>
<property name="Authorization" expression="get-property('transport','Authorization')"></property>
</log>
<property name="TIME_IN" expression="get-property('SYSTEM_TIME')" scope="default" type="LONG"></property>
View gist:c7574441327e4927ed5a
<api xmlns="http://ws.apache.org/ns/synapse" name="strip" context="/strip">
<resource methods="POST GET">
<inSequence>
<header name="Authorization" scope="transport" value="Bearer XXXXXXXXXXXXXXXXXXXXX"></header>
<property name="uri.var.chargeId" expression="json-eval($.chargeId)" scope="default" type="STRING"></property>
<payloadFactory media-type="json">
<format></format>
<args></args>
</payloadFactory>
<property name="ContentType" value="application/x-www-form-urlencoded" scope="axis2"></property>
View deleteObjects
<script>
var text = '{"invideoPromotion":{"items":[{"id":{"type":"video","videoId":"11","websiteUrl":""},"timing":{"type":"ms","offsetMs":"2222"},"customMessage":"aa","promotedByContentOwner":"vanji"}]}}'
var obj = JSON.parse(text);
document.writeln(JSON.stringify(obj));
for (var i = 0; i < obj.invideoPromotion.items.length; i++) {
if (obj.invideoPromotion.items[i].id.type == 'video') {
if (obj.invideoPromotion.items[i].id.websiteUrl == '') {
delete obj.invideoPromotion.items[i].id.websiteUrl;
}
View GetHeaderDetail
<sequence xmlns="http://ws.apache.org/ns/synapse" name="main">
<in>
<filter xmlns:ns="http://org.apache.synapse/xsd" source="get-property('To')" regex=".*/StockQuote.*">
<then>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"></address>
</endpoint>
</send>
</then>
View SecurityListings
import java.security.Provider;
import java.security.Security;
public class SecurityListings {
public static void main(String[] args) {
for (Provider provider : Security.getProviders()) {
System.out.println("Provider: " + provider.getName());
for (Provider.Service service : provider.getServices()) {
System.out.println(" Algorithm: " + service.getAlgorithm());
}
View UserProfileMgtRestServices
<api name="UserProfileMgtRestServices" context="/UserProfileMgtRestServices">
<resource methods="GET" uri-template="/getUserProfiles/{userId}">
<inSequence>
<payloadFactory media-type="xml">
<format>
<mgt:getUserProfiles xmlns:mgt="http://mgt.profile.user.identity.carbon.wso2.org">
<mgt:username>$1</mgt:username>
</mgt:getUserProfiles>
</format>