Extension specific icons in nodes tree (reveiw request)

31 views
Skip to first unread message

Guifre Ruiz Utges

unread,
Jul 27, 2012, 9:35:33 AM7/27/12
to zaproxy...@googlegroups.com
Hello,

Simon suggested the idea of providing zap-extensions a mechanism to set their own icons to the nodes of the Sites Tree tab without having to modify the ZAP code. ZAP already supports setting icons. However, you have to modify the ZAP code if you want your extension to set its icon.

HistoryReference is currently instantiated as follows: HistoryReference(Session session, int historyType, HttpMessage msg)

To set a specific icon, you have to call the following constructor: HistoryReference(Session session, String iconURL, HttpMessage msg, boolean clear)

Where iconURL is the path to the icon (i.e. /resource/icon/10/whatever.png) and the clear variable is used to decide whether the icon has to be removed when manually visiting the node or not. There is no historyType in the constructor because it is used a specific one that will be later used in the SiteNode class to determine if a specific icon has to be used.

To accomplish this I had to modify the SiteNode, SiteMap and HistoryReference classes. The code can be found in at https://code.google.com/p/zaproxy/source/detail?r=1975

The only limitations are that no specific historyType can be set but I did not see any situation where this could be needed. The other one is that only one icon can be set in each historyRef.

Does that make sense? Any comment will be appreciated.

Best regards.

psiinon

unread,
Jul 30, 2012, 5:47:44 AM7/30/12
to zaproxy...@googlegroups.com
Hi Guifre,

The way you've implemented it means that all extensions that want to use a new icon have to use the same type (10).
I think its would be better to keep these concepts separate so that different extensions can use different types - we can use the HistoryReference class as the record of all of the 'officially' recognized types.
So instead of having the check for type 10 hardcoded, SiteMap could use a method like: hr.getCustomIcon() (or even getCustomIcons();)
Does that make sense?

btw I've changed the Site tree to have use custom icons instead of the default folder and file ones (inspired by Robbert's WebSocket changes!).
So we could actually override those icons with spider ones, although I'm not sure they're really big enough to include lots of information.
Any thoughts?

Cheers,

Simon

Guifre Ruiz Utges

unread,
Aug 1, 2012, 11:46:58 AM8/1/12
to zaproxy...@googlegroups.com
Hello,

I made some modifications according to the specification you described.

Now, the HistoryReference class is instantiated as originally: HistoryReference(Session arg0, int arg1, HttpMessage arg2); Therefore, different historyTypes can be used.

If custom icons in the extension are willing to be used, it should be called the following method: HistoryReference.setCustomIcon(String arg0, boolean arg1), where arg0 is the path to the icon and arg1 defines whether the icon has to be cleaned after having the node manually visited or not.

The diff with the previous implementation can be found at: https://code.google.com/p/zaproxy/source/detail?r=2003#


Best regards.
--
Guifre.

psiinon

unread,
Aug 2, 2012, 5:22:26 AM8/2/12
to zaproxy...@googlegroups.com
Thats looks good :)

Please commit this to the trunk _and_ 4.1 branch.

Many thanks,


Simon

On Friday, 27 July 2012 14:35:33 UTC+1, Guifre Ruiz Utges wrote:
Reply all
Reply to author
Forward
0 new messages