本文整理汇总了Java中org.craftercms.commons.http.HttpUtils.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java HttpUtils.addValue方法的具体用法?Java HttpUtils.addValue怎么用?Java HttpUtils.addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.craftercms.commons.http.HttpUtils
的用法示例。
在下文中一共展示了HttpUtils.addValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createProfile
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile createProfile(String tenantName, String username, String password, String email, boolean enabled,
Set<String> roles, Map<String, Object> attributes, String verificationUrl)
throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_USERNAME, username, params);
HttpUtils.addValue(PARAM_PASSWORD, password, params);
HttpUtils.addValue(PARAM_EMAIL, email, params);
HttpUtils.addValue(PARAM_ENABLED, enabled, params);
HttpUtils.addValues(PARAM_ROLE, roles, params);
if (MapUtils.isNotEmpty(attributes)) {
HttpUtils.addValue(PARAM_ATTRIBUTES, serializeAttributes(attributes), params);
}
HttpUtils.addValue(PARAM_VERIFICATION_URL, verificationUrl, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_CREATE);
return doPostForObject(url, params, Profile.class);
}
示例2: getProfileByUsername
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile getProfileByUsername(String tenantName, String username, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_USERNAME, username, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_USERNAME);
url = addQueryParams(url, params, false);
try {
return doGetForObject(url, Profile.class);
} catch (ProfileRestServiceException e) {
if (e.getStatus() == HttpStatus.NOT_FOUND) {
return null;
} else {
throw e;
}
}
}
示例3: getProfileByTicket
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile getProfileByTicket(String ticketId, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TICKET_ID, ticketId, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_TICKET);
url = addQueryParams(url, params, false);
try {
return doGetForObject(url, Profile.class);
} catch (ProfileRestServiceException e) {
if (e.getStatus() == HttpStatus.NOT_FOUND) {
return null;
} else {
throw e;
}
}
}
示例4: getProfilesByQuery
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfilesByQuery(String tenantName, String query, String sortBy, SortOrder sortOrder,
Integer start, Integer count, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_QUERY, query, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValue(PARAM_START, start, params);
HttpUtils.addValue(PARAM_COUNT, count, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_QUERY);
url = addQueryParams(url, params, true);
try {
return doGetForObject(new URI(url), profileListTypeRef);
} catch (URISyntaxException e) {
throw new I10nProfileException(ERROR_KEY_INVALID_URI_ERROR, url);
}
}
示例5: getProfileRange
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfileRange(String tenantName, String sortBy, SortOrder sortOrder, Integer start,
Integer count, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValue(PARAM_START, start, params);
HttpUtils.addValue(PARAM_COUNT, count, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_RANGE);
url = addQueryParams(url, params, false);
return doGetForObject(url, profileListTypeRef);
}
示例6: getProfilesByExistingAttribute
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfilesByExistingAttribute(String tenantName, String attributeName, String sortBy,
SortOrder sortOrder, String... attributesToReturn)
throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_ATTRIBUTE_NAME, attributeName, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_EXISTING_ATTRIB);
url = addQueryParams(url, params, false);
return doGetForObject(url, profileListTypeRef);
}
示例7: getProfilesByAttributeValue
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfilesByAttributeValue(String tenantName, String attributeName,
String attributeValue, String sortBy, SortOrder sortOrder,
String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_ATTRIBUTE_NAME, attributeName, params);
HttpUtils.addValue(PARAM_ATTRIBUTE_VALUE, attributeValue, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_ATTRIB_VALUE);
url = addQueryParams(url, params, false);
return doGetForObject(url, profileListTypeRef);
}
示例8: updateProfile
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile updateProfile(String profileId, String username, String password, String email, Boolean enabled,
Set<String> roles, Map<String, Object> attributes, String... attributesToReturn)
throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_USERNAME, username, params);
HttpUtils.addValue(PARAM_PASSWORD, password, params);
HttpUtils.addValue(PARAM_EMAIL, email, params);
HttpUtils.addValue(PARAM_ENABLED, enabled, params);
// Send empty role to indicate that all roles should be deleted
if (roles != null && roles.isEmpty()) {
HttpUtils.addValue(PARAM_ROLE, "", params);
} else {
HttpUtils.addValues(PARAM_ROLE, roles, params);
}
if (MapUtils.isNotEmpty(attributes)) {
HttpUtils.addValue(PARAM_ATTRIBUTES, serializeAttributes(attributes), params);
}
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_UPDATE);
return doPostForObject(url, params, Profile.class, profileId);
}
示例9: verifyProfile
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile verifyProfile(String verificationTokenId, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_VERIFICATION_TOKEN_ID, verificationTokenId, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_VERIFY);
return doPostForObject(url, params, Profile.class);
}
示例10: getProfileCount
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public long getProfileCount(String tenantName) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_COUNT);
url = addQueryParams(url, params, false);
return doGetForObject(url, Long.class);
}
示例11: getProfileCountByQuery
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public long getProfileCountByQuery(String tenantName, String query) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_QUERY, query, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_TENANT_COUNT_BY_QUERY);
url = addQueryParams(url, params, true);
try {
return doGetForObject(new URI(url), Long.class);
} catch (URISyntaxException e) {
throw new I10nProfileException(ERROR_KEY_INVALID_URI_ERROR, url);
}
}
示例12: getProfilesByIds
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfilesByIds(List<String> profileIds, String sortBy, SortOrder sortOrder,
String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValues(PARAM_ID, profileIds, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_IDS);
url = addQueryParams(url, params, false);
return doGetForObject(url, profileListTypeRef);
}
示例13: getProfilesByRole
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public List<Profile> getProfilesByRole(String tenantName, String role, String sortBy, SortOrder sortOrder,
String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_TENANT_NAME, tenantName, params);
HttpUtils.addValue(PARAM_ROLE, role, params);
HttpUtils.addValue(PARAM_SORT_BY, sortBy, params);
HttpUtils.addValue(PARAM_SORT_ORDER, sortOrder, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_GET_BY_ROLE);
url = addQueryParams(url, params, false);
return doGetForObject(url, profileListTypeRef);
}
示例14: resetPassword
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile resetPassword(String profileId, String resetPasswordUrl, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_RESET_PASSWORD_URL, resetPasswordUrl, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_RESET_PASSWORD);
return doPostForObject(url, params, Profile.class, profileId);
}
示例15: changePassword
import org.craftercms.commons.http.HttpUtils; //导入方法依赖的package包/类
@Override
public Profile changePassword(String resetTokenId, String newPassword, String... attributesToReturn) throws ProfileException {
MultiValueMap<String, String> params = createBaseParams();
HttpUtils.addValue(PARAM_RESET_TOKEN_ID, resetTokenId, params);
HttpUtils.addValue(PARAM_NEW_PASSWORD, newPassword, params);
HttpUtils.addValues(PARAM_ATTRIBUTE_TO_RETURN, attributesToReturn, params);
String url = getAbsoluteUrl(BASE_URL_PROFILE + URL_PROFILE_CHANGE_PASSWORD);
return doPostForObject(url, params, Profile.class);
}