com.ibm.wbi.protocol.http.beans
Class RedirectFollowEditor

com.ibm.wbi.Meg
  |
  +--com.ibm.wbi.Editor
        |
        +--com.ibm.wbi.protocol.http.HttpEditor
              |
              +--com.ibm.wbi.protocol.http.beans.RedirectFollowEditor

public class RedirectFollowEditor
extends HttpEditor

This editor Meg follows all redirects (HTTP 301 & 302 response codes) by using the FetchUrl API. It also determines the BASE url and fills in all relative links. This last step is necessary otherwise the base would be inferred incorrectly by the browser after a redirect.

Here are some cases where you might find this functionality useful: (a) you're writing a very simple lightweight browser and want some of the functionality to be implemented as a WBI plugin (b) you the client is down a slow link and you want to avoid the added latency of the round-trip incurred by the redirect.


Fields inherited from class com.ibm.wbi.protocol.http.HttpEditor
COPYRIGHT
 
Fields inherited from class com.ibm.wbi.Meg
EDITOR, GENERATOR, MONITOR, REQUEST_EDITOR, UNDEFINED
 
Constructor Summary
RedirectFollowEditor()
           
 
Method Summary
 void handleRequest(RequestEvent e)
          Handle the request by chasing all redirects RC = 301 or 302 and editing the links in the document to be absolute based upon either the BASE in the document or the inferred base of the current location (possibly the result of a redirect).
 
Methods inherited from class com.ibm.wbi.Editor
getType
 
Methods inherited from class com.ibm.wbi.Meg
forwardRequest, getCondition, getEnabled, getMegProperty, getMegProperty, getMegPropertyKeys, getName, getPlugin, getPriority, getSystemContext, initialize, initialize, isEnabled, isMegApplicable, loadMegResources, run, setCondition, setEnabled, setMegProperty, setName, setPriority, setSystemContext, setup, setup, setup, setup
 

Constructor Detail

RedirectFollowEditor

public RedirectFollowEditor()
Method Detail

handleRequest

public void handleRequest(RequestEvent e)
                   throws RequestRejectedException,
                          java.io.IOException
Handle the request by chasing all redirects RC = 301 or 302 and editing the links in the document to be absolute based upon either the BASE in the document or the inferred base of the current location (possibly the result of a redirect).
Overrides:
handleRequest in class HttpEditor
Following copied from class: com.ibm.wbi.protocol.http.HttpEditor
Parameters:
event - The request event with an input and output stream.
Throws:
RequestRejectedException - If rejecting request, this must be thrown before the first write() is made to the output stream.
java.io.Exception - can be thrown if an exception was generated by the Meg while processing the MegInput/OutputStreams.