Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public final class AntPathRequestMatcher

  1. Object
  2. AntPathRequestMatcher

ImplementsRequestMatcher

Matches a request’s path against an Ant-style pattern, and optionally its method.

  • ? is one character and * any run of characters within one segment: /files/*.txt.
  • ** is any number of whole segments, none included: /api/** matches /api, /api/ and /api/users/7.
  • {name} is one segment, or the rest of one, bound to that name: /users/{id}.

The path compared is the one the routers compare – the query removed and percent-escapes of unreserved characters resolved – so a request cannot be spelled to match a rule here and a different route there. Matching is case sensitive, as routing is, and a trailing slash is part of the path.

Constructors

public AntPathRequestMatcher(String pattern)
public AntPathRequestMatcher(String pattern, String method)

Methods

public static AntPathRequestMatcher antMatcher(String pattern)A matcher for pattern, any method.
public static AntPathRequestMatcher antMatcher(String method, String pattern)A matcher for pattern and one method, written as HTTP writes it: POST.
public String getPattern()
public boolean matches(HttpServer.Request request)
public RequestMatcher.MatchResult matcher(HttpServer.Request request)The match with the variables it bound: {id} in a path pattern.
public String toString()Returns a string representation of the object.

Inherited nested types

Inherited methods

Constructor details

AntPathRequestMatcher

public AntPathRequestMatcher(String pattern)

AntPathRequestMatcher

public AntPathRequestMatcher(String pattern, String method)

Parameters

pattern String
Not documented.
method String
the method to match exactly, or null for any

Method details

antMatcher

public static AntPathRequestMatcher antMatcher(String pattern)
A matcher for pattern, any method.

antMatcher

public static AntPathRequestMatcher antMatcher(String method, String pattern)
A matcher for pattern and one method, written as HTTP writes it: POST.

getPattern

public String getPattern()

matches

public boolean matches(HttpServer.Request request)

matcher

public RequestMatcher.MatchResult matcher(HttpServer.Request request)
The match with the variables it bound: {id} in a path pattern.

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())