You forgot to declare the package (i.e. the file path), and the class name (i.e. the file name), and the class definition so that the Verb you posted is chaperoned by a Noun.
Well, you'd have those things in any language. A route definition, some kind of namespace, a controller object implementing a method for the route, the last bit being what I posted code for. My point is: Java doesn't need to be worse than other languages in any of those things anymore.