Changeset 1640
- Timestamp:
- 2000-11-01T12:19:42+13:00 (23 years ago)
- Location:
- trunk/gsdl/src/phind/client
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/src/phind/client/Phind.java
r1636 r1640 191 191 stop(); 192 192 } 193 phindcgi_address = tidy_URL(phindcgi_address, true); 193 194 System.out.println("Phind phindcgi: " + phindcgi_address); 194 195 … … 200 201 stop(); 201 202 } 203 library_address = tidy_URL(library_address, true); 202 204 System.out.println("Phind library: " + library_address); 203 205 … … 206 208 try { 207 209 backdrop_address = new String(getParameter("backdrop")); 210 backdrop_address = tidy_URL(backdrop_address, false); 208 211 URL backdrop_url = new URL(backdrop_address); 209 212 backgroundImage = getImage(backdrop_url); … … 489 492 // 490 493 // Send a query (a word or symbol number) to the server 491 // Open a socket connection to the server, send it a query, 492 // and pass the result to a ResultBox. 494 // and pass the response to a ResultBox. 493 495 494 496 void queryServer(boolean keyKnown, String word, int queryMode, ResultBox area) … … 496 498 497 499 // Build the query 498 String query = phindcgi_address + " ?x=1&c=" + collection;500 String query = phindcgi_address + "x=1&c=" + collection; 499 501 500 502 if (keyKnown) { … … 644 646 } 645 647 648 649 650 // Tidy up URLs 651 // 652 // Ensure a URL address (as string) has a protocol, host, and file. 653 // 654 // If the URL is a CGI script URL, it should be tidied up so that it is 655 // appropriate to tage attrib=value pairs on the end. This means it 656 // must either end with a "?" or (if it contains a question-mark 657 // internally) end with a "&". 658 String tidy_URL(String address, boolean isCGI) { 659 660 System.out.println("tidy URL: " + address); 661 662 // make sure the URL has protocol, host, and file 663 if (address.startsWith("http")) { 664 // the address has all the necessary components 665 } else if (address.startsWith("/")) { 666 // there is not protocol and host 667 URL document = getDocumentBase(); 668 address = "http://" + document.getHost() + address; 669 } else { 670 // this URL is relative to the dirwectory the document is in 671 URL document = getDocumentBase(); 672 String directory = document.getFile(); 673 int end = directory.lastIndexOf('/'); 674 directory = directory.substring(0,end + 1); 675 address = "http://" + document.getHost() + directory + address; 676 677 } 678 679 // if the URL is a cgi script, make sure it has a "?" 680 if (isCGI) { 681 if (address.indexOf((int) '?') == -1) { 682 address = address + "?"; 683 } else if (!address.endsWith("?")) { 684 address = address + "&"; 685 } 686 } 687 688 689 System.out.println("tidy URL returning: " + address); 690 return address; 691 } 692 646 693 } -
trunk/gsdl/src/phind/client/ResultCanvas.java
r1637 r1640 438 438 try { 439 439 String address = phind.library_address 440 + " ?a=d&c=" + phind.collection440 + "a=d&c=" + phind.collection 441 441 + "&d=" + item.rule; 442 442 url = new URL(address);
Note:
See TracChangeset
for help on using the changeset viewer.