本文整理汇总了Java中org.apache.cxf.jaxrs.impl.MetadataMap类的典型用法代码示例。如果您正苦于以下问题:Java MetadataMap类的具体用法?Java MetadataMap怎么用?Java MetadataMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataMap类属于org.apache.cxf.jaxrs.impl包,在下文中一共展示了MetadataMap类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newFindAllParameters
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
private UriInfo newFindAllParameters() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<>());
uriInfo.getQueryParameters().add("draw", "1");
uriInfo.getQueryParameters().add("start", "0");
uriInfo.getQueryParameters().add("length", "10");
uriInfo.getQueryParameters().add("columns[0][data]", "name");
uriInfo.getQueryParameters().add("order[0][column]", "0");
uriInfo.getQueryParameters().add("order[0][dir]", "asc");
return uriInfo;
}
示例2: newFindAllParameters
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
private UriInfo newFindAllParameters() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<>());
uriInfo.getQueryParameters().add("draw", "1");
uriInfo.getQueryParameters().add("start", "0");
uriInfo.getQueryParameters().add("length", "10");
uriInfo.getQueryParameters().add("columns[0][data]", "name");
uriInfo.getQueryParameters().add("order[0][column]", "0");
uriInfo.getQueryParameters().add("order[0][dir]", "desc");
return uriInfo;
}
示例3: getSearchSelect2
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@Test
public void getSearchSelect2() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<String, String>());
uriInfo.getQueryParameters().add("q", " S1 ");
Assert.assertEquals("S1", DataTableAttributes.getSearch(uriInfo));
}
示例4: getSearchDataTable
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@Test
public void getSearchDataTable() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<String, String>());
uriInfo.getQueryParameters().add(DataTableAttributes.SEARCH, " S1 ");
Assert.assertEquals("S1", DataTableAttributes.getSearch(uriInfo));
}
示例5: getSearchDataTableToNull
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@Test
public void getSearchDataTableToNull() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<String, String>());
uriInfo.getQueryParameters().add(DataTableAttributes.SEARCH, " ");
Assert.assertTrue(DataTableAttributes.getSearch(uriInfo).length() == 0);
}
示例6: bindCamelHeadersToRequestHeaders
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
public MultivaluedMap<String, String> bindCamelHeadersToRequestHeaders(Map<String, Object> camelHeaders,
Exchange camelExchange)
throws Exception {
MultivaluedMap<String, String> answer = new MetadataMap<String, String>();
for (Map.Entry<String, Object> entry : camelHeaders.entrySet()) {
// Need to make sure the cxf needed header will not be filtered
if (headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), camelExchange)
&& camelToCxfHeaderMap.get(entry.getKey()) == null) {
LOG.trace("Drop Camel header: {}={}", entry.getKey(), entry.getValue());
continue;
}
// we need to make sure the entry value is not null
if (entry.getValue() == null) {
LOG.trace("Drop Camel header: {}={}", entry.getKey(), entry.getValue());
continue;
}
String mappedHeaderName = camelToCxfHeaderMap.get(entry.getKey());
if (mappedHeaderName == null) {
mappedHeaderName = entry.getKey();
}
LOG.trace("Propagate Camel header: {}={} as {}",
new Object[]{entry.getKey(), entry.getValue(), mappedHeaderName});
answer.putSingle(mappedHeaderName, entry.getValue().toString());
}
return answer;
}
示例7: testReadFrom
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@Test
public void testReadFrom() throws Exception {
DataFormatProvider<Book> p = new DataFormatProvider<Book>();
p.setFormat("text/plain", new TestDataFormat());
ByteArrayInputStream bis = new ByteArrayInputStream("dataformat".getBytes());
Book b = p.readFrom(Book.class, Book.class, new Annotation[] {}, MediaType.TEXT_PLAIN_TYPE,
new MetadataMap<String, String>(), bis);
assertEquals("dataformat", b.getName());
}
示例8: testWriteTo
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@Test
public void testWriteTo() throws Exception {
DataFormatProvider<Book> p = new DataFormatProvider<Book>();
p.setFormat("text/plain", new TestDataFormat());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
p.writeTo(new Book("dataformat"), Book.class, Book.class, new Annotation[] {},
MediaType.TEXT_PLAIN_TYPE, new MetadataMap<String, Object>(), bos);
assertEquals("dataformat", bos.toString());
}
示例9: createMap
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
@SuppressWarnings("unchecked")
protected MultivaluedMap<String, String> createMap(Class<?> clazz) throws Exception {
if (clazz == MultivaluedMap.class || clazz == Form.class) {
return new MetadataMap<String, String>();
}
return (MultivaluedMap<String, String>)clazz.newInstance();
}
示例10: addHeader
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
public void addHeader(Message message, String name, String value) {
HttpHeaders requestHeaders = new HttpHeadersImpl(message);
MultivaluedMap<String, String> newHeaders = new MetadataMap<String, String>();
newHeaders.putAll(requestHeaders.getRequestHeaders());
newHeaders.put(name, Arrays.asList(value));
message.put(Message.PROTOCOL_HEADERS, newHeaders);
}
示例11: newUriInfo
import org.apache.cxf.jaxrs.impl.MetadataMap; //导入依赖的package包/类
/**
* Return a new mocked {@link UriInfo} instance.
*
* @return a new mocked {@link UriInfo} instance.
*/
protected UriInfo newUriInfo() {
final UriInfo uriInfo = Mockito.mock(UriInfo.class);
Mockito.when(uriInfo.getQueryParameters()).thenReturn(new MetadataMap<String, String>());
return uriInfo;
}