Tabnine Logo
Handler
Code IndexAdd Tabnine to your IDE (free)

How to use
Handler
in
org.eclipse.smarthome.io.http

Best Java code snippets using org.eclipse.smarthome.io.http.Handler (Showing top 8 results out of 315)

origin: openhab/openhab-core

@Override
public int getPriority() {
  return delegate.getPriority();
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.http

@Override
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) {
  delegate.handleError(request, response, context);
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.http

@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
  if (cursor.hasNext()) {
    boolean hasError = hasError();
    Handler handler = new CatchHandler(cursor.next());
    if (hasError) {
      handler.handleError(request, response, this);
    } else {
      try {
        handler.handle(request, response, this);
      } catch (Exception e) {
        if (!hasError()) {
          error(e);
        } else {
          // this is major failure which couldn't be handled by catch handler, however we already
          // processing a fault, there is nothing we can do about that beyond marking occurrence of error.
          // It is definitely a fatality
          logger.error("Could not handle request", e);
        }
      }
    }
    if (!hasError && hasError()) {
      // we didn't have an error and we have it now, meaning a current handler reported issue.
      // so here reset cursor and restart execution forcing handleError method execution in reverse order.
      request.setAttribute(ERROR_ATTRIBUTE, error);
      cursor = handlers.descendingIterator();
      execute(request, response);
    }
  }
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.http

@Override
public void handle(HttpServletRequest request, HttpServletResponse response, HandlerContext context) {
  try {
    delegate.handle(request, response, context);
  } catch (Exception e) {
    if (!context.hasError()) {
      context.error(e);
    } else {
      logger.error("Could not handle exception thrown by delegate handler {}", delegate, e);
    }
  }
}
origin: openhab/openhab-core

@Override
public void execute(HttpServletRequest request, HttpServletResponse response) {
  if (cursor.hasNext()) {
    boolean hasError = hasError();
    Handler handler = new CatchHandler(cursor.next());
    if (hasError) {
      handler.handleError(request, response, this);
    } else {
      try {
        handler.handle(request, response, this);
      } catch (Exception e) {
        if (!hasError()) {
          error(e);
        } else {
          // this is major failure which couldn't be handled by catch handler, however we already
          // processing a fault, there is nothing we can do about that beyond marking occurrence of error.
          // It is definitely a fatality
          logger.error("Could not handle request", e);
        }
      }
    }
    if (!hasError && hasError()) {
      // we didn't have an error and we have it now, meaning a current handler reported issue.
      // so here reset cursor and restart execution forcing handleError method execution in reverse order.
      request.setAttribute(ERROR_ATTRIBUTE, error);
      cursor = handlers.descendingIterator();
      execute(request, response);
    }
  }
}
origin: openhab/openhab-core

@Override
public void handle(HttpServletRequest request, HttpServletResponse response, HandlerContext context) {
  try {
    delegate.handle(request, response, context);
  } catch (Exception e) {
    if (!context.hasError()) {
      context.error(e);
    } else {
      logger.error("Could not handle exception thrown by delegate handler {}", delegate, e);
    }
  }
}
origin: org.eclipse.smarthome.io/org.eclipse.smarthome.io.http

@Override
public int getPriority() {
  return delegate.getPriority();
}
origin: openhab/openhab-core

@Override
public void handleError(HttpServletRequest request, HttpServletResponse response, HandlerContext context) {
  delegate.handleError(request, response, context);
}
org.eclipse.smarthome.io.httpHandler

Javadoc

Handler which is responsible for processing request and response. This type is introduced to provide a unified way for injecting various logic on verification of requests sent via HTTP. Handlers are called before servlet who will receive request, thus they can not mutate servlet response, but they can generate its own response depending on actual needs. Pay attention to error handling - as a proper executions might report exceptions, but fault path handled in #handleError(HttpServletRequest,HttpServletResponse,HandlerContext)

Most used methods

  • getPriority
    Returns priority of this handler. Priority is any integer where 0 means earliest in the queue. The h
  • handle
    Method dedicated for processing incoming request and checking its contents.
  • handleError
    Method which is called only if any of #handle(HttpServletRequest,HttpServletResponse,HandlerContext)

Popular in Java

  • Finding current android device location
  • requestLocationUpdates (LocationManager)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • InputStreamReader (java.io)
    A class for turning a byte stream into a character stream. Data read from the source input stream is
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now