public class ControlFilter
extends java.lang.Object
implements javax.servlet.Filter
Filter that provides service control.
Requests do not proceed unless the response to a call
Client.check(com.google.api.servicecontrol.v1.CheckRequest) succeeds. All calls are
'reported' via a call to Client.report(com.google.api.servicecontrol.v1.ReportRequest)| Constructor and Description |
|---|
ControlFilter() |
ControlFilter(Client client,
java.lang.String projectId,
com.google.common.base.Ticker ticker,
com.google.api.client.util.Clock clock,
com.google.api.client.http.HttpTransport transport) |
| Modifier and Type | Method and Description |
|---|---|
protected Client |
createClient(java.lang.String configServiceName)
A template method for constructing clients.
|
void |
destroy() |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain) |
void |
init(javax.servlet.FilterConfig filterConfig) |
protected void |
setProjectId(java.lang.String projectId)
A template method used while initializing the filter.
|
protected int |
statsLogFrequency() |
public ControlFilter(@Nullable
Client client,
@Nullable
java.lang.String projectId,
@Nullable
com.google.common.base.Ticker ticker,
@Nullable
com.google.api.client.util.Clock clock,
@Nullable
com.google.api.client.http.HttpTransport transport)
public ControlFilter()
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
init in interface javax.servlet.Filterjavax.servlet.ServletExceptionpublic void destroy()
destroy in interface javax.servlet.Filterprotected void setProjectId(java.lang.String projectId)
Subclasses of may override this method to customize how the project Id is determined
protected int statsLogFrequency()
protected Client createClient(java.lang.String configServiceName) throws java.security.GeneralSecurityException, java.io.IOException
Subclasses of may override this method to customize how the client get's built. Note that this
method is intended to be invoked by init(FilterConfig) when the
serviceName parameter is provided. If that parameter is missing, this function will not be
called and the client will not be constructed.
configServiceName - the service name to use in constructing the clientClientjava.security.GeneralSecurityException - indicates that client was not created successfullyjava.io.IOException - indicates that the client was not created successfullypublic void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
doFilter in interface javax.servlet.Filterjava.io.IOExceptionjavax.servlet.ServletException