public class ServerRelativeArchivalRedirect extends AbstractRequestHandler
ServerRelativeArchivalRedirect
is a RequestHandler
that redirects leaked server-relative URL back to replay request
URL.
For example, assuming Referer
is
http://web.archive.org/web/20010203040506/http://example.com/index.html
,
it redirects request http://web.archive.org/js/foo.js
to http://web.archive.org/web/20010203040506/http://example.com/js/foo.js
.
It is typically set up as catch-all RequestHandler
Constructor and Description |
---|
ServerRelativeArchivalRedirect() |
Modifier and Type | Method and Description |
---|---|
String |
getMatchHost() |
int |
getMatchPort() |
String |
getReplayPrefix() |
boolean |
handleRequest(javax.servlet.http.HttpServletRequest httpRequest,
javax.servlet.http.HttpServletResponse httpResponse)
Possibly handle an incoming HttpServletRequest, much like a normal
HttpServlet, but includes a return value.
|
boolean |
isUseCollection() |
protected String |
modifyCollection(String collection)
modify collection if necessary.
|
void |
setMatchHost(String matchHost)
optional host name
Referer URL should match. |
void |
setMatchPort(int matchPort)
optional port number
Referer URL should match. |
void |
setReplayPrefix(String replayPrefix)
optional replay URL prefix used by fallback method.
|
void |
setUseCollection(boolean useCollection)
whether replay URL has collection part.
|
getAccessPointPath, getBeanName, getInternalPort, getMapParam, getMapParamOrEmpty, getRequiredMapParam, getServletContext, registerPortListener, setAccessPointPath, setBeanName, setInternalPort, setServletContext, translateRequestPath, translateRequestPathQuery
protected String modifyCollection(String collection)
default implementation simply return collection
.
collection
- (the first path component of Referer URL.)
note value has leading slash, which must be retained.public boolean handleRequest(javax.servlet.http.HttpServletRequest httpRequest, javax.servlet.http.HttpServletResponse httpResponse) throws javax.servlet.ServletException, IOException
RequestHandler
httpRequest
- the incoming HttpServletRequesthttpResponse
- the HttpServletResponse to return data to the client.javax.servlet.ServletException
- for usual reasons.IOException
- for usual reasons.public boolean isUseCollection()
public void setUseCollection(boolean useCollection)
set this to true
if replay URL has collection
part, path component between context path and timestamp (although
it's called collection based on the common usage of this part,
there's no need to have particular semantics.)
collection part will be passed to modifyCollection(String)
before constructing final replay URL to redirect to.
useCollection
- the useCollection to setpublic String getMatchHost()
public void setMatchHost(String matchHost)
Referer
URL should match.matchHost
- the matchHost to setpublic int getMatchPort()
public void setMatchPort(int matchPort)
Referer
URL should match.matchPort
- the matchPort to setpublic String getReplayPrefix()
public void setReplayPrefix(String replayPrefix)
replayPrefix
- the replayPrefix to setCopyright © 2005–2015 IIPC. All rights reserved.