Serializable
, javax.servlet.Servlet
, javax.servlet.ServletConfig
public class ProxyServlet extends GenericServlet
remoteServer
init parameter is not set, the servlet will
respond by sending a 500 Internal Server Error
response to the client.
If the configured remote server is down, or unreachable, the servlet will
respond by sending a 502 Bad Gateway
response to the client.
Otherwise, the response from the remote server will be tunneled unmodified
to the client.Modifier and Type | Field | Description |
---|---|---|
protected String |
remotePath |
Remote server "mount" path
|
protected int |
remotePort |
Remote server port
|
protected String |
remoteServer |
Remote server host name or IP address
|
Constructor | Description |
---|---|
ProxyServlet() |
Modifier and Type | Method | Description |
---|---|---|
protected void |
service(javax.servlet.http.HttpServletRequest pRequest,
javax.servlet.http.HttpServletResponse pResponse) |
Services a single request.
|
void |
service(javax.servlet.ServletRequest pRequest,
javax.servlet.ServletResponse pResponse) |
Override
service to use HTTP specifics. |
void |
setRemotePath(String pRemotePath) |
Called by
init to set the remote path. |
void |
setRemotePort(String pRemotePort) |
Called by
init to set the remote port. |
void |
setRemoteServer(String pRemoteServer) |
Called by
init to set the remote server. |
init
protected String remoteServer
protected int remotePort
protected String remotePath
public void setRemoteServer(String pRemoteServer)
init
to set the remote server. Must be a valid host
name or IP address. No default.pRemoteServer
- public void setRemotePort(String pRemotePort)
init
to set the remote port. Must be a number.
Default is 80
.pRemotePort
- public void setRemotePath(String pRemotePath)
init
to set the remote path. May be an empty string
for the root path, or any other valid path on the remote server.
Default is ""
.pRemotePath
- public final void service(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse) throws javax.servlet.ServletException, IOException
service
to use HTTP specifics.service
in interface javax.servlet.Servlet
service
in class javax.servlet.GenericServlet
pRequest
- pResponse
- javax.servlet.ServletException
IOException
service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
protected void service(javax.servlet.http.HttpServletRequest pRequest, javax.servlet.http.HttpServletResponse pResponse) throws javax.servlet.ServletException, IOException
pRequest
- pResponse
- javax.servlet.ServletException
IOException
Class descrition
Copyright © 2018. All rights reserved.