mirror of
https://github.com/gnosygnu/xowa.git
synced 2024-10-27 20:34:16 +00:00
HTTP_Server: Move call to fsys_hack for mild performance improvement [#524]
This commit is contained in:
parent
06afe7a7b1
commit
6449368800
@ -144,7 +144,9 @@ public class Http_server_mgr implements Gfo_invk {
|
||||
rv = wiki.Html_mgr().Head_mgr().Popup_mgr().Show_init(popup_id, ttl_bry, ttl_bry);
|
||||
}
|
||||
else {
|
||||
rv = String_.new_u8(wiki.Html_mgr().Page_wtr_mgr().Gen(page, mode)); // NOTE: must generate HTML now in order for "wait" and "async_server" to work with text_dbs; DATE:2016-07-10
|
||||
byte[] page_html = wiki.Html_mgr().Page_wtr_mgr().Gen(page, mode);
|
||||
page_html = Http_server_wkr.Replace_fsys_hack(page_html);
|
||||
rv = String_.new_u8(page_html); // NOTE: must generate HTML now in order for "wait" and "async_server" to work with text_dbs; DATE:2016-07-10
|
||||
boolean rebuild_html = false;
|
||||
switch (retrieve_mode) {
|
||||
case File_retrieve_mode.Mode_skip: // noop
|
||||
|
@ -136,7 +136,6 @@ public class Http_server_wkr implements Gfo_invk {
|
||||
.Add_str_int("/exec/gfs" , Tid_post_url_gfs)
|
||||
;
|
||||
private static String Convert_page(String page_html, String root_dir_http, String wiki_domain) {
|
||||
page_html = Replace_fsys_hack(page_html);
|
||||
page_html = String_.Replace(page_html, root_dir_http , "/fsys/");
|
||||
page_html = String_.Replace(page_html, "xowa-cmd:" , "/exec/");
|
||||
page_html = String_.Replace(page_html, " href=\"/wiki/" , " href=\"/" + wiki_domain + "/wiki/");
|
||||
@ -152,10 +151,9 @@ public class Http_server_wkr implements Gfo_invk {
|
||||
, Bry__file_fsys = Bry_.new_a7("/fsys")
|
||||
;
|
||||
|
||||
public static String Replace_fsys_hack(String html_str) {
|
||||
public static byte[] Replace_fsys_hack(byte[] html_bry) {
|
||||
// init
|
||||
Bry_bfr bfr = Bry_bfr_.New();
|
||||
byte[] html_bry = Bry_.new_u8(html_str);
|
||||
int len = html_bry.length;
|
||||
int pos = 0;
|
||||
|
||||
@ -228,7 +226,7 @@ public class Http_server_wkr implements Gfo_invk {
|
||||
|
||||
// add rest
|
||||
bfr.Add_mid(html_bry, pos, len);
|
||||
return bfr.To_str_and_clear();
|
||||
return bfr.To_bry_and_clear();
|
||||
}
|
||||
public Object Invk(GfsCtx ctx, int ikey, String k, GfoMsg m) {
|
||||
if (ctx.Match(k, Invk_run)) {this.Run();}
|
||||
|
@ -45,7 +45,7 @@ public class Http_server_wkr_tst {
|
||||
class Http_server_wkr_fxt {
|
||||
public void Test__Replace_fsys_hack(String html) {Test__Replace_fsys_hack(html, html);}
|
||||
public void Test__Replace_fsys_hack(String html, String expd) {
|
||||
String actl = Http_server_wkr.Replace_fsys_hack(html);
|
||||
byte[] actl = Http_server_wkr.Replace_fsys_hack(Bry_.new_u8(html));
|
||||
Gftest.Eq__ary__lines(expd, actl);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user