Topic
  • 4 replies
  • Latest Post - ‏2013-04-16T15:32:36Z by Alessandro.Damiani
SystemAdmin
SystemAdmin
445 Posts

Pinned topic [ICN 2.0.1] - Problem determining right action to apply filter

‏2013-04-03T12:31:53Z |
Hi,
this is a question related to a specific problem, but also a general best practice question.

I am running ICN 2.0.1 towards IBM Content Manager 8.4.3

I am developing a series of Request/ResponseFilter plugins, to manipulate and enrich/filter the data that is shown in ICN when the user performs searches or browses folders.

I have been able to successfully intercept the JSON payloads and manipulate them for the search and browse functionalities, but I am having trouble applying a filter when the user opens a folder from within the search results.

I don't understand which "filteredServices" my plugin should be applied to, in order to intercept both the Request and Response payloads for that event.
I tried "cm/openFolder", "cm/openItem", "cm/openContentClass", but without real results. All these paths actually get my filter triggered, when the user opens the folder from within the search results, but the filter doesn't receive any JSON, and thus is unable to operate.

So, my specific question is... Which is the correct service to filter, to trap that particular event?
And, in general, which is the best way to determine which services are being called during ICN use?

I hope this all makes sense, if something isn't clear in my description, please tell me and I'll detail it further.

Thanks in advance!
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: [ICN 2.0.1] - Problem determining right action to apply filter

    ‏2013-04-03T13:17:05Z  
    This post is to add a little detail to my previous one, to avoid confusion, I am sorry for spamming right after posting the first one.

    What I was trying to explain is that I need to be able to work on the JSON object for BOTH the request and response, for the action of opening a folder from within search results.
    Up to now I have only been able to intercept the JSON object in the response phase, by filtering the "cm/openFolder" service, but I haven't been able to find the JSON object in the request phase (the first I tried was of course a request filter plugin on "cm/openFolder", but then I got desperate and tried the other services listed in my previous post).
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: [ICN 2.0.1] - Problem determining right action to apply filter

    ‏2013-04-03T16:48:35Z  
    This post is to add a little detail to my previous one, to avoid confusion, I am sorry for spamming right after posting the first one.

    What I was trying to explain is that I need to be able to work on the JSON object for BOTH the request and response, for the action of opening a folder from within search results.
    Up to now I have only been able to intercept the JSON object in the response phase, by filtering the "cm/openFolder" service, but I haven't been able to find the JSON object in the request phase (the first I tried was of course a request filter plugin on "cm/openFolder", but then I got desperate and tried the other services listed in my previous post).
    You are trapping the right request - "cm/openFolder". That openFolder in the search results is exactly the same call as you opening a folder in the browse feature pane. And you should be able to apply a request or a response filter to that. For a request filter, there aren't any JSON object, you only get the request parameters being passed in. You can look up ContentItem.retrieveFolderContents to see that only a few parameters are passed in:

    var params = {
    repositoryId: this.repository.id,
    docid: this.id,
    workspaceId: this._teamspaceId,
    filter_type: filterType,
    name: this.name
    };

    You access these parameters via request.getParameter(). The request filter allows you to modify these parameters or completely redirect who should handle the request. It is triggered before ICN's mid-tier services accepts it.

    Hopefully that answers your question.
  • SystemAdmin
    SystemAdmin
    445 Posts

    Re: [ICN 2.0.1] - Problem determining right action to apply filter

    ‏2013-04-03T16:49:45Z  
    And the best way to determine the right filteredServices call to make is to fire up a javascript debugger and watch the XHR request going across. The other way is to find the actual request call in javascript and look it up in the struts-config.xml inside WEB-INF.
  • Alessandro.Damiani
    Alessandro.Damiani
    59 Posts

    Re: [ICN 2.0.1] - Problem determining right action to apply filter

    ‏2013-04-16T15:32:36Z  

    Thanks a lot Arron, this definitely answers my question, and I've been able to modify the request parameters as needed.