Skip to content

Instantly share code, notes, and snippets.

package com.uefa.idp.cdc.client.jwt;
public class Jwt2 {
private final JwtHeader header;
private final JwtBody body;
public Jwt2(String kid) {
this.header = new JwtHeader(kid);
this.body = new JwtBody();
package com.uefa.idp.cdc_client.api;
import com.uefa.idp.cdc_client.api.dto.GetAccountInfoResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class AuthClient {
public static final String ACCOUNTS_GET_ACCOUNT_INFO = "accounts.getAccountInfo";
private static void xx() throws JsonProcessingException, NoSuchAlgorithmException, SignatureException, InvalidKeySpecException, InvalidKeyException {
final String userKey = "xxxx";
final String pk = "xxxx";
Jwt2 jwt = new Jwt2(userKey);
ObjectMapper mapper = new ObjectMapper();
final String headerAsString = mapper.writeValueAsString(jwt.getHeader());
db.nomineeDocument.find({}, {"matchId": 1}).forEach(function(nomineeObject) {
var matchId = nomineeObject.matchId;
db.nomineeDocument.updateMany({"matchId": matchId},
{$set:{matchReference:{"matchId":matchId, "homeTeamName":"sampleHomeTeamName" , "awayTeamName": "sampleAwayTeamName" }},
$unset: {matchId}});
});
@hendismail
hendismail / getCurrentPolls
Last active July 12, 2018 09:17
/v1/current-polls?competitionId=1&types=GOTW&offset=0&limit=2
{
"data": [
{
"id": "5b436fc91425b949600b2f9a",
"title": "sample poll for GOTW",
"status": "OPEN",
"type": "GOTW",
"competitionIds": [
"1"
],
@hendismail
hendismail / getPolls.json
Last active July 9, 2018 15:00
/v1/polls?offset=0&limit=20
{
"data": [
{
"id": "5b4365511425b949600b2f98",
"title": "this is sample title",
"status": "UPCOMING",
"type": "GOTW",
"competitionIds": [
"1",
"14"
var querystring = require('querystring');
var http = require('http');
const requestPromise = (options, postData = null) => new Promise((resolve, reject) => {
const isPostWithData = options && options.method === "POST" && postData !== null;
if (isPostWithData && (!options.headers || !options.headers["Content-Length"])) {
// Convenience: Add Content-Length header
options = Object.assign({}, options, {
headers: Object.assign({}, options.headers, {
"Content-Length": Buffer.byteLength(postData)
var request = require('request');
http("http://www.google.com", null, null, null, null, null, null);
function http(url, headers, body, username, password, insecure, poxy) {
var result;
console.log('calling : ', url);
request(url, function (error, response, body) {
console.log('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
//use the body here
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON document: (was java.lang.NullPointerException) (through reference chain: com.uefa.microservice.core.response.ApiMetaResponse["data"]->java.util.ArrayList[0]->com.uefa.competitionservice.domain.dto.CoefficientTeaser["lastUpdateDate"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: (was java.lang.NullPointerException) (through reference chain: com.uefa.microservice.core.response.ApiMetaResponse["data"]->java.util.ArrayList[0]->com.uefa.competitionservice.domain.dto.CoefficientTeaser["lastUpdateDate"])
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.writeInternal(AbstractJackson2HttpMessageConverter.java:286) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.http.converter.AbstractGenericHttpMessageConverter.write(AbstractGenericHttpMessageConverter.java:106) ~[spring-web-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.web.servlet.mvc.me
java.lang.NullPointerException: null
at com.uefa.competitionservice.domain.service.CoefficientService.getLatestCoefficient(CoefficientService.java:161) ~[main/:na]
at com.uefa.competitionservice.domain.controller.CoefficientController.getCoefficient(CoefficientController.java:76) ~[main/:na]
at com.uefa.competitionservice.domain.controller.CoefficientController$$FastClassBySpringCGLIB$$ab8d23e7.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.3.8.RELEASE.jar:4.3.8.RELEASE]
at org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor.invoke(AfterReturningAdviceInterceptor.java:52) ~[spring-aop-4.3.8.RELEAS