org.apache.commons.collections.map.MultiValueMap Java Examples

The following examples show how to use org.apache.commons.collections.map.MultiValueMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpCachingFilter.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * This method sets the Age header.
 *
 * @param cachedResponse The cached response to be returned.
 * @param msgCtx         The messageContext.
 */
@SuppressWarnings("unchecked")
public static void setAgeHeader(CachableResponse cachedResponse,
                                org.apache.axis2.context.MessageContext msgCtx) {
    Map excessHeaders = new MultiValueMap();
    long responseCachedTime = cachedResponse.getResponseFetchedTime();
    long age = Math.abs((responseCachedTime - System.currentTimeMillis()) / 1000);
    excessHeaders.put(HttpHeaders.AGE, String.valueOf(age));

    msgCtx.setProperty(NhttpConstants.EXCESS_TRANSPORT_HEADERS, excessHeaders);
}
 
Example #2
Source File: CacheMediatorTest.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * Test case for setAgeHeader() method
 */
public void testSetAgeHeader() {
    CachableResponse cachedResponse = new CachableResponse();
    cachedResponse.setResponseFetchedTime(System.currentTimeMillis() - 3000);
    org.apache.axis2.context.MessageContext msgCtx = new org.apache.axis2.context.MessageContext();
    HttpCachingFilter.setAgeHeader(cachedResponse, msgCtx);
    Map excessHeaders = (MultiValueMap) msgCtx.getProperty(NhttpConstants.EXCESS_TRANSPORT_HEADERS);
    assertTrue(excessHeaders.get("Age") != null);
}
 
Example #3
Source File: AnimationComponent.java    From Project-16x16 with GNU General Public License v3.0 4 votes vote down vote up
public AnimationComponent() {
	sounds = new MultiValueMap();
}
 
Example #4
Source File: RoomIdUserIdRepository.java    From ChatServer with Artistic License 2.0 4 votes vote down vote up
public MultiValueMap getRoomIdUserIdMap() {
	return roomIdUserIdMap;
}
 
Example #5
Source File: DocumentGraphFactory.java    From baleen with Apache License 2.0 4 votes vote down vote up
private Map<String, Object> getGraphMetadata(JCas jCas) {

    Map<String, Object> variables = new HashMap<>();
    DocumentAnnotation da = UimaSupport.getDocumentAnnotation(jCas);

    setIfValue(variables, FIELD_DOCUMENT_TYPE, da.getDocType());
    setIfValue(variables, FIELD_DOCUMENT_SOURCE, da.getSourceUri());
    setIfValue(variables, FIELD_DOCUMENT_LANGUAGE, da.getLanguage());
    setIfValue(variables, FIELD_DOCUMENT_TIMESTAMP, new Date(da.getTimestamp()));

    setIfValue(variables, FIELD_DOCUMENT_CLASSIFICATION, da.getDocumentClassification());
    setIfListValue(
        variables, FIELD_DOCUMENT_CAVEATS, UimaTypesUtils.toList(da.getDocumentCaveats()));
    setIfListValue(
        variables,
        FIELD_DOCUMENT_RELEASABILITY,
        UimaTypesUtils.toList(da.getDocumentReleasability()));

    // Published Ids
    Collection<PublishedId> publishedIds = JCasUtil.select(jCas, PublishedId.class);
    if (!publishedIds.isEmpty()) {
      List<Map<String, String>> publishedList = new ArrayList<>();
      for (PublishedId pid : publishedIds) {
        Map<String, String> publishedId = new HashMap<>();
        publishedId.put(FIELD_PUBLISHEDIDS_ID, pid.getValue());
        publishedId.put(FIELD_PUBLISHEDIDS_TYPE, pid.getPublishedIdType());
        publishedList.add(publishedId);
      }
      variables.put(FIELD_PUBLISHEDIDS, publishedList);
    }

    // Meta data
    Collection<Metadata> selectedMeta = JCasUtil.select(jCas, Metadata.class);
    if (!selectedMeta.isEmpty()) {
      Map<String, List<Object>> metaMap = new HashMap<>();
      MultiValueMap multiMap = MultiValueMap.decorate(metaMap);
      for (Metadata metadata : selectedMeta) {
        multiMap.put(metadata.getKey(), metadata.getValue());
      }
      variables.put(FIELD_METADATA, metaMap);
    }
    setIfValue(variables, fields.getExternalId(), getDocumentId(jCas));

    return variables;
  }