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.| 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 |
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 String |
getApiKey(javax.servlet.http.HttpServletRequest request)
Gets the API Key from the request.
|
protected String |
getApiKeyFromQuery(javax.servlet.http.HttpServletRequest request)
Gets the API key from the request's query string.
|
protected String |
getDestination(javax.servlet.http.HttpServletRequest request)
Returns the path to the resource.
|
protected abstract io.apiman.gateway.engine.IEngine |
getEngine()
Gets the engine - subclasses must implement this.
|
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.
|
doHead, doOptions, doTrace, getLastModified, service, serviceprotected 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 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)
request - the inbound requestprotected String getApiKeyFromQuery(javax.servlet.http.HttpServletRequest request)
request - the inbound requestprotected String getDestination(javax.servlet.http.HttpServletRequest request)
request - protected 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 - Copyright © 2014 JBoss, a division of Red Hat. All rights reserved.