docs: public TileMap getCapabilities(TmsLayer layer) throws TmsLayerException {
  		try {
  			// Create a JaxB unmarshaller:
  			JAXBContext context = JAXBContext.newInstance(TileMap.class);
  			Unmarshaller um = context.createUnmarshaller();
  
  			// Find out where to retrieve the capabilities and unmarshall:
  			if (layer.getBaseTmsUrl().startsWith(CLASSPATH)) {
  				String location = layer.getBaseTmsUrl().substring(CLASSPATH.length());
  				if (location.length() > 0 && location.charAt(0) == '/') {
  					// classpath resources should not start with a slash, but they often do
  					location = location.substring(1);
  				}
  				ClassLoader cl = Thread.currentThread().getContextClassLoader();
  				if (null == cl) {
  					cl = getClass().getClassLoader(); // NOSONAR fallback from proper behaviour for some environments
  				}
  				InputStream is = cl.getResourceAsStream(location);
  				if (null != is) {
  					try {
  						return (TileMap) um.unmarshal(is);
  					} finally {
  						try {
  							is.close();
  						} catch (IOException ioe) {
  							// ignore, just closing the stream
  						}
  					}
  				}
  				throw new TmsLayerException(TmsLayerException.COULD_NOT_FIND_FILE, layer.getBaseTmsUrl());
  			}
  
  			// Normal case, find the URL and unmarshal:
  			return (TileMap) um.unmarshal(httpService.getStream(layer.getBaseTmsUrl(), layer));
  		} catch (JAXBException e) {
  			throw new TmsLayerException(e, TmsLayerException.COULD_NOT_READ_FILE, layer.getBaseTmsUrl());
  		} catch (IOException e) {
  			throw new TmsLayerException(e, TmsLayerException.COULD_NOT_READ_FILE, layer.getBaseTmsUrl());
  		}
  	}