public URLBuilder setRef(String ref) { this.ref = StringUtils.urlEncode(ref); return this; }
public URLBuilder setUserInfo(String userInfo) { this.userInfo = StringUtils.urlEncode(userInfo); return this; }
public URLBuilder setRef(String ref) { this.ref = StringUtils.urlEncode(ref); return this; }
public URLBuilder setUserInfo(String userInfo) { this.userInfo = StringUtils.urlEncode(userInfo); return this; }
/** * Confirm that user Authentication was done successfully * * @param opId Operation id returned by {@link #authenticateUser(String, URL, URL)} * @return Authenticated user ref * @throws IOException If error occurred performing the operation */ public String confirmUserAuthentication(@NotNull String opId) throws IOException { return get("api/idvkey/authenticate?opId=" + urlEncode(opId)); }
public URLBuilder param(String key, long value) { param(StringUtils.urlEncode(key), Long.toString(value), true); return this; }
public URLBuilder param(String key, byte value) { param(StringUtils.urlEncode(key), Byte.toString(value), true); return this; }
public URLBuilder param(String key, long value) { param(StringUtils.urlEncode(key), Long.toString(value), true); return this; }
public URLBuilder param(String key, int value) { param(StringUtils.urlEncode(key), Integer.toString(value), true); return this; }
public URLBuilder param(String key, byte value) { param(StringUtils.urlEncode(key), Byte.toString(value), true); return this; }
public URLBuilder param(String key, boolean value) { param(StringUtils.urlEncode(key), Boolean.toString(value), true); return this; }
public URLBuilder param(String key, int value) { param(StringUtils.urlEncode(key), Integer.toString(value), true); return this; }
public URLBuilder param(String key, boolean value) { param(StringUtils.urlEncode(key), Boolean.toString(value), true); return this; }
public static String urlPathEncode( String path ) { StringBuilder buffer = new StringBuilder(); for (char c : path.toCharArray()) { if (UNSAFE_URLPATH.indexOf(c) >= 0) { buffer.append('%'); buffer.append(toHex(c / 16)); buffer.append(toHex(c % 16)); } else if( c < 32 && c > 128 ) { buffer.append(urlEncode(Character.toString(c))); } else { buffer.append(c); } } return buffer.toString(); }
public static String urlPathEncode(String path) { StringBuilder buffer = new StringBuilder(); for (char c : path.toCharArray()) { if (UNSAFE_URLPATH.indexOf(c) >= 0) { buffer.append('%'); buffer.append(toHex(c / 16)); buffer.append(toHex(c % 16)); } else if (c < 32 && c > 128) { buffer.append(urlEncode(Character.toString(c))); } else { buffer.append(c); } } return buffer.toString(); }
/** * Check what is the approval state of an operation * * @param opId Operation Id * @return approval state * @throws IOException If an error occurs while performing the operation */ public ApprovalState getApprovalState(@NotNull String opId) throws IOException { final String state = get("api/idvkey/approve?opId=" + urlEncode(opId)); try { return ApprovalState.valueOf(state); } catch (IllegalArgumentException e) { throw new IOException("Invalid approval state: " + state); } }