Package org.openhab.binding.http

Examples of org.openhab.binding.http.HttpBindingProvider


   * @param command the executed command or one of the virtual commands
   * (see {@link HttpGenericBindingProvider})
   * @param value the value to be used by the String.format method
   */
  private void formatAndExecute(String itemName, Command command, Type value) {
    HttpBindingProvider provider =
      findFirstMatchingBindingProvider(itemName, command);
   
    if (provider == null) {
      logger.trace("doesn't find matching binding provider [itemName={}, command={}]", itemName, command);
      return;
    }
   
    String httpMethod =  provider.getHttpMethod(itemName, command);
    String url = provider.getUrl(itemName, command);
    url = String.format(url, Calendar.getInstance().getTime(), value);
   
    if (isNotBlank(httpMethod) && isNotBlank(url)) {
      HttpUtil.executeUrl(httpMethod, url, provider.getHttpHeaders(itemName, command), null, null, timeout);
    }
  }
View Full Code Here


   *
   * @return the matching binding provider or <code>null</code> if no binding
   * provider could be found
   */
  private HttpBindingProvider findFirstMatchingBindingProvider(String itemName, Command command) {
    HttpBindingProvider firstMatchingProvider = null;
   
    for (HttpBindingProvider provider : this.providers) {
      String url = provider.getUrl(itemName, command);
      if (url != null) {
        firstMatchingProvider = provider;
View Full Code Here

TOP

Related Classes of org.openhab.binding.http.HttpBindingProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.