< prev index next >

src/java.base/share/classes/java/net/URLStreamHandler.java

Print this page




 514         }
 515         return result.toString();
 516     }
 517 
 518     /**
 519      * Sets the fields of the {@code URL} argument to the indicated values.
 520      * Only classes derived from URLStreamHandler are able
 521      * to use this method to set the values of the URL fields.
 522      *
 523      * @param   u         the URL to modify.
 524      * @param   protocol  the protocol name.
 525      * @param   host      the remote host value for the URL.
 526      * @param   port      the port on the remote machine.
 527      * @param   authority the authority part for the URL.
 528      * @param   userInfo the userInfo part of the URL.
 529      * @param   path      the path component of the URL.
 530      * @param   query     the query part for the URL.
 531      * @param   ref       the reference.
 532      * @exception       SecurityException       if the protocol handler of the URL is
 533      *                                  different from this one
 534      * @see     java.net.URL#set(java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)
 535      * @since 1.3
 536      */
 537        protected void setURL(URL u, String protocol, String host, int port,
 538                              String authority, String userInfo, String path,
 539                              String query, String ref) {
 540         if (this != u.handler) {
 541             throw new SecurityException("handler for url different from " +
 542                                         "this handler");
 543         }
 544         // ensure that no one can reset the protocol on a given URL.
 545         u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref);
 546     }
 547 
 548     /**
 549      * Sets the fields of the {@code URL} argument to the indicated values.
 550      * Only classes derived from URLStreamHandler are able
 551      * to use this method to set the values of the URL fields.
 552      *
 553      * @param   u         the URL to modify.
 554      * @param   protocol  the protocol name. This value is ignored since 1.2.




 514         }
 515         return result.toString();
 516     }
 517 
 518     /**
 519      * Sets the fields of the {@code URL} argument to the indicated values.
 520      * Only classes derived from URLStreamHandler are able
 521      * to use this method to set the values of the URL fields.
 522      *
 523      * @param   u         the URL to modify.
 524      * @param   protocol  the protocol name.
 525      * @param   host      the remote host value for the URL.
 526      * @param   port      the port on the remote machine.
 527      * @param   authority the authority part for the URL.
 528      * @param   userInfo the userInfo part of the URL.
 529      * @param   path      the path component of the URL.
 530      * @param   query     the query part for the URL.
 531      * @param   ref       the reference.
 532      * @exception       SecurityException       if the protocol handler of the URL is
 533      *                                  different from this one

 534      * @since 1.3
 535      */
 536        protected void setURL(URL u, String protocol, String host, int port,
 537                              String authority, String userInfo, String path,
 538                              String query, String ref) {
 539         if (this != u.handler) {
 540             throw new SecurityException("handler for url different from " +
 541                                         "this handler");
 542         }
 543         // ensure that no one can reset the protocol on a given URL.
 544         u.set(u.getProtocol(), host, port, authority, userInfo, path, query, ref);
 545     }
 546 
 547     /**
 548      * Sets the fields of the {@code URL} argument to the indicated values.
 549      * Only classes derived from URLStreamHandler are able
 550      * to use this method to set the values of the URL fields.
 551      *
 552      * @param   u         the URL to modify.
 553      * @param   protocol  the protocol name. This value is ignored since 1.2.


< prev index next >