001package dev.openfunction.functions; 002 003/** 004 * An object that can route the specified http request to the specified function. 005 */ 006public abstract class Routable { 007 private static final String METHOD_DELETE = "DELETE"; 008 private static final String METHOD_HEAD = "HEAD"; 009 private static final String METHOD_GET = "GET"; 010 private static final String METHOD_PATCH = "PATCH"; 011 private static final String METHOD_POST = "POST"; 012 private static final String METHOD_PUT = "PUT"; 013 014 /** 015 * Get the supported http methods. 016 * 017 * @return The supported http methods. 018 */ 019 public String[] getMethods() { 020 return new String[]{METHOD_DELETE, METHOD_GET, METHOD_PATCH, METHOD_HEAD, METHOD_PUT, METHOD_POST}; 021 }; 022 023 /** 024 * Get the URI that will be routed. 025 * 026 * @return The URI that will be routed. 027 */ 028 public String getPath(){ 029 return "/"; 030 } 031}