Extracting the full URL from the document context in a Domino Java agent

I always recreate this method from scratch. No more! It is used to get the full URL that started the agent.

 /** * Returns the full URL that is this agent was started with. * * @param docContext the document context where the * HTTPS, Server_Protocol, Path_Info and Server_Name are. * @return the full URL. */ public URL getFullURL(Document docContext) throws NotesException, MalformedURLException { String s = docContext.getItemValueString("Server_Protocol").toLowerCase(); s = s.substring(0, s.indexOf("/")); s += (docContext.getItemValueString("HTTPS").toUpperCase().equals("ON") ? "s" : ""); s += "://" + docContext.getItemValueString("Server_Name"); s += docContext.getItemValueString("Path_Info_Decoded"); return new URL(s); }