本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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"));
}