Replaced absolute redirection locations by relative ones when possible.

This makes integration of YaCy behind a reverse proxy subfolder easier.
pull/110/head
luccioman 8 years ago
parent 1857651988
commit 54405577aa

@ -80,7 +80,7 @@ public class Blacklist_p {
blacklistToUse = post.get("newListName", "").trim();
if (blacklistToUse.isEmpty()) {
prop.put(serverObjects.ACTION_LOCATION,"");
prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@ -127,7 +127,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName");
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
prop.put(serverObjects.ACTION_LOCATION,"");
prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@ -155,7 +155,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName", "").trim();
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
prop.put(serverObjects.ACTION_LOCATION, "");
prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}
@ -178,7 +178,7 @@ public class Blacklist_p {
blacklistToUse = post.get("selectedListName", "").trim();
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
prop.put(serverObjects.ACTION_LOCATION, "");
prop.put(serverObjects.ACTION_LOCATION, "Blacklist_p.html");
return prop;
}

@ -80,7 +80,7 @@ public class Status
}
boolean redirect = false;
if ( post.containsKey("login") ) {
prop.put(serverObjects.ACTION_LOCATION, "");
prop.put(serverObjects.ACTION_LOCATION, "Status.html");
return prop;
} else if ( post.containsKey("pauseCrawlJob") ) {
final String jobType = post.get("jobType");
@ -112,7 +112,7 @@ public class Status
}
if ( redirect ) {
prop.put(serverObjects.ACTION_LOCATION, "");
prop.put(serverObjects.ACTION_LOCATION, "Status.html");
return prop;
}
}

@ -122,7 +122,7 @@ public class Wiki {
sb.peers.newsPool.publishMyNews(sb.peers.mySeed(), NewsPool.CATEGORY_WIKI_UPDATE, map);
}
page = newEntry;
prop.putHTML(serverObjects.ACTION_LOCATION, "/Wiki.html?page=" + pagename);
prop.putHTML(serverObjects.ACTION_LOCATION, "Wiki.html?page=" + pagename);
prop.put(serverObjects.ACTION_LOCATION, prop.get(serverObjects.ACTION_LOCATION));
}

@ -32,18 +32,19 @@ public final class BlacklistHelper {
final RequestHeader header) {
String newEntry = entry;
String location = null;
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
return "";
location = header.getPathInfo();
} else if (newEntry == null || newEntry.isEmpty()) {
location = header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
}
if (newEntry == null || newEntry.isEmpty()) {
return header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
if(location != null) {
if(location.startsWith("/")) {
/* Remove the starting "/" to redirect to a relative location for easier reverse proxy integration */
location = location.substring(1, location.length() -1 );
}
// ignore empty entries
if(newEntry == null || newEntry.isEmpty()) {
ConcurrentLog.warn(APP_NAME, "skipped adding an empty entry");
return "";
return location;
}
if (newEntry.startsWith("http://") ){
@ -99,12 +100,19 @@ public final class BlacklistHelper {
final RequestHeader header) {
String oldEntry = entry;
String location = null;
if (blacklistToUse == null || blacklistToUse.isEmpty()) {
return "";
location = header.getPathInfo();
} else if (oldEntry == null || oldEntry.isEmpty()) {
location = header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
}
if (oldEntry == null || oldEntry.isEmpty()) {
return header.getPathInfo() + "?selectList=&selectedListName=" + blacklistToUse;
if(location != null) {
if(location.startsWith("/")) {
/* Remove the starting "/" to redirect to a relative location for easier reverse proxy integration */
location = location.substring(1, location.length() -1 );
}
return location;
}

Loading…
Cancel
Save