Package org.apache.tomcat.util.http
Class Method
- java.lang.Object
-
- org.apache.tomcat.util.http.Method
-
public class Method extends java.lang.ObjectHTTP method constants and utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONNECTCONNECT method.static java.lang.StringCOPYCOPY method.static java.lang.StringDELETEDELETE method.static java.lang.StringGETGET method.static java.lang.StringHEADHEAD method.static java.lang.StringLOCKLOCK method.static java.lang.StringMKCOLMKCOL method.static java.lang.StringMOVEMOVE method.static java.lang.StringOPTIONSOPTIONS method.static java.lang.StringPATCHPATCH method.static java.lang.StringPOSTPOST method.static java.lang.StringPROPFINDPROPFIND method.static java.lang.StringPROPPATCHPROPPATCH method.static java.lang.StringPUTPUT method.static java.lang.StringTRACETRACE method.static java.lang.StringUNLOCKUNLOCK method.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbytesToString(byte[] buf, int start, int len)Provides optimised conversion from bytes to Strings for known HTTP methods.
-
-
-
Field Detail
-
GET
public static final java.lang.String GET
GET method.- See Also:
- Constant Field Values
-
POST
public static final java.lang.String POST
POST method.- See Also:
- Constant Field Values
-
PUT
public static final java.lang.String PUT
PUT method.- See Also:
- Constant Field Values
-
PATCH
public static final java.lang.String PATCH
PATCH method.- See Also:
- Constant Field Values
-
HEAD
public static final java.lang.String HEAD
HEAD method.- See Also:
- Constant Field Values
-
OPTIONS
public static final java.lang.String OPTIONS
OPTIONS method.- See Also:
- Constant Field Values
-
DELETE
public static final java.lang.String DELETE
DELETE method.- See Also:
- Constant Field Values
-
TRACE
public static final java.lang.String TRACE
TRACE method.- See Also:
- Constant Field Values
-
PROPFIND
public static final java.lang.String PROPFIND
PROPFIND method.- See Also:
- Constant Field Values
-
PROPPATCH
public static final java.lang.String PROPPATCH
PROPPATCH method.- See Also:
- Constant Field Values
-
MKCOL
public static final java.lang.String MKCOL
MKCOL method.- See Also:
- Constant Field Values
-
COPY
public static final java.lang.String COPY
COPY method.- See Also:
- Constant Field Values
-
MOVE
public static final java.lang.String MOVE
MOVE method.- See Also:
- Constant Field Values
-
LOCK
public static final java.lang.String LOCK
LOCK method.- See Also:
- Constant Field Values
-
UNLOCK
public static final java.lang.String UNLOCK
UNLOCK method.- See Also:
- Constant Field Values
-
CONNECT
public static final java.lang.String CONNECT
CONNECT method.- See Also:
- Constant Field Values
-
-
Method Detail
-
bytesToString
public static java.lang.String bytesToString(byte[] buf, int start, int len)Provides optimised conversion from bytes to Strings for known HTTP methods. The bytes are assumed to be an ISO-8859-1 encoded representation of an HTTP method. The method is not validated as being a token, but only valid HTTP method names will be returned.Doing it this way is ~10x faster than using MessageBytes.toStringType() saving ~40ns per request which is ~1% of the processing time for a minimal "Hello World" type servlet. For non-standard methods there is an additional overhead of ~2.5ns per request.
Pretty much every request ends up converting the method to a String so it is more efficient to do this straight away and always use Strings.
- Parameters:
buf- The byte buffer containing the HTTP method to convertstart- The first byte of the HTTP methodlen- The number of bytes to convert- Returns:
- The HTTP method as a String or
nullif the method is not recognised.
-
-