|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsunlabs.brazil.handler.GenericProxyHandler
sunlabs.brazil.handler.ProxyPropertiesHandler
public class ProxyPropertiesHandler
Obtain properties format content from remote websites, and
add it to the current request properties.
Many of the handlers
are designed to produce side effects, by inserting values into the
request properties (see PropertiesHandler).
If they are instead configured to produce the properties
in java properties format, then this handler
will read their output, and place the result in the request object on
their behalf. This capability allows certain handlers to be run on
other web sites, yet behave as if they are in the handler chain.
The following request properties are used:
| Field Summary |
|---|
| Fields inherited from class sunlabs.brazil.handler.GenericProxyHandler |
|---|
host, HOST, mapper, NL, noErrorReturn, passHost, port, PORT, prefix, PREFIX, PROXY_HOST, PROXY_PORT, proxyHost, proxyPort, requestPrefix, tokens, urlPrefix |
| Constructor Summary | |
|---|---|
ProxyPropertiesHandler()
|
|
| Method Summary | |
|---|---|
boolean |
init(Server server,
String prefix)
Do one-time setup. |
byte[] |
modifyContent(Request request,
byte[] content)
Rewrite the links in an html file so they resolve correctly in proxy mode. |
boolean |
respond(Request request)
If this is one of "our" url's, fetch the document from the destination server, and return it as if it was local. |
protected boolean |
shouldFilter(MimeHeaders headers)
See if the content needs to be filtered Return "true" if "modifyContent" should be called |
| Methods inherited from class sunlabs.brazil.handler.GenericProxyHandler |
|---|
getMapper, isMine |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProxyPropertiesHandler()
| Method Detail |
|---|
public boolean init(Server server,
String prefix)
GenericProxyHandler
init in interface Handlerinit in class GenericProxyHandlerserver - The HTTP server that created this Handler.
Typical Handlers will use Server.props
to obtain run-time configuration information.prefix - The handlers name.
The string this Handler may prepend to all
of the keys that it uses to extract configuration information
from Server.props. This is set (by the Server
and ChainHandler) to help avoid configuration parameter
namespace collisions.
true if this Handler initialized
successfully, false otherwise. If
false is returned, this Handler
should not be used.
public boolean respond(Request request)
throws IOException
GenericProxyHandler
respond in interface Handlerrespond in class GenericProxyHandlerrequest - The Request object that represents the HTTP
request.
true if the request was handled. A request was
handled if a response was supplied to the client, typically
by calling Request.sendResponse() or
Request.sendError.
IOException - if there was an I/O error while sending the response to
the client. Typically, in that case, the Server
will (try to) send an error message to the client and then
close the client's connection.
The IOException should not be used to silently
ignore problems such as being unable to access some
server-side resource (for example getting a
FileNotFoundException due to not being able
to open a file). In that case, the Handler's
duty is to turn that IOException into a
HTTP response indicating, in this case, that a file could
not be found.
protected boolean shouldFilter(MimeHeaders headers)
shouldFilter in class GenericProxyHandlerheaders - mime headers for data to proxy
public byte[] modifyContent(Request request,
byte[] content)
GenericProxyHandler
modifyContent in class GenericProxyHandlerrequest - The original request to this "proxy"
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||