increase use of header const for custom "EXT" header

pull/93/head
reger 8 years ago
parent 6a0b218ae5
commit f45945cada

@ -32,6 +32,7 @@ import java.nio.charset.StandardCharsets;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.ResponseHeader;
import net.yacy.cora.util.ConcurrentLog;
@ -77,7 +78,7 @@ public class CacheResource_p {
}
// check request type
if (header.get("EXT", "html").equals("png")) {
if (header.get(HeaderFramework.CONNECTION_PROP_EXT, "html").equals("png")) {
// a png was requested
return ImageParser.parse(u, resource);
}

@ -26,6 +26,7 @@ import java.util.Map;
import java.util.regex.Pattern;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.SpaceExceededException;
@ -40,7 +41,7 @@ public class Tables_p {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String ext = header.get("EXT", "");
final String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");
//final boolean json = ext.equals("json");
final boolean xml = ext.equals("xml");

@ -86,7 +86,7 @@ public class ViewFavicon {
public static Object respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
String ext = header.get("EXT", null);
String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, null);
boolean isPNGTarget = "png".equalsIgnoreCase(ext);
ImageInputStream imageInStream = null;

@ -76,7 +76,7 @@ public class ViewImage {
throw new TemplateMissingParameterException("please fill at least url or code parameter");
}
String ext = header.get("EXT", null);
String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, null);
final boolean auth = Domains.isLocalhost(header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, ""))
|| sb.verifyAuthentication(header); // handle access rights

@ -41,7 +41,7 @@ public class linkstructure {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final servletProperties prop = new servletProperties();
final String ext = header.get("EXT", "");
final String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");
//final boolean json = ext.equals("json");
final boolean xml = ext.equals("xml");

@ -38,6 +38,7 @@ import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.document.feed.RSSFeed;
import net.yacy.cora.document.feed.RSSMessage;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.Html2Image;
@ -67,7 +68,7 @@ public class snapshot {
final Switchboard sb = (Switchboard) env;
final boolean authenticated = sb.adminAuthenticated(header) >= 2;
final String ext = header.get("EXT", "");
final String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");
if (ext.equals("rss")) {

@ -25,6 +25,7 @@ import java.util.Map;
import java.util.regex.Pattern;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.CommonPattern;
import net.yacy.cora.util.ConcurrentLog;
@ -40,7 +41,7 @@ public class table_p {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final String EXT = header.get("EXT", "");
final String EXT = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");
final boolean html = EXT.equals("html");
final boolean xml = EXT.equals("xml");

@ -18,6 +18,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.peers.graphics.EncodedImage;
import net.yacy.peers.graphics.OSMTile;
@ -58,7 +59,7 @@ public class osm {
* The (C) symbol is not available in our font, so we use the letters (C) instead.
*/
PrintTool.print(map, map.getWidth() - 6, map.getHeight() - 6, 0, "(C) OPENSTREETMAP CONTRIBUTORS", 1, 80);
return new EncodedImage(map, header.get("EXT", null), true);
return new EncodedImage(map, header.get(HeaderFramework.CONNECTION_PROP_EXT, null), true);
}
}

@ -56,7 +56,7 @@ public class suggest {
final Switchboard sb = (Switchboard) env;
final servletProperties prop = new servletProperties();
final String ext = header.get("EXT", "");
final String ext = header.get(HeaderFramework.CONNECTION_PROP_EXT, "");
final boolean json = ext.equals("json");
final boolean xml = ext.equals("xml");

@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.JSONObject;
import net.yacy.peers.Seed;
@ -71,7 +72,7 @@ public final class seedlist {
final serverObjects prop = new serverObjects();
// write simple-encoded seed lines or json
String EXT = header.get("EXT");
String EXT = header.get(HeaderFramework.CONNECTION_PROP_EXT);
boolean json = EXT != null && EXT.equals("json");
boolean xml = EXT != null && EXT.equals("xml");

Loading…
Cancel
Save