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


Java ModuleFields类代码示例

本文整理汇总了Java中org.jboss.aerogear.android.pipe.module.ModuleFields的典型用法代码示例。如果您正苦于以下问题:Java ModuleFields类的具体用法?Java ModuleFields怎么用?Java ModuleFields使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ModuleFields类属于org.jboss.aerogear.android.pipe.module包,在下文中一共展示了ModuleFields类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHttpProvider

import org.jboss.aerogear.android.pipe.module.ModuleFields; //导入依赖的package包/类
private HttpProvider getHttpProvider(URI relativeUri) {
    final String queryString;

    ModuleFields fields = loadAuth(relativeUri, "GET");

    if (relativeUri == null || relativeUri.getRawQuery() == null) {
        queryString = "";
    } else {
        queryString = relativeUri.getRawQuery().toString();
    }

    URL mergedURL = UrlUtils.appendToBaseURL(baseURL, relativeUri.getRawPath());
    URL authorizedURL = addAuthorization(fields.getQueryParameters(), UrlUtils.appendQueryToBaseURL(mergedURL, queryString));

    final HttpProvider httpProvider = httpProviderFactory.get(authorizedURL, timeout);
    httpProvider.setDefaultHeader("Content-TYpe", requestBuilder.getContentType());
    addAuthHeaders(httpProvider, fields);
    return httpProvider;

}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:21,代码来源:RestRunner.java

示例2: loadModule

import org.jboss.aerogear.android.pipe.module.ModuleFields; //导入依赖的package包/类
@Override
public ModuleFields loadModule(URI uri, String method, byte[] contents) {
    ModuleFields fields = new ModuleFields();

    fields.addHeader(BackendPipes.Headers.PERSONA, persona.getId());
    fields.addHeader(BackendPipes.Headers.TENANT, persona.getId());

    return fields;
}
 
开发者ID:hawkular,项目名称:hawkular-android-client,代码行数:10,代码来源:BackendPersonnel.java

示例3: loadModule

import org.jboss.aerogear.android.pipe.module.ModuleFields; //导入依赖的package包/类
@Override
public final ModuleFields loadModule(URI relativeURI, String httpMethod, byte[] requestBody) {
    AuthorizationFields authzFields = getAuthorizationFields(relativeURI, httpMethod, requestBody);
    ModuleFields moduleFields = new ModuleFields();
    moduleFields.setHeaders(authzFields.getHeaders());
    moduleFields.setQueryParameters(authzFields.getQueryParameters());
    return moduleFields;
}
 
开发者ID:aerogear,项目名称:aerogear-android-authz,代码行数:9,代码来源:OAuth2AuthzModule.java

示例4: addAuthHeaders

import org.jboss.aerogear.android.pipe.module.ModuleFields; //导入依赖的package包/类
private void addAuthHeaders(HttpProvider httpProvider, ModuleFields fields) {
    List<Pair<String, String>> authHeaders = fields.getHeaders();

    for (Pair<String, String> header : authHeaders) {
        httpProvider.setDefaultHeader(header.first, header.second);
    }

}
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:9,代码来源:RestRunner.java

示例5: runReadWithFilter

import org.jboss.aerogear.android.pipe.module.ModuleFields; //导入依赖的package包/类
public void runReadWithFilter() throws Exception {

        final CountDownLatch latch = new CountDownLatch(1);

        HttpProviderFactory factory = mock(HttpProviderFactory.class);
        when(factory.get(anyObject())).thenReturn(mock(HttpProvider.class));

        ModuleFields authFields = new ModuleFields();

        PipeModule urlModule = mock(PipeModule.class);

        when(urlModule.loadModule((URI) anyObject(), (String) anyObject(), (byte[]) anyObject())).thenReturn(authFields);

        RestfulPipeConfiguration config = PipeManager.config("listClassId", RestfulPipeConfiguration.class).withUrl(url);
        config.module(urlModule);

        RestAdapter<Data> adapter = new RestAdapter<Data>(Data.class, url, config);
        Object restRunner = UnitTestUtils.getPrivateField(adapter, "restRunner");

        UnitTestUtils.setPrivateField(restRunner, "httpProviderFactory", factory);

        ReadFilter filter = new ReadFilter();
        filter.setLimit(10);
        filter.setWhere(new JSONObject("{\"model\":\"BMW\"}"));

        adapter.read(filter, new Callback<List<Data>>() {
            @Override
            public void onSuccess(List<Data> data) {
                latch.countDown();
            }

            @Override
            public void onFailure(Exception e) {
                latch.countDown();
                Logger.getLogger(getClass().getSimpleName()).log(Level.SEVERE, TAG, e);
            }
        });
        latch.await(500, TimeUnit.MILLISECONDS);

        verify(factory).get(new URL(url.toString() + "?limit=10&model=BMW"));
    }
 
开发者ID:aerogear,项目名称:aerogear-android-pipe,代码行数:42,代码来源:RestAdapterTest.java


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