< prev index next >

modules/javafx.graphics/src/main/java/javafx/application/HostServices.java

Print this page
rev 10897 : 8199357: Remove references to applets and Java Web Start from FX
Reviewed-by:


  34  * methods to get the code base and document base for an Application,
  35  * and to show a web page in a browser.
  36  *
  37  * @since JavaFX 2.0
  38  */
  39 public final class HostServices {
  40 
  41     private final HostServicesDelegate delegate;
  42 
  43     /**
  44      * Package scope constructor to create the HostServices object.
  45      *
  46      * @param app the application class
  47      */
  48     HostServices(Application app) {
  49         delegate = HostServicesDelegate.getInstance(app);
  50     }
  51 
  52     /**
  53      * Gets the code base URI for this application.
  54      * If the application was launched via a JNLP file, this method returns
  55      * the codebase parameter specified in the JNLP file.
  56      * If the application was launched in standalone mode, this method returns
  57      * the directory containing the application jar file. If the
  58      * application is not packaged in a jar file, this method
  59      * returns the empty string.
  60      *
  61      * @return the code base URI for this application.
  62      */
  63     public final String getCodeBase() {
  64         return delegate.getCodeBase();
  65     }
  66 
  67     /**
  68      * Gets the document base URI for this application.
  69      * If the application is embedded in a browser, this method returns the
  70      * URI of the web page containing the application.
  71      * If the application was launched in webstart mode, this method returns
  72      * the the codebase parameter specified in the JNLP file (the document
  73      * base and the code base are the same in this mode).
  74      * If the application was launched in standalone mode, this method returns
  75      * the URI of the current directory.
  76      *
  77      * @return the document base URI for this application.
  78      */
  79     public final String getDocumentBase() {
  80         return delegate.getDocumentBase();
  81     }
  82 
  83     /**
  84      * Resolves the specified relative URI against the base URI and returns
  85      * the resolved URI.
  86      *
  87      * <p>Example:</p>
  88      * <pre>
  89      *     HostServices services = getHostServices();
  90      *     String myImage = services.resolveURI(services.getDocumentBase(),
  91      *                                          "image.jpg");
  92      *     Image image = new Image(myImage);
  93      * </pre>
  94      *




  34  * methods to get the code base and document base for an Application,
  35  * and to show a web page in a browser.
  36  *
  37  * @since JavaFX 2.0
  38  */
  39 public final class HostServices {
  40 
  41     private final HostServicesDelegate delegate;
  42 
  43     /**
  44      * Package scope constructor to create the HostServices object.
  45      *
  46      * @param app the application class
  47      */
  48     HostServices(Application app) {
  49         delegate = HostServicesDelegate.getInstance(app);
  50     }
  51 
  52     /**
  53      * Gets the code base URI for this application.
  54      * This method returns


  55      * the directory containing the application jar file. If the
  56      * application is not packaged in a jar file, this method
  57      * returns the empty string.
  58      *
  59      * @return the code base URI for this application.
  60      */
  61     public final String getCodeBase() {
  62         return delegate.getCodeBase();
  63     }
  64 
  65     /**
  66      * Gets the document base URI for this application.
  67      * This method returns





  68      * the URI of the current directory.
  69      *
  70      * @return the document base URI for this application.
  71      */
  72     public final String getDocumentBase() {
  73         return delegate.getDocumentBase();
  74     }
  75 
  76     /**
  77      * Resolves the specified relative URI against the base URI and returns
  78      * the resolved URI.
  79      *
  80      * <p>Example:</p>
  81      * <pre>
  82      *     HostServices services = getHostServices();
  83      *     String myImage = services.resolveURI(services.getDocumentBase(),
  84      *                                          "image.jpg");
  85      *     Image image = new Image(myImage);
  86      * </pre>
  87      *


< prev index next >