home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / bb98.exe / SOword.java < prev    next >
Text File  |  2002-11-09  |  2KB  |  94 lines

  1. //
  2. // The contents of this file are subject to the BadBlue End User License
  3. // Agreement (the "EULA"); you may not use this file except in
  4. // compliance with the EULA.  You may obtain a copy of the EULA at
  5. // http://badblue.com/down.htm .
  6. //
  7. // Software distributed under the EULA is distributed on an "AS IS" basis,
  8. // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the EULA
  9. // for the specific language governing rights and limitations under the
  10. // EULA.
  11. //
  12. // The Initial Developer of this code under the EULA is Working Resources,
  13. // Inc., Atlanta, GA  UNITED STATES.  All Rights Reserved.
  14. //
  15.  
  16. //
  17. package ShareOffice;
  18.  
  19. //
  20. import java.net.*;
  21. import java.io.*;
  22. import ShareOffice.HTTPGet;
  23. import ShareOffice.SOinit;
  24.  
  25. //
  26. public class SOword extends SOinit {
  27.     //
  28.     public SOword() {
  29.     }
  30.     //    Retrieve Word file in HTML format.
  31.     //    Inputs:
  32.     //        sAddr: address of BadBlue server (e.g., "127.0.0.1:8080")
  33.     //        sPath: path of shared file in EXT.INI file (e.g., "path3")
  34.     //        sFile: name of Excel file to examine (e.g., "invoice.xls")
  35.     //        sUser: (optional) user-name to get access to file
  36.     //        sPassword: (optional) password to get access to file
  37.     //    Outputs:
  38.     //        sDoc:  string variable consisting of HTML document or
  39.     //                error message in plain-text
  40.     //
  41.     public String GetWordDocument(
  42.         String        sAddr,
  43.         String        sPath,
  44.         String        sFile,
  45.         String        sUser,
  46.         String        sPassword
  47.     ) {
  48.         String        sDoc;
  49.         String        sError = "";
  50.         try {
  51.  
  52.             //    General setup.
  53.             //
  54.             sDoc = new String();
  55.  
  56.             //    Construct the URL and read it.
  57.             //
  58.             String sURL = 
  59.                 "http://"+sAddr+"/ext.dll?MfcISAPICommand=LoadPage&"+
  60.                 "page=doc.htx&a0=/get/"+sPath+"/"+URLEncoder.encode(sFile, "UTF-8")+
  61.                 "&a1=_&a2=2048&a3=8&a4=1";
  62.  
  63. System.out.println("\r\n"+sURL+"\r\n");
  64.  
  65.             HTTPGet h = new HTTPGet();
  66. // sUser = "";
  67.             if (sUser.length() > 0) {
  68.                 sDoc = h.Read(sURL, sUser, sPassword);
  69.             } else {
  70.                 sDoc = h.Read(sURL);
  71.             }
  72.             return (sDoc);
  73.  
  74.         //    ...end SP.
  75.         //
  76.         } catch (StringIndexOutOfBoundsException e) {
  77.             sDoc = "Error: string out of bounds: " + e.getMessage();
  78.             return (sDoc);
  79.  
  80.         //    ...end SP.
  81.         //
  82.         } catch (Exception e) {
  83.             sDoc = "Error: no data available: " + e.getMessage();
  84.             return (sDoc);
  85.         }
  86.     }
  87.  
  88.     //    Private members.
  89.     //
  90. }
  91.  
  92. //    <EOF>
  93. //
  94.