Content of helpers/common-methods.gradle: // Define methods as usual def commonMethod1(param){ return true } def commonMethod2(param){ return true } // Export methods by turning them into closures ext{ commonMethod1 = this.&commonMethod1 otherNameForMethod2 = this.&commonMethod2 } And this is how I use those methods in another script: // Use double-quotes, otherwise $ won't work apply from: "http://myhelpers.com/helpers/common-methods.gradle" // You can also use URLs //apply from: "https://bitbucket.org/mb/build_scripts/raw/master/common-methods.gradle" task myBuildTask{ def myVar = commonMethod1("parameter1") otherNameForMethod2(myVar) }
I wanted a place where I can post technical articles only. This is the place to find out my tips and tricks for being a Java web applications developer. I hope it helps you.
Wednesday, August 17, 2016
Externalize Common Gradle Functions
Thursday, August 04, 2016
Trust Relationship and Policies for AWS API Gateway and Lambdas
Your Policy for the lambda should set up everything your lambda is allowed to do. This includes passing a role.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "Stmt1470153553000", "Effect": "Allow", "Action": [ "dynamodb:*" ], "Resource": [ "arn:aws:dynamodb:us-west-2:439753510372:table/YoYoDyne_Products" ] }, { "Effect": "Allow", "Action": [ "lambda:InvokeFunction" ], "Resource": [ "*" ] }, { "Effect": "Allow", "Action": [ "logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents" ], "Resource": [ "arn:aws:logs:*:*:*" ] }, { "Sid": "Stmt1449789105000", "Effect": "Allow", "Action": [ "iam:PassRole" ], "Resource": [ "*" ] } ] }Your policy also needs to have a trust relationship.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "", "Effect": "Allow", "Principal": { "Service": ["lambda.amazonaws.com", "apigateway.amazonaws.com"] }, "Action": "sts:AssumeRole" } ] }
Tuesday, August 02, 2016
Java HTTPS Over VPN: Unrecognized SSL message, plaintext connection?
Many times a VPN will screw around with the IPV4 settings for secure connections.
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.InputRecord.read(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(Unknown Source) at sun.net.www.protocol.https.HttpsClient.afterConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.connect(Unknown Source)Add these VM options to avoid problems:
-Djsse.enableSNIExtension=false -Djava.net.preferIPv4Stack=true
Subscribe to:
Posts (Atom)