This microservice allows performing HTTP responses and receive HTTP requests.
Main configuration is done via setting following properties in a custom configuration:
- https - set protocol for communication,
true
if you want to usehttps
(false
by default) - port - port for HTTP requests (
80
by default) - sessionAlias - session alias for incoming/outgoing TH2 messages (e.g.
rest_api
) - threads - number of socket-processing threads
- terminationTime - the specified time to wait for the executors to close (
30
by default) - keystorePass - pass to open keystore for https connection
- sslProtocol - protocol for https connection (
TLSv1.3
by default) - keystorePath - path to new keystore (by default its using one from resources)
- keystoreType - type of keystore (
JKS
by default) - keyManagerAlgorithm - type of keystore algorithm (
SunX509
by default)
Please before production usage put your personal keystore in properties, its not safe to use default keystore, only purpose of default one is test
https: false
port: 334
sessionAlias: api_session
threads: 24
terminationTime: 30
keystorePass: some_https_store_pass
- input queue with
subscribe
andsend
attributes for responses - output queue with
publish
andfirst
(for responses) attributes - output queue with
publish
andsecond
(for requests) attributes
This section describes messages received and by produced by the service
This service receives HTTP responses via MQ as MessageGroup
s containing one of:
- a single
RawMessage
containing response bodycontentType
properties in its metadata, which will be used in resulting request - a single
Message
withResponse
message type containing HTTP Response code, reason and aRawMessage
described above
If both Message
and RawMessage
contain code
and reason
values from Message
take precedence.
If none of them contain these values 200
and ok
will be used as code
and reason
values respectively
- Response
Field | Type | Description |
---|---|---|
code | String | HTTP code number (e.g. 200, 404, etc.) |
reason | String | Reason info (e.g ok, not found, etc.) |
headers | List<Header> | HTTP headers (e.g. Host, Content-Length, etc.) |
- Header
Field | Type | Description |
---|---|---|
name | String | HTTP header name |
value | String | HTTP header value |
HTTP requests and responses are sent via MQ as MessageGroup
s containing a single RawMessage
with a raw request or response.
RawMessage
also has uri
, method
, and contentType
properties set equal to URI, method, and content type of request
or code
and reason
for response type
Here's an example of infra-mgr
config required to deploy this service
apiVersion: th2.exactpro.com/v1
kind: Th2Box
metadata:
name: http-server
spec:
image-name: ghcr.io/th2-net/th2-conn-http-server
image-version: 0.2.0
custom-config:
https: false
port: 8080
sessionAlias: some_alias
threads: 24
type: th2-conn
pins:
- name: to_send
connection-type: mq
attributes:
- subscribe
- send
- group
- name: out_request
connection-type: mq
attributes:
- publish
- second
- raw
- name: out_response
connection-type: mq
attributes:
- publish
- first
- raw
-
keytool -keystore servertest -genkey -alias servertest -keyalg RSA
- to create servertest keystore -
keytool -export -alias servertest -storepass servertest -file servertest.cer -keystore servertest
- to export certificate file outside keystore -
keytool -import -file servertest.cer -alias servertest -keystore TestTrustStore
- to import certificate inside of trust store
- Vulnerability check dependency step
- Owasp vulnerabilities check
- th2-common ugrade to
3.44.2
- th2-bom upgrade to
4.2.0