Augmented browsing: Pass on additional action parameter

pull/1/head
cominch 13 years ago
parent 8cf47a8335
commit e4555cbee3

@ -21,7 +21,8 @@ public class Document_part {
final serverObjects prop = new serverObjects();
prop.put("hash", post.get("hash", ""));
prop.put("url", post.get("url", ""));
prop.put("url", post.get("url", ""));
prop.put("action", post.get("action", ""));
return prop;
}

@ -180,9 +180,9 @@ z-index:99999;
<img src="/currentyacypeer/env/grafics/yacy.png" height="20px" width="36px"/>
<img src="/currentyacypeer/env/grafics/empty.gif" height="20px" width="20px"/>
<!--#include virtual="/currentyacypeer/interaction_elements/Document_part.html?hash=#[urlhash]#&url=#[url]#" -->
<!--#include virtual="/currentyacypeer/interaction_elements/Document_part.html?action=#[action]#&hash=#[urlhash]#&url=#[url]#" -->
<img src="/currentyacypeer/env/grafics/empty.gif" height="20px" width="20px"/>
<!--#include virtual="/currentyacypeer/interaction_elements/Tag_part.html?hash=#[urlhash]#" -->
<!--#include virtual="/currentyacypeer/interaction_elements/Tag_part.html?action=#[action]#&hash=#[urlhash]#&url=#[url]#" -->
</div>

@ -15,6 +15,8 @@ public class OverlayInteraction {
prop.put("enabled_url", post.get("url", ""));
prop.put("enabled_urlhash", post.get("urlhash", ""));
prop.put("enabled_action", post.get("action", ""));
return prop;
}

@ -16,6 +16,8 @@ public class Tag_part {
final serverObjects prop = new serverObjects();
prop.put("hash", post.get("hash", ""));
prop.put("url", post.get("url", ""));
prop.put("action", post.get("action", ""));
String vocabularies = "";

@ -1423,9 +1423,15 @@ public final class HTTPDFileHandler {
private static void doURLProxy(final serverObjects args, final HashMap<String, Object> conProp, final RequestHeader requestHeader, final OutputStream out) throws IOException {
final String httpVersion = (String) conProp.get(HeaderFramework.CONNECTION_PROP_HTTP_VER);
URL proxyurl = null;
String action = "";
if(conProp != null && conProp.containsKey("ARGS")) {
final String strARGS = (String) conProp.get("ARGS");
String strARGS = (String) conProp.get("ARGS");
if(strARGS.startsWith("action=")) {
int detectnextargument = strARGS.indexOf("&");
action = strARGS.substring (7, detectnextargument);
strARGS = strARGS.substring(detectnextargument+1);
}
if(strARGS.startsWith("url=")) {
final String strUrl = strARGS.substring(4); // strip url=
@ -1461,6 +1467,9 @@ public final class HTTPDFileHandler {
requestHeader.remove("Authorization");
requestHeader.remove("Connection");
requestHeader.put(HeaderFramework.HOST, proxyurl.getHost());
// temporarily add argument to header to pass it on to augmented browsing
requestHeader.put("YACYACTION", action);
final ByteArrayOutputStream o = new ByteArrayOutputStream();
HTTPDProxyHandler.doGet(prop, requestHeader, o);
@ -1494,9 +1503,9 @@ public final class HTTPDFileHandler {
// rewrite location header
location = outgoingHeader.get("Location");
if (location.startsWith("http")) {
location = "/proxy.html?url=" + location;
location = "/proxy.html?action="+action+"&url=" + location;
} else {
location = "/proxy.html?url=http://" + proxyurl.getHost() + "/" + location;
location = "/proxy.html?action="+action+"&url=http://" + proxyurl.getHost() + "/" + location;
}
outgoingHeader.put("Location", location);
}

@ -210,9 +210,12 @@ public class AugmentHtmlStream {
}
public static StringBuffer process (StringBuffer data, Charset charset, DigestURI url, RequestHeader requestHeader) {
String action = requestHeader.get("YACYACTION");
requestHeader.remove("YACYACTION");
globalrequestHeader = requestHeader;
Switchboard sb = Switchboard.getSwitchboard();
boolean augmented = false;
@ -377,7 +380,7 @@ public class AugmentHtmlStream {
NodeList bodychildren = bt.getChildren();
bodychildren.add(new org.htmlparser.nodes.TextNode(loadInternal("interaction_elements/OverlayInteraction.html?urlhash="+ ASCII.String(url.hash()) +"&url="+url.toNormalform(false, true), requestHeader)));
bodychildren.add(new org.htmlparser.nodes.TextNode(loadInternal("interaction_elements/OverlayInteraction.html?action="+action+"&urlhash="+ ASCII.String(url.hash()) +"&url="+url.toNormalform(false, true), requestHeader)));
bt.setChildren(bodychildren);

Loading…
Cancel
Save