private long getTimeout(WebletConfig config) { String cacheControlTimeout = config.getInitParameter("cachecontrol-timeout"); long timeout = WebletResourceloadingUtils.getNever(); if (!StringUtils.isBlank(cacheControlTimeout)) { try { timeout = Long.parseLong(cacheControlTimeout); } catch (RuntimeException ex) { Log log = LogFactory.getLog(this.getClass()); log.error("Weblets: Cache control is set but to an invalid value setting now never instead"); } } return timeout; }
/** * init method which is called by default to process the parameters * * @param config the webletconfig to be processed */ public void init(WebletConfig config) { super.init(config); // fetch the weblets init param String packageName = config.getInitParameter("package"); // fetch the resource root param String resourceRoot = config.getInitParameter("resourceRoot"); // String cacheTimeout = config.getInitParameter("cachecontrol-timeout"); // init param missing, lets throw an error if (packageName == null && resourceRoot == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } // the init was successful we now have all we need _resourceRoot = (packageName != null) ? packageName.replace('.', '/') : resourceRoot; // optional init param }
/** * init method which is called by default to process the parameters * * @param config the webletconfig to be processed */ public void init(WebletConfig config) { super.init(config); // fetch the weblets init param _packageName = config.getInitParameter("package"); // fetch the resource root param /*auto fix path according to the specs the root must begin with a leading /*/ _resourceRoot = config.getInitParameter("resourceRoot"); if (StringUtils.isBlank(_resourceRoot)) _resourceRoot = "/"; _resourceRoot = _resourceRoot.trim(); if (!_resourceRoot.startsWith("/") && !_resourceRoot.startsWith("\\")) _resourceRoot = "/" + _resourceRoot; // init param missing, lets throw an error if (_packageName == null && _resourceRoot == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } // the init was successful we now have all we need _resourceRoot = (_packageName != null) ? _packageName.replace('.', '/') : _resourceRoot; }
public void init(WebletConfig config) { super.init(config); String httpAddress = config.getInitParameter("rootaddress"); if (httpAddress == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } _resourceRoot = httpAddress; }
/** * init method which is called by default to process the parameters * * @param config * the webletconfig to be processed */ public void init(WebletConfig config) { super.init(config); _resourceRoot = config.getInitParameter("resourceRoot"); // init param missing, lets throw an error if (_resourceRoot == null) { throw new WebletException("Missing either init parameter \"package\" or " + " or init parameter \"resourceRoot\" for " + " Weblet \"" + config.getWebletName() + "\""); } }