Package org.apache.jmeter.protocol.http.proxy

# Class HttpRequestHdr

java.lang.Object
org.apache.jmeter.protocol.http.proxy.HttpRequestHdr

public class HttpRequestHdr extends Object
The headers of the client HTTP request.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CONTENT_LENGTH`
`static final String`
`CONTENT_TYPE`

## Constructor Summary

Constructors
Constructor
Description
`HttpRequestHdr()`
`HttpRequestHdr(String httpSamplerName)`
`HttpRequestHdr(String prefix, String httpSamplerName)`
`HttpRequestHdr(String prefix, String httpSamplerName, int httpSampleNameMode, String format)`

## Method Summary

Modifier and Type
Method
Description
`String`
`getContentType()`
`String`
`getFirstLine()`
`HeaderManager`
`getHeaderManager()`
`String`
`getHttpSampleNameFormat()`
`int`
`getHttpSampleNameMode()`
`String`
`getHttpSamplerName()`
`String`
`getMethod()`
Returns the method string extracted from the first line of the client request.
`MultipartUrlConfig`
`getMultipartConfig(String contentType)`
`String`
`getPath()`
Find the /some/file.xxxx from http://server.ect:PORT/some/file.xxx
`String`
`getPrefix()`
`String`
`getProtocol(HTTPSamplerBase sampler)`
`byte[]`
`getRawPostData()`
`String`
`getUrl()`
Returns the url string extracted from the first line of the client request.
`String`
`getUrlWithoutQuery(URL url)`
`boolean`
`isDetectGraphQLRequest()`
Return true if automatic GraphQL Request detection is enabled.
`byte[]`
`parse(InputStream in)`
Parses a http header from a stream.
`String`
`serverName()`
Find the //server.name from an url.
`int`
`serverPort()`
Find the :PORT from http://server.ect:PORT/some/file.xxx
`void`
`setDetectGraphQLRequest(boolean detectGraphQLRequest)`
Sets whether automatic GraphQL Request detection is enabled.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CONTENT_TYPE

public static final String CONTENT_TYPE

See Also:
  - Constant Field Values

### CONTENT_LENGTH

public static final String CONTENT_LENGTH

See Also:
  - Constant Field Values

## Constructor Details

### HttpRequestHdr

public HttpRequestHdr()

### HttpRequestHdr

public HttpRequestHdr(String httpSamplerName)

Parameters:
  `httpSamplerName` - the http sampler name

### HttpRequestHdr

public HttpRequestHdr(String prefix, String httpSamplerName)

Parameters:
  `prefix` - Sampler prefix
  `httpSamplerName` - the http sampler name

### HttpRequestHdr

public HttpRequestHdr(String prefix, String httpSamplerName, int httpSampleNameMode, String format)

Parameters:
  `prefix` - Sampler prefix
  `httpSamplerName` - the http sampler name
  `httpSampleNameMode` - the naming mode of sampler name
  `format` - format to use when mode is 3

## Method Details

### isDetectGraphQLRequest

public boolean isDetectGraphQLRequest()
Return true if automatic GraphQL Request detection is enabled.

Returns:
  true if automatic GraphQL Request detection is enabled

### setDetectGraphQLRequest

public void setDetectGraphQLRequest(boolean detectGraphQLRequest)
Sets whether automatic GraphQL Request detection is enabled.

Parameters:
  `detectGraphQLRequest` - whether automatic GraphQL Request detection is enabled

### parse

public byte[] parse(InputStream in) throws IOException
Parses a http header from a stream.

Parameters:
  `in` - the stream to parse.
Returns:
  array of bytes from client.
Throws:
  `IOException` - when reading the input stream fails

### getHeaderManager

public HeaderManager getHeaderManager()

### getContentType

public String getContentType()

### getMultipartConfig

public MultipartUrlConfig getMultipartConfig(String contentType)

### serverName

public String serverName()
Find the //server.name from an url.

Returns:
  server's internet name

### serverPort

public int serverPort()
Find the :PORT from http://server.ect:PORT/some/file.xxx

Returns:
  server's port (or UNSPECIFIED if not found)

### getPath

public String getPath()
Find the /some/file.xxxx from http://server.ect:PORT/some/file.xxx

Returns:
  the path

### getUrl

public String getUrl()
Returns the url string extracted from the first line of the client request.

Returns:
  the url

### getMethod

public String getMethod()
Returns the method string extracted from the first line of the client request.

Returns:
  the method (will always be upper case)

### getFirstLine

public String getFirstLine()

### getUrlWithoutQuery

public String getUrlWithoutQuery(URL url)

### getHttpSamplerName

public String getHttpSamplerName()

Returns:
  the httpSamplerName

### getRawPostData

public byte[] getRawPostData()

Returns:
  byte[] Raw post data

### getProtocol

public String getProtocol(HTTPSamplerBase sampler)

Parameters:
  `sampler` - `HTTPSamplerBase`
Returns:
  String Protocol (http or https)

### getPrefix

public String getPrefix()

Returns:
  the prefix or transaction name

### getHttpSampleNameMode

public int getHttpSampleNameMode()

Returns:
  the httpSampleNameMode

### getHttpSampleNameFormat

public String getHttpSampleNameFormat()