<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

      <title>Comments on: How to create a custom Java protocol handler?</title>
      <link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler/</link>
      <description>Comments on Ask MetaFilter post How to create a custom Java protocol handler?</description>
	  	  <pubDate>Thu, 03 Apr 2008 05:29:03 -0800</pubDate>
      <lastBuildDate>Thu, 03 Apr 2008 05:29:03 -0800</lastBuildDate>
      <language>en-us</language>
	  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
	  <ttl>60</ttl>

<item>
  	<title>Question: How to create a custom Java protocol handler?</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler</link>	
  	<description>Is there an easy (no programming!) way to create a custom protocol handler for Java on XP? I&apos;m using the Java-based mindmapping application FreeMind, and I want to create hyperlinks within it to notes in EverNote.  EverNote supplies links to notes that can be used in other applications, but when I click on one of these links in FreeMind, I get the following Java error message: This URL is malformed! java.net.MalformedURLException: unknown protocol: evernote&lt;br&gt;
&lt;br&gt;
I&apos;ve spent a lot of time Googling &quot;protocol handler&quot;, and it seems as if there should be some way to simply register a custom protocol handler for an application like EverNote - but I can&apos;t find instructions to do this non-programmatically anywhere.&lt;br&gt;
&lt;br&gt;
Ideally I could simply edit a Java registry somewhere, and add a custom protocol handler for EverNote that would point to the EverNote executable.&lt;br&gt;
&lt;br&gt;
Can anyone help me with this?</description>
  	<guid isPermaLink="false">post:ask.metafilter.com,2008:site.87764</guid>
  	<pubDate>Thu, 03 Apr 2008 04:36:36 -0800</pubDate>
  	<dc:creator>worldshift</dc:creator>
	
	<category>java</category>
	
	<category>protocol</category>
	
	<category>handler</category>
	
	<category>FreeMind</category>
	
	<category>EverNote</category>
	
</item>
<item>
  	<title>By: Mach5</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler#1293114</link>	
  	<description>wait, so do you type in something like evernote://to/the/note to get there?  if so, i would assume that java&apos;s http link handler does not, in fact, support this protocol.  this is not something you&apos;re gonna change in the registry, its within the source code of java itself.  the only way you&apos;re not gonna solve this programmatically is to set up a webserver on your box that redirects http requests to evernote.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.87764-1293114</guid>
  	<pubDate>Thu, 03 Apr 2008 05:29:03 -0800</pubDate>
  	<dc:creator>Mach5</dc:creator>
</item>
<item>
  	<title>By: cschneid</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler#1293120</link>	
  	<description>Most windows applications don&apos;t deal with URLs, they just hand them to windows and say &amp;quot;here, you deal with it&amp;quot;.  Java doesn&apos;t, since it&apos;s cross platform.  So you&apos;re right that Java has to change.&lt;br&gt;
&lt;br&gt;
Here&apos;s the bad news.  It requires at least a code change.  I haven&apos;t looked into it enough to know exactly what the code change is, but this isn&apos;t a configurable option somewhere.  It&apos;ll be a custom piece of code which says &amp;quot;ok, that is an evernote link, fire up evernote&amp;quot;.&lt;br&gt;
&lt;br&gt;
Here&apos;s the good news. It&apos;s open source.  You can download the FreeMind source, and tinker with it.&lt;br&gt;
&lt;br&gt;
More bad news. That&apos;s a pain.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.87764-1293120</guid>
  	<pubDate>Thu, 03 Apr 2008 05:39:51 -0800</pubDate>
  	<dc:creator>cschneid</dc:creator>
</item>
<item>
  	<title>By: Artful Codger</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler#1293153</link>	
  	<description>As suggested, you&apos;ll need to make some custom &amp;quot;server&amp;quot; to map the evernotes &amp;quot;protocol&amp;quot; to something acceptable to java.net.URL . Otherwise you&apos;ll have to crack open the source of freemind and change or augment the protocol handling.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.87764-1293153</guid>
  	<pubDate>Thu, 03 Apr 2008 06:20:37 -0800</pubDate>
  	<dc:creator>Artful Codger</dc:creator>
</item>
<item>
  	<title>By: bdc34</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler#1293546</link>	
  	<description>Consider asking the developers to implement this feature.&lt;br&gt;
&lt;br&gt;
What follows isn&apos;t the answer you want, it involves programing.  &lt;br&gt;
&lt;br&gt;
I haven&apos;t seen a way to say &amp;quot;map this URL protocol to this executable,&amp;quot;  but in Java you can register custom protocol handlers.   &lt;br&gt;
&lt;br&gt;
You can  write&lt;br&gt;
  a Class that extends URLConnection, let&apos;s call it ENoteURLConnection.&lt;br&gt;
  a Class that extends URLStreamHandler, let&apos;s call it ENoteURLStreamHandler.&lt;br&gt;
  a Class that extends URLStreamHandlerFactory, let&apos;s call it ENoteURLStreamHandlerFactory.&lt;br&gt;
&lt;br&gt;
Then you have to call &lt;br&gt;
URL.setStreamHandlerFactory(new ENoteURLStreamHandlerFactory());&lt;br&gt;
&lt;br&gt;
Then anytime the JVM hit a URL like &amp;quot;EverNote://bob/greatideas/23rd&amp;quot; it executes your code.&lt;br&gt;
&lt;br&gt;
ENoteURLStreamHandlerFactory need to return a ENoteURLStreamHandler&lt;br&gt;
and ENoteURLStreamHandler needs to return a return a&lt;br&gt;
ENoteURLConnection.  ENoteURLConnection needs to be able to do all&lt;br&gt;
its work with only the requested URL.&lt;br&gt;
&lt;br&gt;
Or if you want to open an external application you could use Runtime.getRuntime().exec()&lt;br&gt;
to kick off your external application from ENoteURLStreamHandler.openConnection().&lt;br&gt;
Then you could forget ENoteURLConnection and return a dummy URLConnection since &lt;br&gt;
all of the action is external to the JVM.&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.google.com/url?sa=t&amp;ct=clnk&amp;cd=5&amp;url=http%3A%2F%2F64.233.169.104%2Fsearch%3Fq%3Dcache%3ASQlkU4kE0xAJ%3Awww.emu.edu.tr%2Fenglish%2Ffacilitiesservices%2Fcomputercenter%2Fbookslib%2FSpecial%252520Edition%252520Using%252520Java%2C%2525202nd%252520Edition%2F25javafi.htm%2B%2522extends%2BURLConnection%2522%26hl%3Den%26ct%3Dclnk%26cd%3D5%26gl%3Dus%26client%3Diceweasel-a&amp;ei=rAz1R-G2E57aepO9oc8L&amp;usg=AFQjCNEYfxB_1Cwa-xaubPmS_MTSAMv_Ww&amp;sig2=CXyI5bA5Vcf6tjupp2t9SA&quot;&gt;Here is an example from Google cache.&lt;/a&gt;</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.87764-1293546</guid>
  	<pubDate>Thu, 03 Apr 2008 10:40:35 -0800</pubDate>
  	<dc:creator>bdc34</dc:creator>
</item>
<item>
  	<title>By: worldshift</title>
  	<link>http://ask.metafilter.com/87764/How-to-create-a-custom-Java-protocol-handler#1294901</link>	
  	<description>Thanks everyone so much for all the information and ideas!&lt;br&gt;
&lt;br&gt;
Hopefully when FreeMind &lt;em&gt;eventually&lt;/em&gt; come out with a new release (it&apos;s been what, two years now?), they&apos;ll put in some code for Windows to automatically drop any unknown protocol out to the system, which will know what to do with it - something I&apos;ll suggest.&lt;br&gt;
&lt;br&gt;
In the meanwhile it&apos;s back to using clunky MindManager (you need a registry fix to get it to work with EverNote, contact me if anyone needs this), or perhaps &lt;a href=&quot;http://xmind.org/us/&quot;&gt;XMIND&lt;/a&gt; which is starting to grow on me.</description>
  	<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.87764-1294901</guid>
  	<pubDate>Fri, 04 Apr 2008 10:09:14 -0800</pubDate>
  	<dc:creator>worldshift</dc:creator>
</item>

    </channel>
</rss>
