code: public static URL getRealURL(final ServletContext pContext, final String pPath) throws MalformedURLException {
          String realPath = pContext.getRealPath(pPath);
  
          if (realPath != null) {
              // NOTE: First convert to URI, as of Java 6 File.toURL is deprecated
              return new File(realPath).toURI().toURL();
          }
  
          return null;
      }
docs: Returns a {@code URL} containing the real path for a given virtual
  path, on URL form.
  Note that this method will return {@code null} for all the same reasons
  as {@code ServletContext.getRealPath(java.lang.String)} does.
  
  @param pContext the servlet context
  @param pPath    the virtual path
  @return a {@code URL} object containing the path, or {@code null}.
  @throws MalformedURLException if the path refers to a malformed URL
  @see ServletContext#getRealPath(java.lang.String)
  @see ServletContext#getResource(java.lang.String)