Package org.apache.tomcat.util.http
Class Method
- java.lang.Object
-
- org.apache.tomcat.util.http.Method
-
public class Method extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONNECTstatic java.lang.StringCOPYstatic java.lang.StringDELETEstatic java.lang.StringGETstatic java.lang.StringHEADstatic java.lang.StringLOCKstatic java.lang.StringMKCOLstatic java.lang.StringMOVEstatic java.lang.StringOPTIONSstatic java.lang.StringPATCHstatic java.lang.StringPOSTstatic java.lang.StringPROPFINDstatic java.lang.StringPROPPATCHstatic java.lang.StringPUTstatic java.lang.StringTRACEstatic java.lang.StringUNLOCK
-
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
- See Also:
- Constant Field Values
-
POST
public static final java.lang.String POST
- See Also:
- Constant Field Values
-
PUT
public static final java.lang.String PUT
- See Also:
- Constant Field Values
-
PATCH
public static final java.lang.String PATCH
- See Also:
- Constant Field Values
-
HEAD
public static final java.lang.String HEAD
- See Also:
- Constant Field Values
-
OPTIONS
public static final java.lang.String OPTIONS
- See Also:
- Constant Field Values
-
DELETE
public static final java.lang.String DELETE
- See Also:
- Constant Field Values
-
TRACE
public static final java.lang.String TRACE
- See Also:
- Constant Field Values
-
PROPFIND
public static final java.lang.String PROPFIND
- See Also:
- Constant Field Values
-
PROPPATCH
public static final java.lang.String PROPPATCH
- See Also:
- Constant Field Values
-
MKCOL
public static final java.lang.String MKCOL
- See Also:
- Constant Field Values
-
COPY
public static final java.lang.String COPY
- See Also:
- Constant Field Values
-
MOVE
public static final java.lang.String MOVE
- See Also:
- Constant Field Values
-
LOCK
public static final java.lang.String LOCK
- See Also:
- Constant Field Values
-
UNLOCK
public static final java.lang.String UNLOCK
- See Also:
- Constant Field Values
-
CONNECT
public static final java.lang.String CONNECT
- 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.
-
-