|
This working if running exploded, but not in a war;
def pages = new File("${baseDir}/web-app").listFiles( {dir, file -> file ==~ /.*?\.jsp/ } as FilenameFilter
).toList()*.name Can someone help me get this list of Files? --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://www.baselogic.com Blog: http://www.baselogic.com/blog/ Linked IN: http://linkedin.com/in/mickknutson Twitter: http://twitter.com/mickknutson Vacation Rental: http://tahoe.baselogic.com --- |
|
try using smth. like ClassPathResource from Spring
|
|
In reply to this post by BASE Logic, Inc.
take a look at FileUtils (commons-io is already included!). No need to do things like this by yourself.
http://commons.apache.org/io/api-1.4/org/apache/commons/io/FileUtils.html#listFiles(java.io.File, java.lang.String[], boolean) for example: String[] extensions = {"jsp"} File directory = new File(servletContext.getRealPath("/")); println(FileUtils.listFiles(directory,extensions, true)) |
|
SOLVED!
Thanks for the help: <h2>Existing JSP's</h2> <table class="config"> <tr><th colspan=2>Page</th></tr>
<% // Test this out: String[] extensions = {"jsp"} File directory = new File(request.getRealPath("/"))
println(FileUtils.listFiles(directory, extensions, true)) def pages = directory.listFiles( {dir, file -> file ==~ /.*?\.jsp/ } as FilenameFilter
).toList()*.name for (String page: pages) { %> <tr><td class="key"><a href="${page}">${page}</a></td><td class="value">
<% } %> </td></tr> </table> --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://www.baselogic.com Blog: http://www.baselogic.com/blog/ Linked IN: http://linkedin.com/in/mickknutson Twitter: http://twitter.com/mickknutson Vacation Rental: http://tahoe.baselogic.com --- On Tue, May 18, 2010 at 3:31 AM, Sebastian Hohns <[hidden email]> wrote:
|
|
In reply to this post by Sebastian Hohns
Needed augmentation...
I am displaying these pages: <h2>Existing JSP's</h2> <table class="config"> <tr><th colspan=2>Page</th></tr>
<% // Test this out: String[] extensions = {"jsp"} File directory = new File(request.getRealPath("/"))
println(FileUtils.listFiles(directory, extensions, true)) def pages = directory.listFiles( {dir, file -> file ==~ /.*?\.jsp/ } as FilenameFilter
).toList()*.name for (String page: pages) { %> <tr><td class="key"><a href="${page}">${page}</a></td><td class="value">
<% } %> </td></tr> </table> But, What I would really like to do, is be able to filter the HREF output to show the contents of these VXML files like I do in my controller:
public static String renderFormattedXml(String xml){ if(xml){ def stringWriter = new StringWriter() def node = new XmlParser().parseText(xml.toString());
new XmlNodePrinter(new PrintWriter(stringWriter)).print(node) return stringWriter.toString() } else{ return ""
} } How can I make my HREF like execute: render(contentType: "text/xml"){
StringUtilities.renderFormattedXml(sb.toString()) } --- Thank You… Mick Knutson, President BASE Logic, Inc. Enterprise Architecture, Design, Mentoring & Agile Consulting p. (866) BLiNC-411: (254-6241-1) f. (415) 685-4233 Website: http://www.baselogic.com Blog: http://www.baselogic.com/blog/ Linked IN: http://linkedin.com/in/mickknutson Twitter: http://twitter.com/mickknutson Vacation Rental: http://tahoe.baselogic.com --- On Tue, May 18, 2010 at 3:31 AM, Sebastian Hohns <[hidden email]> wrote:
|
| Powered by Nabble | Edit this page |
