Package org.mockserver.mock
Class HttpState
- java.lang.Object
-
- org.mockserver.mock.HttpState
-
public class HttpState extends Object
- Author:
- jamesdbloom
-
-
Field Summary
Fields Modifier and Type Field Description static StringLOG_SEPARATORstatic StringPATH_PREFIX
-
Constructor Summary
Constructors Constructor Description HttpState(Configuration configuration, MockServerLogger mockServerLogger, Scheduler scheduler)
-
Method Summary
-
-
-
Field Detail
-
LOG_SEPARATOR
public static final String LOG_SEPARATOR
-
PATH_PREFIX
public static final String PATH_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
HttpState
public HttpState(Configuration configuration, MockServerLogger mockServerLogger, Scheduler scheduler)
-
-
Method Detail
-
setPort
public static void setPort(HttpRequest request)
-
setPort
public static void setPort(Integer port)
-
setPort
public static void setPort(Integer... port)
-
getPort
public static Integer getPort()
-
getGrpcDescriptorStore
public GrpcProtoDescriptorStore getGrpcDescriptorStore()
-
getFileStore
public FileStore getFileStore()
-
getCrudDispatcher
public CrudDispatcher getCrudDispatcher()
-
getControlPlaneAuthenticationHandler
public AuthenticationHandler getControlPlaneAuthenticationHandler()
-
setControlPlaneAuthenticationHandler
public void setControlPlaneAuthenticationHandler(AuthenticationHandler controlPlaneAuthenticationHandler)
-
getConfiguration
public Configuration getConfiguration()
-
getMockServerLogger
public MockServerLogger getMockServerLogger()
-
clear
public void clear(HttpRequest request)
-
reset
public void reset()
-
add
public List<Expectation> add(OpenAPIExpectation openAPIExpectation)
-
add
public List<Expectation> add(Expectation... expectations)
-
firstMatchingExpectation
public Expectation firstMatchingExpectation(RequestDefinition request)
-
firstMatchingEarlyExpectation
public Expectation firstMatchingEarlyExpectation(HttpRequest headersOnly)
Returns the first expectation whose matcher has respondBeforeBody=true, has no body matcher, and matches the supplied headers-only request. Used by the early-response path that runs before the request body is aggregated.
-
allMatchingExpectation
public List<Expectation> allMatchingExpectation(HttpRequest request)
-
postProcess
public void postProcess(Expectation expectation)
-
findClosestMatchDiff
public Map<MatchDifference.Field,List<String>> findClosestMatchDiff(HttpRequest request)
-
debugMismatch
public HttpResponse debugMismatch(HttpRequest request)
-
explainUnmatched
public HttpResponse explainUnmatched(HttpRequest request)
Retrieves recent requests that matched no expectation and, for each, computes ranked closest-expectation diagnostics with remediation hints.- Parameters:
request- the control-plane request (body may contain{"limit":N})- Returns:
- a JSON response containing an array of unmatched requests with diagnostics
-
log
public void log(LogEntry logEntry)
-
retrieve
public HttpResponse retrieve(HttpRequest request)
-
verify
public Future<String> verify(Verification verification)
-
verify
public void verify(Verification verification, Consumer<String> resultConsumer)
-
verify
public Future<String> verify(VerificationSequence verification)
-
verify
public void verify(VerificationSequence verificationSequence, Consumer<String> resultConsumer)
-
handle
public boolean handle(HttpRequest request, ResponseWriter responseWriter, boolean warDeployment)
-
getWebSocketClientRegistry
public WebSocketClientRegistry getWebSocketClientRegistry()
-
getRequestMatchers
public RequestMatchers getRequestMatchers()
-
getMockServerLog
public MockServerEventLog getMockServerLog()
-
getScheduler
public Scheduler getScheduler()
-
getUniqueLoopPreventionHeaderName
public String getUniqueLoopPreventionHeaderName()
-
getUniqueLoopPreventionHeaderValue
public String getUniqueLoopPreventionHeaderValue()
-
stop
public void stop()
-
-