1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-01-25 20:56:50 -05:00
parent 1b0042ef8a
commit efaf9dcd00
447 changed files with 10258 additions and 3016 deletions

View File

@@ -20,7 +20,8 @@ public class Xoa_url {
public byte[] Raw() {return raw;} public Xoa_url Raw_(byte[] v) {raw = v; return this;} private byte[] raw = Bry_.Empty;
public byte[] Wiki_bry() {return wiki_bry;} public Xoa_url Wiki_bry_(byte[] v) {wiki_bry = v; return this;} private byte[] wiki_bry;
public byte[] Page_bry() {return page_bry;} public Xoa_url Page_bry_(byte[] v) {page_bry = v; return this;} private byte[] page_bry;
public Xow_wiki Wiki() {return wiki;} public Xoa_url Wiki_(Xow_wiki v) {wiki = v; return this;} private Xow_wiki wiki;
public byte[] Anchor_bry() {return anchor_bry;} public Xoa_url Anchor_bry_(byte[] v) {anchor_bry = v; return this;} private byte[] anchor_bry = null;
public String Anchor_str() {return anchor_bry == null ? null : String_.new_utf8_(anchor_bry);}
public Gfo_url_arg[] Args() {return args;} public Xoa_url Args_(Gfo_url_arg[] v) {args = v; return this;} private Gfo_url_arg[] args = Gfo_url_arg.Ary_empty;
public byte Protocol_tid() {return protocol_tid;} public Xoa_url Protocol_tid_(byte v) {protocol_tid = v; return this;} private byte protocol_tid;
public byte[] Protocol_bry() {return protocol_bry;} public Xoa_url Protocol_bry_(byte[] v) {protocol_bry = v; return this;} private byte[] protocol_bry;
@@ -34,8 +35,6 @@ public class Xoa_url {
else
return Bry_.Mid(raw, page_bgn, raw_len);// else take everything after "/wiki/";
}
public byte[] Anchor_bry() {return anchor_bry;} public Xoa_url Anchor_bry_(byte[] v) {anchor_bry = v; return this;} private byte[] anchor_bry = null;
public String Anchor_str() {return anchor_bry == null ? null : String_.new_utf8_(anchor_bry);}
public byte[] Use_lang() {return use_lang;} public Xoa_url Use_lang_(byte[] v) {use_lang = v; return this;} private byte[] use_lang;
public boolean Redirect_force() {return redirect_force;} public Xoa_url Redirect_force_(boolean v) {redirect_force = v; return this;} private boolean redirect_force;
public boolean Search_fulltext() {return search_fulltext;} public Xoa_url Search_fulltext_(boolean v) {search_fulltext = v; return this;} private boolean search_fulltext;
@@ -62,19 +61,6 @@ public class Xoa_url {
}
return false;
}
public void Args_fill(OrderedHash trg_args) {
int trg_len = trg_args.Count();
for (int i = 0; i < trg_len; i++) {
Gfo_url_arg trg_arg = (Gfo_url_arg)trg_args.FetchAt(i);
trg_arg.Val_bry_(null);
}
int src_len = args.length;
for (int i = 0; i < src_len; i++) {
Gfo_url_arg src_arg = args[i];
Gfo_url_arg trg_arg = (Gfo_url_arg)trg_args.Fetch(src_arg.Key_bry());
if (trg_arg != null) trg_arg.Val_bry_(src_arg.Val_bry());
}
}
public byte[] Args_all_as_bry() {
int args_len = args.length;
if (args_len == 0) return Bry_.Empty;

View File

@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.xowa; import gplx.*;
public class Xoa_url_arg_hash {
OrderedHash hash = OrderedHash_.new_bry_();
private OrderedHash hash = OrderedHash_.new_bry_();
public Gfo_url_arg Get_arg(byte[] key) {return (Gfo_url_arg)hash.Fetch(key);}
public int Get_val_int_or(byte[] key, int or) {
byte[] val_bry = Get_val_bry_or(key, null); if (val_bry == null) return or;

View File

@@ -220,7 +220,6 @@ public class Xoa_url_parser {
page_bry = ttl.Page_txt();
}
}
rv.Wiki_(wiki);
rv.Wiki_bry_(wiki.Domain_bry());
rv.Page_bry_(page_bry);
return rv;
@@ -260,7 +259,6 @@ public class Xoa_url_parser {
Xoa_url rv = Xoa_url_parser.Parse_url(app, wiki, bry, 0, bry.length, true);
if (app.Wiki_mgr().Wiki_regy().Url_is_invalid_domain(rv)) { // handle lang_code entered; EX: "war" should redirect to "war" article in current wiki, not war.wikipedia.org; DATE:2014-02-07
rv.Page_bry_(rv.Wiki_bry());
rv.Wiki_(wiki);
rv.Wiki_bry_(wiki.Domain_bry());
}
return rv;