Class HttpUtils

java.lang.Object
org.apache.juneau.rest.common.utils.HttpUtils

public class HttpUtils extends Object
HTTP utilities.
  • Method Details

    • detectHttpMethod

      public static String detectHttpMethod(Method m, boolean detectMethod, String def)
      Given a method name, infers the REST method name.
      Parameters:
      m - The Java method. Must not be null.
      detectMethod - Whether we should auto-detect the HTTP method name from the Java method name.
      def - The default HTTP method if not detected. Can be null.
      Returns:
      The REST method name, or def (which can be null) if not detected.
    • detectHttpPath

      public static String detectHttpPath(Method m, String method)
      Given a Java method, infers the REST path.
      Parameters:
      m - The Java method. Must not be null.
      method - The HTTP method name if it's known. Can be null, in which case the path is inferred from Java method naming conventions.
      Returns:
      The REST path. Never null (falls back to '/' + methodName when no convention matches).