code: public static String canonicalContextPathSpec(String contextPathSpec)
      {
          // check context path
          if (contextPathSpec==null ||
              contextPathSpec.indexOf(',')>=0 ||
              contextPathSpec.startsWith("*"))
              throw new IllegalArgumentException ("Illegal context spec:"+contextPathSpec);
  
          if(!contextPathSpec.startsWith("/"))
  	    contextPathSpec='/'+contextPathSpec;
  
          if (contextPathSpec.length()>1)
          {
              if (contextPathSpec.endsWith("/"))
                  contextPathSpec+="*";
              else if (!contextPathSpec.endsWith("/*"))
                  contextPathSpec+="/*";
          }
  
          return contextPathSpec;
      }
docs: /* ------------------------------------------------------------