01 
02 /*
03  *  JScripter Standard 1.0 - To Script In Java
04  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
05  *  
06  *  This program is free software: you can redistribute it and/or modify
07  *  it under the terms of the GNU Affero General Public License as published by
08  *  the Free Software Foundation, either version 3 of the License, or
09  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Affero General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU Affero General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 package jsx.client;
21 
22 import js.Field;
23 import js.Disposable;
24 import js.Js;
25 import js.Static;
26 import js.Var;
27 import js.user.JsLocation;
28 
29 /**
30  * <p>A utility class accessing the properties of {@link js.user.JsWindow#location}.</p>
31  * <p>Users are encouraged to use the utilities provided in this class instead of the 
32  * <b>opaque</b> methods of the {@link js.user.JsLocation} class in consideration of the 
33  * reuse benefit for re-compilation results.</p>
34  * 
35  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
36  */
37 public final class Location extends Disposable
38 {
39     private Location() {}
40 
41     /**
42      * <p>Statically accesses a property of <tt>location</tt> by the name of this field.</p> 
43      * @see js.user.JsLocation
44      * @since 1.0
45      */
46     public final static Var<String> protocol = new Static<String>(new Field<String>(Win.location, JsLocation.protocol));
47 
48     /**
49      * <p>Determines the {@link #protocol} of the current location is secure.</p>
50      * @see Browser
51      * @since 1.0
52      */
53     public static final boolean isSecure  = Js.re("^https", "i").test(protocol.var());
54 }