public abstract class GatewayServlet
extends javax.servlet.http.HttpServlet
ServiceRequests so that they can be fed into the
API Management machinery. It also is responsible for converting the resulting
ServiceResponse into an HTTP Servlet Response that is suitable for returning
to the caller.| Modifier and Type | Class and Description |
|---|---|
protected static class |
GatewayServlet.ServiceRequestPathInfo
Parsed service request path information.
|
| Constructor and Description |
|---|
GatewayServlet()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
doAction(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String action)
Generic handler for all types of http actions/verbs.
|
protected void |
doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected void |
doTrace(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp) |
protected String |
getApiKey(javax.servlet.http.HttpServletRequest request,
Map<String,String> queryParams)
Gets the API Key from the request.
|
protected abstract io.apiman.gateway.engine.IEngine |
getEngine()
Gets the engine - subclasses must implement this.
|
protected static GatewayServlet.ServiceRequestPathInfo |
parseServiceRequestPath(String pathInfo)
Parse a service request path from servlet path info.
|
protected static Map<String,String> |
parseServiceRequestQueryParams(String queryString)
Parses the query string into a map.
|
protected void |
readHeaders(io.apiman.gateway.engine.beans.ServiceRequest srequest,
javax.servlet.http.HttpServletRequest request)
Reads the inbound request headers from the request and sets them on
the
ServiceRequest. |
protected io.apiman.gateway.engine.beans.ServiceRequest |
readRequest(javax.servlet.http.HttpServletRequest request)
Reads a
ServiceRequest from information found in the inbound
portion of the http request. |
protected void |
writeError(javax.servlet.http.HttpServletResponse resp,
Throwable error)
Writes an error to the servlet response object.
|
protected void |
writeResponse(javax.servlet.http.HttpServletResponse response,
io.apiman.gateway.engine.beans.ServiceResponse sresponse)
Writes the service response to the HTTP servlet response object.
|
protected void doGet(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doGet in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionHttpServlet.doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)protected void doPost(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doPost in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionHttpServlet.doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)protected void doPut(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doPut in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionHttpServlet.doPut(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)protected void doDelete(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doDelete in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionHttpServlet.doDelete(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)protected void doOptions(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doOptions in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected void doHead(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doHead in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected void doTrace(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp)
throws javax.servlet.ServletException,
IOException
doTrace in class javax.servlet.http.HttpServletjavax.servlet.ServletExceptionIOExceptionprotected void doAction(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
String action)
req - resp - action - protected abstract io.apiman.gateway.engine.IEngine getEngine()
protected io.apiman.gateway.engine.beans.ServiceRequest readRequest(javax.servlet.http.HttpServletRequest request)
throws Exception
ServiceRequest from information found in the inbound
portion of the http request.request - the undertow http server requestServiceRequestIOExceptionExceptionprotected String getApiKey(javax.servlet.http.HttpServletRequest request, Map<String,String> queryParams)
request - the inbound requestqueryParams - the inbound request query paramsprotected void readHeaders(io.apiman.gateway.engine.beans.ServiceRequest srequest,
javax.servlet.http.HttpServletRequest request)
ServiceRequest.request - request - protected void writeResponse(javax.servlet.http.HttpServletResponse response,
io.apiman.gateway.engine.beans.ServiceResponse sresponse)
response - sresponse - protected void writeError(javax.servlet.http.HttpServletResponse resp,
Throwable error)
resp - error - protected static final GatewayServlet.ServiceRequestPathInfo parseServiceRequestPath(String pathInfo)
pathInfo - Copyright © 2015 JBoss, a division of Red Hat. All rights reserved.