Java URI to Relative URI resolveFile(final URI relativeURI)

Here you can find the source of resolveFile(final URI relativeURI)

Description

resolve File

License

LGPL

Declaration

private static File resolveFile(final URI relativeURI) 

Method Source Code


//package com.java2s;
//License from project: LGPL 

import java.io.File;

import java.net.URI;

public class Main {
    private static File resolveFile(final URI relativeURI) {
        final File file = new File(resolveAbsoluteURI(relativeURI));
        return file.isDirectory() ? new File(file, "index.html") : file;
    }/*from w  ww.  j av  a  2  s.  co m*/

    private static URI resolveAbsoluteURI(final URI relativeURI) {
        return getHtdocsDirectory().toURI().resolve(relativeURI);
    }

    private static File getHtdocsDirectory() {
        return new File("htdocs");
    }
}

Related

  1. resolve(String baseURI, String connectorURI)
  2. resolve(String path, URI... relativeTo)
  3. resolve(URI base, URI child)
  4. resolve(URI baseURI, String reference)
  5. resolveAbsoluteURI(final URI relativeURI)
  6. resolveFileName(URI uri)
  7. resolveFileNameNoExt(URI uri)
  8. resolveFileUri(String fullPageURI, File rootPath)
  9. resolvePartUri(URI sourcePartUri, URI targetUri)