|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.ibm.wbi.protocol.http.FetchUrl
Used to fetch a URL specified by Proxy specific classes and using the proxy or socks server specified by the proxy configuration. There are a few different methods available, but they all accomplish pretty much the same thing. In order to make an HTTP request, we need a reference to the sublayer, an HTTP request header, and optionally some content (e.g., for a POST request).
The reference to the sublayer can be derived either from the RequestEvent or SystemContext. The RequestEvent is where this information once exclusively came from. Now the SystemContext is preferred because it is available everywhere (e.g., getSystemContext() is a method of Plugin) and at any time, not just while handling a request. Another reason that SystemContext is preferred is because the RequestEvent already contains an HTTP request, an input stream, and so-called transaction data (@see com.ibm.wbi.RequestInfo) -- so there is potential for confusion over whether these are utilized in the FetchUrl request (they are not). So in the interest of simplicity and clarity the new, non-deprecated API only supports the SystemContext argument.
Before the header code was updated (WBI4.4), the class HttpRequest was used to represent both a HTTP request header and (optional) content. In the new system, HttpRequestHeader is just that (a header), so we need to provide a place to include the content. Note that that the content can be null, and should be for all requests which do not use the POST or PUT methods. If just a URL is provided, then it is assumed to be a GET request, and the content is null. If content is provided, then the content-length header is set automatically.
The only other thing you need to think about is the first
boolean argument, which specifies whether the request should "go
through the wbi proxy". In other words, whether the request should
be subject to the same rule evaluation and Meg execution that a
normal browser request is. This often takes some thought,
especially if you don't want your Editors to run twice on the same
request. Sometimes it's desirable to set a flag to tell your Megs
to ignore the ancillary FetchUrl event. If you decide to do this,
recall that the transaction data associated with the current
RequestEvent is not passed to the FetchUrl request -- you
probably want to invent some HTTP header -- one of our favorites is
"x-
| Field Summary | |
static java.lang.String |
COPYRIGHT
|
| Constructor Summary | |
FetchUrl()
|
|
| Method Summary | |
static ServiceResult |
fetch(boolean thru_wbi,
SystemContext context,
HttpRequestHeader hReq,
byte[] content)
Make an HTTP request with HTTP request header and content. |
static ServiceResult |
fetch(boolean thru_wbi,
SystemContext context,
java.lang.String url)
Make an HTTP request to this URL. |
static ServiceResult |
fetch(RequestEvent event,
HttpRequest request)
Deprecated. Don't use HttpRequest object |
static ServiceResult |
fetch(RequestEvent event,
HttpRequestHeader hReq)
|
static ServiceResult |
fetch(RequestEvent event,
java.lang.String url)
Deprecated. @see #fetch(boolean, RequestEvent, String) |
static ServiceResult |
fetch(SystemContext context,
HttpRequest request)
Deprecated. Don't use HttpRequest object |
static ServiceResult |
fetch(SystemContext context,
HttpRequestHeader hReq)
|
static ServiceResult |
fetch(SystemContext context,
java.lang.String url)
Deprecated. @see #fetch(boolean, SystemContext, String) |
static ServiceResult |
fetchThroughProxy(RequestEvent event,
HttpRequest request)
Deprecated. Use fetch(true/false, ...) |
static ServiceResult |
fetchThroughProxy(RequestEvent event,
java.lang.String url)
Deprecated. Use fetch(true/false)... |
static ServiceResult |
fetchThroughProxy(SystemContext context,
HttpRequest request)
Deprecated. Use fetch(true/false, ...) |
static ServiceResult |
fetchThroughProxy(SystemContext context,
java.lang.String url)
Deprecated. Use fetch(true/false, ...) |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String COPYRIGHT
| Constructor Detail |
public FetchUrl()
| Method Detail |
public static ServiceResult fetch(boolean thru_wbi,
SystemContext context,
java.lang.String url)
throws java.io.IOException,
RequestRejectedException
thru_wbi - Whether to pass the request through WBIcontext - The system context (get from Plugin or Meg)url - The URL Request.java.io.IOException - If an error occurs.
public static ServiceResult fetch(boolean thru_wbi,
SystemContext context,
HttpRequestHeader hReq,
byte[] content)
throws java.io.IOException,
RequestRejectedException
thru_wbi - Whether to pass the request through WBIcontext - The system context (get from Plugin or Meg)hReq - The HTTP request headercontent - POST data (or null)java.io.IOException - If an error occurs.
public static ServiceResult fetch(RequestEvent event,
java.lang.String url)
throws java.io.IOException,
RequestRejectedException
event - This is the event that launched the MEG that is calling
this method.url - The URL Request.java.io.IOException - If an error occurs.
public static ServiceResult fetch(SystemContext context,
java.lang.String url)
throws java.io.IOException,
RequestRejectedException
context - The system context (get from Plugin or Meg)url - The URL Request.java.io.IOException - If an error occurs.
public static ServiceResult fetch(RequestEvent event,
HttpRequest request)
throws java.io.IOException,
RequestRejectedException
event - This is the event that launched the MEG that is calling
this method.request - The HttpRequest to make.java.io.IOException - If an error occurs.fetch(boolean, RequestEvent, HttpRequestHeader)
public static ServiceResult fetch(SystemContext context,
HttpRequest request)
throws java.io.IOException,
RequestRejectedException
context - The system context (get from Meg or Plugin)request - The HttpRequest to make.java.io.IOException - If an error occurs.
public static ServiceResult fetch(RequestEvent event,
HttpRequestHeader hReq)
throws java.io.IOException,
RequestRejectedException
public static ServiceResult fetch(SystemContext context,
HttpRequestHeader hReq)
throws java.io.IOException,
RequestRejectedException
public static ServiceResult fetchThroughProxy(RequestEvent event,
java.lang.String url)
throws java.io.IOException,
RequestRejectedException
event - This is the event that launched the MEG that is calling
this method.url - The URL for the request.java.io.IOException - If an error occurs.#fetch(boolean, RequestEvent, String)
public static ServiceResult fetchThroughProxy(SystemContext context,
java.lang.String url)
throws java.io.IOException,
RequestRejectedException
context - The system context (get from Plugin or Meg)url - The URL Request.java.io.IOException - If an error occurs.fetch(boolean, SystemContext, String)
public static ServiceResult fetchThroughProxy(RequestEvent event,
HttpRequest request)
throws java.io.IOException,
RequestRejectedException
event - This is the event that launched the MEG that is calling
this method.request - The HttpRequest object for the request.java.io.IOException - If an error occurs.#fetch(boolean, RequestEvent, String)
public static ServiceResult fetchThroughProxy(SystemContext context,
HttpRequest request)
throws java.io.IOException,
RequestRejectedException
context - The system context (get from Plugin or Meg)request - The HttpRequest object for the request.java.io.IOException - If an error occurs.fetch(boolean, SystemContext, String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||