All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.server.resp.CacheRespRequestHandler Maven / Gradle / Ivy

There is a newer version: 15.1.4.Final
Show newest version
package org.infinispan.server.resp;

import org.infinispan.AdvancedCache;
import org.infinispan.commons.dataconversion.MediaType;

public class CacheRespRequestHandler extends RespRequestHandler {
   protected AdvancedCache cache;

   protected CacheRespRequestHandler(RespServer respServer) {
      super(respServer);
      setCache(respServer.getCache()
            .withMediaType(MediaType.APPLICATION_OCTET_STREAM, MediaType.APPLICATION_OCTET_STREAM));
   }

   public AdvancedCache cache() {
      return cache;
   }

   @SuppressWarnings("unchecked")
   public  AdvancedCache typedCache(MediaType valueMediaType) {
      AdvancedCache c = cache;
      if (cache.getValueDataConversion().getRequestMediaType().match(valueMediaType)) {
         return (AdvancedCache) c;
      }

      return cache.withMediaType(RespServer.RESP_KEY_MEDIA_TYPE, valueMediaType);
   }

   protected void setCache(AdvancedCache cache) {
      this.cache = cache;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy