eCAP adapter to modify href

Asked by Kunal

Is there any good optimum way to visit each href in the page and if needed modify the URL with eCAP adapter.

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

HTML "pages" are delivered through proxies using HTTP response bodies. An eCAP adapter has access to HTTP response bodies. Thus, the adapter can scan the "page" contents and replace href links (or anything else) in an HTTP response body. The modifying adapter sample contains simple code to do such a replacement, but production-quality code would be far more complex, of course.

The "good" and "optimal" adjectives in your question would need to be defined in some specific terms for others to be able to give any specific implementation hints. What is "good" and "optimal" for one application may be totally wrong for another!

There is not _simple_ way to do what you want though because any production-quality code would have to deal with content encodings, malformed HTML, and other complications.

Revision history for this message
Kunal (kmgkv1) said :
#2

Thanks for the information Alex!!
Well, I looked at the sample adapter code and did tried and debugged it. But to understand the API in more details I want to ask whether any document et al is available for the eCAP API.
I want to understand the sequence in which the eCAP api are called (interaction between host and ecap).

Revision history for this message
Alex Rousskov (rousskov) said :
#3

Currently, the following eCAP API documentation is available:

* http://e-cap.org/Documentation
* libecap source code comments
* libecap/doc/, starting with libecap v1.0
* libecap adapter samples: http://e-cap.org/Downloads
* Open source adapters: http://e-cap.org/Market

In general, it is somewhat wrong to think of eCAP API as a "sequence of calls". Your adapter must provide certain "services" to the host application. The host application may use those "services" (e.g., call adapter transaction methods) if and when it is convenient for the host application to do so. If you implement those methods correctly, without making too many assumptions about the timing of their call(s), your adapter should work.

You can use a debugger or add debugging output to your adapter to see when your particular host application calls your adapter, of course.

Can you help with this problem?

Provide an answer of your own, or ask Kunal for more information if necessary.

To post a message you must log in.