Mandalika's scratchpad [ Work blog @Oracle | Stock Market Notes | My Music Compositions ]

Old Posts: 09.04  10.04  11.04  12.04  01.05  02.05  03.05  04.05  05.05  06.05  07.05  08.05  09.05  10.05  11.05  12.05  01.06  02.06  03.06  04.06  05.06  06.06  07.06  08.06  09.06  10.06  11.06  12.06  01.07  02.07  03.07  04.07  05.07  06.07  08.07  09.07  10.07  11.07  12.07  01.08  02.08  03.08  04.08  05.08  06.08  07.08  08.08  09.08  10.08  11.08  12.08  01.09  02.09  03.09  04.09  05.09  06.09  07.09  08.09  09.09  10.09  11.09  12.09  01.10  02.10  03.10  04.10  05.10  06.10  07.10  08.10  09.10  10.10  11.10  12.10  01.11  02.11  03.11  04.11  05.11  07.11  08.11  09.11  10.11  11.11  12.11  01.12  02.12  03.12  04.12  05.12  06.12  07.12  08.12  09.12  10.12  11.12  12.12  01.13  02.13  03.13  04.13  05.13  06.13  07.13  08.13  09.13  10.13  11.13  12.13  01.14  02.14  03.14  04.14  05.14  06.14  07.14  09.14  10.14  11.14  12.14  01.15  02.15  03.15  04.15  06.15  09.15  12.15  01.16  03.16  04.16  05.16  06.16  07.16  08.16  09.16  12.16  01.17  02.17  03.17  04.17  06.17  07.17  08.17  09.17  10.17 


Monday, November 09, 2009
 
Java Code to Convert TWiki URLs to HTML Links

Few days ago I was looking for some code or tool with the ability to convert TWiki URLs to equivalent HTML URLs. (For the uninitiated, TWiki supports wide variety of URL formats in addition to the standard HTML format.). I spent almost 3 hours searching the web and trying out different code, Java classes etc., But at the end, none of the things that I found elsewhere seems to have the ability to convert almost all the TWiki URL formats that I'm trying to convert [to HTML]. So, I gave up looking for some readymade code and quickly wrote some Java code to resolve the issue that I'm trying to solve.

Now that I have the code, thought publishing it in my blog would help other people who are looking for something similar to this. So here it is. Download the source code from the following location.

        TwikiToHTML.java

The code assumes that the TWiki system is deployed on http://www.mandalika.com (a fake web site), and is capable of handling the following TWiki URL formats:


[[http://twiki.etclabs.com/pub/MDE/IsveSeeameRomanIvanovMeraJanuaryTechEval/MeraJanuaryScoping.pdf][MeraJanuaryScoping]]
[[Main.JNetX#April_22nd_2008_Whats_new_at_Sun][report]]
[[Main.RomanIvanovLDomsCheatSheet][Executiontrackingpage]]
[[MDE.IsveBravoJeffTaylorProgressApamaSolarisx64Pott][Link]]
[[IsveSeeameOrgadKimchiIGTvLabProcedures][docs]]
[[http://scweb.france.com/~fparient/pub/europa08solaris.odp][solarisprezo]]<br>[[http://scweb.france.com/~fparient/pub/europa08fx.pdf][fxbenchmark]]
[[OmalleyDataProject]]
[[http://twiki.etclabs.com/bin/view/Main/MySQL64NvPlan][Plan]],[[http://twiki.etclabs.com/bin/view/Main/IntegrateSFW][Detail]]
MDE.IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization
http://sidc.israel.com/~mk147459/Reports/ana.html
SofCheck
<a href="http://twiki.org">twiki</a>


Sample inputs and outputs:


% java TwikiToHTML

TWiki URL: NotSoPl@inY0uKnow
HTTP equivalent:

TWiki URL: ItIsJustplain
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/ItIsJustplain" target="_new">ItIsJustplain</a>

TWiki URL: GiriK@lyanaChakravarth!
HTTP equivalent:

TWiki URL: &ersand
HTTP equivalent:

TWiki URL: Harisha
HTTP equivalent:

TWiki URL: Janaki Lakshmi
HTTP equivalent:

TWiki URL: JanakiLakshmi
HTTP equivalent:

TWiki URL: [[OmalleyDataProject]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/OmalleyDataProject" target="_new">OmalleyDataProject</a>

TWiki URL: [[Giri][Mandalika]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/Giri" target="_new">Mandalika</a>

TWiki URL: [[Giri][Mandalika]], [[Kalyana][Chakravarthy]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/Giri" target="_new">Mandalika</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/Kalyana" target="_new">Chakravarthy</a>

TWiki URL: [[Giri][Mandalika]], [[Kalyana][Chakravarthy]], [[IsveSeeameOrgadKimchiIGTvLabProcedures][docs]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/Giri" target="_new">Mandalika</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/Kalyana" target="_new">Chakravarthy</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/IsveSeeameOrgadKimchiIGTvLabProcedures" target="_new">docs</a>

TWiki URL: [[Giri][Mandalika]], [[Kalyana][Chakravarthy]], [[IsveSeeameOrgadKimchiIGTvLabProcedures][docs]], [[OmalleyDataProject][Omalley]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Downloads/Giri" target="_new">Mandalika</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/Kalyana" target="_new">Chakravarthy</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/IsveSeeameOrgadKimchiIGTvLabProcedures" target="_new">docs</a><BR><a href="http://www.mandalika.com/bin/view/Downloads/OmalleyDataProject" target="_new">Omalley</a>

TWiki URL: http://sidc.israel.etclabs.com/~mk147459/Reports/ana.html
HTTP equivalent: <a href="http://sidc.israel.etclabs.com/~mk147459/Reports/ana.html" target="_new">ana.html</a>

TWiki URL: http://sidc.israel.etclabs.com/~mk147459/Reports/ana.html,http://technopark02.blogspot.com
HTTP equivalent: <a href="http://sidc.israel.etclabs.com/~mk147459/Reports/ana.html" target="_new">ana.html</a><BR><a href="http://technopark02.blogspot.com" target="_new">technopark02.blogspot.com</a>

TWiki URL: [[http://www.mandalika.com/pub/MDE/IsveSeeameRomanIvanovMeraJanuaryTechEval/MeraJanuaryScoping.pdf][MeraJanuaryScoping]]
HTTP equivalent: <a href="http://www.mandalika.com/pub/MDE/IsveSeeameRomanIvanovMeraJanuaryTechEval/MeraJanuaryScoping.pdf" target="_new">MeraJanuaryScoping</a>

TWiki URL: [[http://www.mandalika.com/bin/view/Main/RomanIvanovRStyleSoftlabRSBankV6][execution details]] <BR> [[http://www.mandalika.com/bin/view/Main/OracleRAConLDom][OracleRAConLDom]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/RomanIvanovRStyleSoftlabRSBankV6" target="_new">execution details</a><BR><a href="http://www.mandalika.com/bin/view/Main/OracleRAConLDom" target="_new">OracleRAConLDom</a>

TWiki URL: [[http://www.mandalika.com/pub/ISVeProjects/ISVeProject20080213161851/Project20080213161851scoping.odt][scoping document]] , [[http://www.mandalika.com/pub/MDE/IsveSeeameRomanIvanovMeraJanuaryTechEval/MeraJanuaryScoping.pdf][MeraJanuaryScoping]] <BR> [[http://sidc.israel.etclabs.com/~ok134283/techeval/snooggie.html][techeval]] , [[http://sidc.israel.etclabs.com/~ok134283/techeval/servision.html][techeval]]
HTTP equivalent: <a href="http://www.mandalika.com/pub/ISVeProjects/ISVeProject20080213161851/Project20080213161851scoping.odt" target="_new">scoping document</a><BR><a href="http://www.mandalika.com/pub/MDE/IsveSeeameRomanIvanovMeraJanuaryTechEval/MeraJanuaryScoping.pdf" target="_new">MeraJanuaryScoping</a><BR><a href="http://sidc.israel.etclabs.com/~ok134283/techeval/snooggie.html" target="_new">techeval</a><BR><a href="http://sidc.israel.etclabs.com/~ok134283/techeval/servision.html" target="_new">techeval</a>

TWiki URL: [[Main.RomanIvanovLDomsCheatSheet][Execution tracking page]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/RomanIvanovLDomsCheatSheet" target="_new">Execution tracking page</a>

TWiki URL: [[MDE.IsveBravoJeffTaylorProgressApamaSolarisx64Pott][Link]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/MDE/IsveBravoJeffTaylorProgressApamaSolarisx64Pott" target="_new">Link</a>

TWiki URL: [[Main.JNetX#April_22nd_2008_Whats_new_at_Sun][report]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/JNetX#April_22nd_2008_Whats_new_at_Sun" target="_new">report</a>

TWiki URL: [[Main.RomanIvanovLDomsCheatSheet][Execution tracking page]], [[MDE.IsveBravoJeffTaylorProgressApamaSolarisx64Pott][Link]] <BR> [[Main.JNetX#April_22nd_2008_Whats_new_at_Sun][report]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/RomanIvanovLDomsCheatSheet" target="_new">Execution tracking page</a><BR><a href="http://www.mandalika.com/bin/view/MDE/IsveBravoJeffTaylorProgressApamaSolarisx64Pott" target="_new">Link</a><BR><a href="http://www.mandalika.com/bin/view/Main/JNetX#April_22nd_2008_Whats_new_at_Sun" target="_new">report</a>

TWiki URL: [[http://www.mandalika.com/bin/view/MDE/IsveKylinPDSChinaVolumeISVWorldonline][World-Online]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/MDE/IsveKylinPDSChinaVolumeISVWorldonline" target="_new">World-Online</a>

TWiki URL: [[ISVeProjects.IsveIndividualSummaryCarylTakvorian][Caryl Takvorian]] Tom Duell
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/ISVeProjects/IsveIndividualSummaryCarylTakvorian" target="_new">Caryl Takvorian</a>

TWiki URL: [[http://www.mandalika.com/bin/view/MDE/IsveGANEIndividualSummaryAndrewWalton][Andrew Walton]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/MDE/IsveGANEIndividualSummaryAndrewWalton" target="_new">Andrew Walton</a>

TWiki URL: [[http://etclabswebcollab.east.etclabs.com/gm/folder-1.11.1890618][Project Folder]]
HTTP equivalent: <a href="http://etclabswebcollab.east.etclabs.com/gm/folder-1.11.1890618" target="_new">Project Folder</a>

TWiki URL: [[http://etclabswebcollab.east.etclabs.com/gm/document-1.9.3262994/SUN%25E4%25B8%25BB%25E6%259C%25BAOCS%25E6%2580%25A7%25E8%2583%25BD%25E6%25B5%258B%25E8%25AF%2595%25E6%258A%25A5%25E5%2591%258A.doc][Cust. Report]], [[http://etclabswebcollab.east.etclabs.com/gm/document-1.9.3270163/ocs_perftune_t2000.odt][ISVE Report]]
HTTP equivalent: <a href="http://etclabswebcollab.east.etclabs.com/gm/document-1.9.3262994/SUN%25E4%25B8%25BB%25E6%259C%25BAOCS%25E6%2580%25A7%25E8%2583%25BD%25E6%25B5%258B%25E8%25AF%2595%25E6%258A%25A5%25E5%2591%258A.doc" target="_new">Cust. Report</a><BR><a href="http://etclabswebcollab.east.etclabs.com/gm/document-1.9.3270163/ocs_perftune_t2000.odt" target="_new">ISVE Report</a>

TWiki URL: MDE.IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/MDE/IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization" target="_new">IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization</a>

TWiki URL: [[Main.RomanIvanovLDomsCheatSheet]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/RomanIvanovLDomsCheatSheet" target="_new">RomanIvanovLDomsCheatSheet</a>

TWiki URL: MDE.PostgreSQLAutoTune <BR> [[Main.RomanIvanovLDomsCheatSheet]] , MDE.IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/Main/RomanIvanovLDomsCheatSheet" target="_new">RomanIvanovLDomsCheatSheet</a><BR><a href="http://www.mandalika.com/bin/view/MDE/PostgreSQLAutoTune" target="_new">PostgreSQLAutoTune</a><BR><a href="http://www.mandalika.com/bin/view/MDE/IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization" target="_new">IsveAlphaBogdanVasiliuSynopsysVCSPerformanceOptimization</a>

TWiki URL: [[http://www.mandalika.com/bin/view/ISVeProjects/IsveIndividualSummaryMohammedYousuf][Mohammed Yousuf]], Thiagarajan Chandrasekaran
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/ISVeProjects/IsveIndividualSummaryMohammedYousuf" target="_new">Mohammed Yousuf</a>

TWiki URL: MDE.IsveDabuboirProsDamienCookeMyStaffMyStaffPostgreSQLAdoption [[http://twiki.etclabs/pub/MDE/IsveDabuboirProsDamienCookeMyStaffMyStaffPostgreSQLAdoption/MyStaff.html][Project Status]]
HTTP equivalent: <a href="http://twiki.etclabs/pub/MDE/IsveDabuboirProsDamienCookeMyStaffMyStaffPostgreSQLAdoption/MyStaff.html" target="_new">Project Status</a><BR><a href="http://www.mandalika.com/bin/view/MDE/IsveDabuboirProsDamienCookeMyStaffMyStaffPostgreSQLAdoption" target="_new">IsveDabuboirProsDamienCookeMyStaffMyStaffPostgreSQLAdoption</a>

TWiki URL: [[http://www.xxx.yyy]], <a href="http://www.xyz.com">xyz</a>, http://www.yahoo.com , <a href="www.giril.com">giri</a> , [[http://www.harisha.com][harisha]], <a href="www.etclabs.com">etclabs</a>
HTTP equivalent: <a href="http://www.xyz.com">xyz</a><BR><a href="www.giril.com">giri</a><BR><a href="www.etclabs.com">etclabs</a><BR><a href="http://www.xxx.yyy" target="_new">www.xxx.yyy<BR><a href="http://www.harisha.com" target="_new">harisha</a><BR><a href="http://www.yahoo.com" target="_new">www.yahoo.com</a>

TWiki URL: New link YousufCertificationofOracleRAConSolaris10u6Containers , old link http://blogs.etclabs.com/rac
HTTP equivalent: <a href="http://blogs.etclabs.com/rac" target="_new">rac</a>

TWiki URL: attached email.
HTTP equivalent:

TWiki URL: [[http://www.mandalika.com/bin/view/MDE/Caucho Caucho]] [[http://www.mandalika.com/bin/view/MDE/ISVeProject20070812164315 20070812164315]]
HTTP equivalent: <a href="http://www.mandalika.com/bin/view/MDE/Caucho" target="_new">Caucho</a><BR><a href="http://www.mandalika.com/bin/view/MDE/ISVeProject20070812164315" target="_new">20070812164315</a>

TWiki URL: http://download.sap.com/download.epd?context=40E2D9D5E00EEF7CB82813BD3F95797BAEB80527B36EC026E03386D659E4DE48
HTTP equivalent: <a href="http://download.sap.com/download.epd?context=40E2D9D5E00EEF7CB82813BD3F95797BAEB80527B36EC026E03386D659E4DE48" target="_new">download.epd?context=40E2D9D5E00E ... BAEB80527B36EC026E03386D659E4DE48</a>



Disclaimer:
This code is poorly documented, not perfect and most importantly may not even meet the minimum Java coding standards. However it does the intended job with minor modifications. Feel free to use, modify, reproduce or redistribute - but please do not come back complaining. I have no intention of fixing or improving this code.


Comments: Post a Comment

Links to this post:

Create a Link



<< Home


2004-2017 

This page is powered by Blogger. Isn't yours?