Class HttpTransportUtils
java.lang.Object
com.mulesoft.connectors.mcp.internal.util.HttpTransportUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic org.mule.runtime.http.api.server.async.HttpResponseReadyCallbackafterSent(org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback, Runnable runnable) static Optional<InboundRequestContext>asInboundRequestContext(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message, String sessionId, org.mule.runtime.http.api.domain.request.HttpRequestContext requestContext) static InternalNewSessionRequestcreateNewSessionRequest(MuleServerSession session, org.mule.runtime.http.api.domain.request.HttpRequestContext requestContext) static voiddiscardAndClose(org.mule.runtime.http.api.domain.message.response.HttpResponse response) static StringnormalizePath(String path, String pathName) Normalizes thepathmaking sure it starts with a'/'static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessageparseMessageFromBody(org.mule.runtime.http.api.domain.entity.HttpEntity entity) static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessageparseMessageFromBody(org.mule.runtime.http.api.domain.message.request.HttpRequest request) static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessageparseMessageFromBody(org.mule.runtime.http.api.domain.message.response.HttpResponse response) static voidsendHttpInternalErrorResponse(Throwable t, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage originalMessage, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback) static voidsendHttpResponse(int statusCode, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message, org.mule.runtime.api.util.MultiMap<String, String> headers, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) static voidsendHttpResponse(int statusCode, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) static voidsendHttpResponse(int statusCode, String body, org.mule.runtime.api.util.MultiMap<String, String> headers, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) static voidsendHttpResponse(int statusCode, String body, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) static voidsendHttpResponse(org.mule.runtime.http.api.domain.message.response.HttpResponse response, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) static voidsendMessageEvent(org.mule.runtime.http.api.sse.server.SseClient client, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message) static voidsendMessageEvent(org.mule.runtime.http.api.sse.server.SseClient client, String eventType, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message) static voidsendMessageEvent(org.mule.runtime.http.api.sse.server.SseClient client, String eventType, String message)
-
Field Details
-
APPLICATION_JSON
- See Also:
-
TEXT_EVENT_STREAM
- See Also:
-
STREAMABLE_SESSION_ID_HEADER
- See Also:
-
-
Method Details
-
createNewSessionRequest
public static InternalNewSessionRequest createNewSessionRequest(MuleServerSession session, org.mule.runtime.http.api.domain.request.HttpRequestContext requestContext) -
asInboundRequestContext
public static Optional<InboundRequestContext> asInboundRequestContext(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message, String sessionId, org.mule.runtime.http.api.domain.request.HttpRequestContext requestContext) -
sendHttpResponse
public static void sendHttpResponse(int statusCode, String body, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) -
sendHttpResponse
-
sendHttpResponse
public static void sendHttpResponse(int statusCode, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) -
sendHttpResponse
-
sendHttpResponse
public static void sendHttpResponse(org.mule.runtime.http.api.domain.message.response.HttpResponse response, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback) -
sendHttpInternalErrorResponse
public static void sendHttpInternalErrorResponse(Throwable t, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage originalMessage, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback) -
sendMessageEvent
public static void sendMessageEvent(org.mule.runtime.http.api.sse.server.SseClient client, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message) -
sendMessageEvent
public static void sendMessageEvent(org.mule.runtime.http.api.sse.server.SseClient client, String eventType, io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage message) -
sendMessageEvent
-
discardAndClose
public static void discardAndClose(org.mule.runtime.http.api.domain.message.response.HttpResponse response) -
afterSent
public static org.mule.runtime.http.api.server.async.HttpResponseReadyCallback afterSent(org.mule.runtime.http.api.server.async.HttpResponseReadyCallback callback, Runnable runnable) -
normalizePath
Normalizes thepathmaking sure it starts with a'/'- Parameters:
path-pathName-- Returns:
-
parseMessageFromBody
public static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage parseMessageFromBody(org.mule.runtime.http.api.domain.message.request.HttpRequest request) throws IOException - Throws:
IOException
-
parseMessageFromBody
public static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage parseMessageFromBody(org.mule.runtime.http.api.domain.message.response.HttpResponse response) throws IOException - Throws:
IOException
-
parseMessageFromBody
public static io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage parseMessageFromBody(org.mule.runtime.http.api.domain.entity.HttpEntity entity) throws IOException - Throws:
IOException
-