当前位置: 首页>>代码示例>>Java>>正文


Java HttpRequestBase.setURI方法代码示例

本文整理汇总了Java中org.apache.http.client.methods.HttpRequestBase.setURI方法的典型用法代码示例。如果您正苦于以下问题:Java HttpRequestBase.setURI方法的具体用法?Java HttpRequestBase.setURI怎么用?Java HttpRequestBase.setURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.http.client.methods.HttpRequestBase的用法示例。


在下文中一共展示了HttpRequestBase.setURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMemberInGroup

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a user's {@link Subscription} for the specified group and member IDs
 * 
 * @return the user's {@link Subscription} for the specified group ID
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription getMemberInGroup(final Integer groupId, final Integer memberId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getViewMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getmember");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", memberId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:29,代码来源:MemberResource.java

示例2: banMember

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Ban a member if they aren't already banned
 * 
 * @param groupId
 *            of the group they belong to
 * @param subscriptionId
 *            of the subscription they have
 * @return the user's {@link Subscription}
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription banMember(final Integer groupId, final Integer subscriptionId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getBanMembers()
            && getMemberInGroup(groupId, subscriptionId).getStatus().canBan())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "banmember");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", subscriptionId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:34,代码来源:MemberResource.java

示例3: approveMember

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Approve a member to a group
 * 
 * @param groupId
 *            of the group they should belong to
 * @param subscriptionId
 *            of the subscription they have
 * @return the user's {@link Subscription}
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription approveMember(final Integer groupId, final Integer subscriptionId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getManagePendingMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "approvemember");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", subscriptionId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:33,代码来源:MemberResource.java

示例4: directAddMember

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Add members directly to a group
 *
 * @param groupId
 *      of the group they should be added to
 * @param emails
 *      a list of email address to add.
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public void directAddMember(final Integer groupId, List<String> emails)
        throws URISyntaxException, IOException, GroupsIOApiException
{

    if (apiClient.group().getPermissions(groupId).getInviteMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "directadd");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("emails", String.join("\n", emails));
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());

        callApi(request, DirectAdd.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:33,代码来源:MemberResource.java

示例5: removeMember

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Remove a member from a group
 * 
 * @param groupId
 *            of the group they belong to
 * @param subscriptionId
 *            of the subscription they have
 * @return the user's {@link Subscription}
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription removeMember(final Integer groupId, final Integer subscriptionId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getRemoveMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "removemember");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", subscriptionId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:33,代码来源:MemberResource.java

示例6: sendBounceProbe

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Send a bounce probe to a user if they are bouncing
 * 
 * @param groupId
 *            of the group they belong to
 * @param subscriptionId
 *            of the subscription they have
 * @return the user's {@link Subscription}
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription sendBounceProbe(final Integer groupId, final Integer subscriptionId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getManageMemberSubscriptionOptions()
            && getMemberInGroup(groupId, subscriptionId).getUserStatus().canSendBounceProbe())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "sendbounceprobe");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", subscriptionId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:34,代码来源:MemberResource.java

示例7: sendConfirmationEmail

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Send a confirmation email to a user if they are not yet confirmed
 * 
 * @param groupId
 *            of the group they belong to
 * @param subscriptionId
 *            of the subscription they have
 * @return the user's {@link Subscription}
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Subscription sendConfirmationEmail(final Integer groupId, final Integer subscriptionId)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getManageMemberSubscriptionOptions()
            && getMemberInGroup(groupId, subscriptionId).getUserStatus().canSendConfirmationEmail())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "sendconfirmation");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("sub_id", subscriptionId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Subscription.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:34,代码来源:MemberResource.java

示例8: getGroup

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a {@link Group} for the specified group ID
 * 
 * @return the {@link Group} for the specified group ID
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Group getGroup(final Integer groupId) throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getManageGroupSettings())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getgroup");
        uri.setParameter("group_id", groupId.toString());
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        return callApi(request, Group.class);
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:27,代码来源:GroupResource.java

示例9: getSubgroups

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a list of groups for a given group ID
 * 
 * @param groupId
 *            to fetch subgroups for
 * @return {@link List}<{@link Group}> belonging to a parent group.
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public List<Group> getSubgroups(final Integer groupId) throws URISyntaxException, IOException, GroupsIOApiException
{
    final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getsubgroups");
    uri.setParameter("group_id", groupId.toString());
    uri.setParameter("limit", MAX_RESULTS);
    final HttpRequestBase request = new HttpGet();
    request.setURI(uri.build());
    
    Page page = callApi(request, Page.class);
    final List<Group> subgroups = Arrays.asList(OM.convertValue(page.getData(), Group[].class));
    
    while (page.getHasMore())
    {
        uri.setParameter("page_token", page.getNextPageToken().toString());
        request.setURI(uri.build());
        page = callApi(request, Page.class);
        subgroups.addAll(Arrays.asList(OM.convertValue(page.getData(), Group[].class)));
    }
    
    return subgroups;
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:32,代码来源:GroupResource.java

示例10: getNewRequest

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
private HttpRequestBase getNewRequest(String reqMethod, String reqPayload) 
		throws URISyntaxException, UnsupportedEncodingException {
	HttpRequestBase request;
	if(reqMethod.equals(HttpConstants.REQ_METHOD_POST)) {
		HttpPost postRequest = new HttpPost();
		postRequest.setEntity(new StringEntity(reqPayload, ContentType.create(DataFormats.JSON.getMediaType(), Constants.UTF_8)));
		request = postRequest;
	} else {
		throw new IllegalArgumentException(Errors.ARGS_HTTP_METHOD_UNSUPPORTED.getDescription());
	}
	request.setURI(new URI(String.format("%s://%s:%s/", 
				nodeConfig.getProperty(NodeProps.RPC_PROTOCOL.getKey()),
				nodeConfig.getProperty(NodeProps.RPC_HOST.getKey()),
				nodeConfig.getProperty(NodeProps.RPC_PORT.getKey()))));
	String authScheme = nodeConfig.getProperty(NodeProps.HTTP_AUTH_SCHEME.getKey());
	request.addHeader(resolveAuthHeader(authScheme));
	LOG.debug("<< getNewRequest(..): returning a new HTTP '{}' request with target endpoint "
			+ "'{}' and headers '{}'", reqMethod, request.getURI(), request.getAllHeaders());
	return request;
}
 
开发者ID:Roxas240,项目名称:CryptoPayAPI,代码行数:21,代码来源:SimpleHttpClientImpl.java

示例11: getMembersInGroup

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a list of members (represented by {@link Subscription}) subscribed
 * to a particular group.
 * 
 * @param groupId
 *            - which group to get members from
 * @return {@link List}<{@link Subscription}> representing the subscribed
 *         members
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public List<Subscription> getMembersInGroup(final Integer groupId) throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getViewMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getmembers");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("limit", MAX_RESULTS);
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        Page page = callApi(request, Page.class);
        final List<Subscription> subscriptions = Arrays.asList(OM.convertValue(page.getData(), Subscription[].class));
        
        while (page.getHasMore())
        {
            uri.setParameter("page_token", page.getNextPageToken().toString());
            request.setURI(uri.build());
            page = callApi(request, Page.class);
            subscriptions.addAll(Arrays.asList(OM.convertValue(page.getData(), Subscription[].class)));
        }
        
        return subscriptions;
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:43,代码来源:MemberResource.java

示例12: searchMembers

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a list of members (represented by {@link Subscription}) subscribed
 * to a particular group.
 * 
 * @param groupId
 *            - which group to get members from
 * @param query
 *            - what to search for (will search over email or name)
 * @return {@link List}<{@link Subscription}> representing the subscribed
 *         members
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public List<Subscription> searchMembers(final Integer groupId, final String query)
        throws URISyntaxException, IOException, GroupsIOApiException
{
    if (apiClient.group().getPermissions(groupId).getViewMembers())
    {
        final URIBuilder uri = new URIBuilder().setPath(baseUrl + "searchmembers");
        uri.setParameter("group_id", groupId.toString());
        uri.setParameter("q", query);
        uri.setParameter("limit", MAX_RESULTS);
        final HttpRequestBase request = new HttpGet();
        request.setURI(uri.build());
        
        Page page = callApi(request, Page.class);
        final List<Subscription> subscriptions = Arrays.asList(OM.convertValue(page.getData(), Subscription[].class));
        
        while (page.getHasMore())
        {
            uri.setParameter("page_token", page.getNextPageToken().toString());
            request.setURI(uri.build());
            page = callApi(request, Page.class);
            subscriptions.addAll(Arrays.asList(OM.convertValue(page.getData(), Subscription[].class)));
        }
        
        return subscriptions;
    }
    else
    {
        final Error error = new Error();
        error.setType(GroupsIOApiExceptionType.INADEQUATE_PERMISSIONS);
        throw new GroupsIOApiException(error);
    }
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:47,代码来源:MemberResource.java

示例13: getPermissions

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Gets a user's {@link Permissions} for the specified group ID
 * 
 * @return the user's {@link Permissions} for the specified group ID
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public Permissions getPermissions(final Integer groupId) throws URISyntaxException, IOException, GroupsIOApiException
{
    final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getperms");
    uri.setParameter("group_id", groupId.toString());
    final HttpRequestBase request = new HttpGet();
    request.setURI(uri.build());
    
    return callApi(request, Permissions.class);
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:18,代码来源:GroupResource.java

示例14: getUser

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
/**
 * Get the user information associated with the currently-logged in user.
 * 
 * @return {@link User} representing the current user
 * @throws URISyntaxException
 * @throws IOException
 * @throws GroupsIOApiException
 */
public User getUser() throws URISyntaxException, IOException, GroupsIOApiException
{
    final URIBuilder uri = new URIBuilder().setPath(baseUrl + "getuser");
    final HttpRequestBase request = new HttpGet();
    request.setURI(uri.build());
    
    return callApi(request, User.class);
}
 
开发者ID:lake54,项目名称:groupsio-api-java,代码行数:17,代码来源:UserResource.java

示例15: execute

import org.apache.http.client.methods.HttpRequestBase; //导入方法依赖的package包/类
@Override
public <T> T execute(final HttpRequestBase request, final ResponseHandler<T> responseHandler) throws IOException {
    if(StringUtils.isNotBlank(request.getURI().getRawQuery())) {
        request.setURI(URI.create(String.format("%s%s?%s", uri, request.getURI().getRawPath(), request.getURI().getRawQuery())));
    }
    else {
        request.setURI(URI.create(String.format("%s%s", uri, request.getURI().getRawPath())));
    }
    return super.execute(request, responseHandler);
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:11,代码来源:DAVClient.java


注:本文中的org.apache.http.client.methods.HttpRequestBase.setURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。