public class DefaultHARequestURIRewriter extends Object implements IHARequestURIRewriter
Constructor and Description |
---|
DefaultHARequestURIRewriter() |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Destroy the policy (stop any asynchronous processing, release any
resources).
|
void |
init(javax.servlet.ServletConfig servletConfig,
IIndexManager indexManager)
Initialize the policy.
|
StringBuilder |
rewriteURI(boolean isLeaderRequest,
String full_prefix,
String originalRequestURL,
String proxyToRequestURL,
javax.servlet.http.HttpServletRequest request)
Rewrite the
originalRequestURI into a Request-URL for the web application whose servlet context root is
given by the proxyToRequestURI . |
public void init(javax.servlet.ServletConfig servletConfig, IIndexManager indexManager) throws javax.servlet.ServletException
This implementation is a NOP.
init
in interface IHAPolicyLifeCycle
javax.servlet.ServletException
public void destroy()
This implementation is a NOP.
destroy
in interface IHAPolicyLifeCycle
public StringBuilder rewriteURI(boolean isLeaderRequest, String full_prefix, String originalRequestURL, String proxyToRequestURL, javax.servlet.http.HttpServletRequest request)
IHARequestURIRewriter
originalRequestURI
into a Request-URL for the web application whose servlet context root is
given by the proxyToRequestURI
.
Note: The proxyToRequestURI
is include the protocol, host,
port, and servlet context path for the target service. It DOES NOT
include any information from the original request. The purpose of this
method is to modify the originalRequestURI
in order to
obtain a fully qualified RequestURI for the service to which the request
will be proxied. For example:
full_prefix: /bigdata/LBS/leader -or- full_prefix: /bigdata/LBS/read originalRequestURI: http://ha1.example.com:8090/bigdata/LBS/read/sparql proxyToRequestURI: http://ha3.example.com:8090/bigdata/ return: http://ha2.example.com:8090/bigdata/LBS/read/sparql
Note: this method is only invoked if we will proxy to another service.
Therefore, the proxyToRequestURI
is never null
.
rewriteURI
in interface IHARequestURIRewriter
isLeaderRequest
- true
iff the request is directed to the leader.full_prefix
- The path prefix in the originalRequestURI
that
which corresponds to the HALoadBalancerServlet
and
which must be removed if the request is to be forwarded to a
local service.originalRequestURL
- The original Request-URL from the HTTP Request-LineproxyToRequestURL
- The RequestURI for the root of the web application for the
target service and never null
.request
- The original request.proxyToRequestURI
ServiceScore.getRequestURI()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.