3
Following scenario:
I browse for unsafeMethodCall()
in all my web pages. This method is only unsafe in case that there is a reference of doSomeCrazyAjaxStuff()
My web pages are using strong templating (i.e. it was built with JSF)
so a webpage consists out of something like this:
<ui:decorate template="/mypages/editing/someWebPagePart.xhtml">
unsafeMethodCall()
this just copies the contents of the template into the current webpage.
So if I search for unsafeMethodCall()
- the problem is I have to manually open someWebPagePart.xhtml
to search for crazyAjaxStuff()
- but someWebPagePart.xhtml
might be using other templates. So from 1 hit of unsafeMethodCalls I can end up with A LOT of pages I have to open.
So I basically want to scan a file named "somefile.xhtml" for any occurrences of a template. If there is a template I want to search in that template as well, and I want to search in the template of the template etc. as well :-)
Is there a program or tool which could solve this problem?
[EDIT]
So basically I have a file with this contents: (this is just an example)
<div>
<input value="enterusername"/>
</div>
[...more random web page contents like above this line....]
<ui:decorate template="/mypages/editing/someWebPagePart.xhtml">
<my:tag> unsafeMethodCall()</my:tag> <!-- this is potentially dangerous with another function call -->
[...more random web page contents like below this line....]
<p></p>
<a href="#Other-Options" accesskey="n" rel="next">Other Options</a>
When I now open d:/dev/workspace/WebContents/mypages/editing/someWebPagePart.xhtml I will be able to see what finally is actually displayed on the page - because the contents of someWebPagePart.xhtml will be automagically copied by the web server to the final web page.
What I am looking for in the file someWebPagePart.xhtml
is something like this:
<div>
<input value="enterusername"/>
</div>
[...more random web page contents like above this line....]
<ui:decorate template="/mypages/editing/someotherPage.xhtml"> <!-- it could be in there as well -->
<my:tag2> crazyAjaxStuff()</my:tag2> <!-- searching this -->
[...more random web page contents like below this line....]
<p></p>
<a href="#Other-Options" accesskey="n" rel="next">Other Options</a>
Since:
<my:tag2> crazyAjaxStuff()</my:tag2>
will be copied to the same page where unsafeMethodCall
is located, this can lead to a dangerous condition and I'd have to take a close look at the page.
Note: it very well can be possible that the 3rd page someotherPage.xhtml
contains the dangerous crazyAjaxStuff()
1What do you mean with "there is a reference of"? Can you extend your example to at least include two or three files and actually contains the different calls that you sum up? – Tamara Wijsman – 2012-08-20T16:02:38.400
Edited my answer - see [EDIT] – Toskan – 2012-08-20T16:18:11.623
Since it looks like you're using JSP, you're probably familiar with Java in general. This sounds like something you'd probably be best off just writing a quick command line utility for. It seems pretty isolated of a use-case to be included as a feature in a released program. – corsiKa – 2012-08-20T16:37:02.730