home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 November / APCD25112k.iso / feature / webserv / SAMBAR43.ZIP / _SETUP.1 / javaeng.jar / com / sambar / javaeng / SambarAPI.java < prev    next >
Encoding:
Java Source  |  2000-04-03  |  3.8 KB  |  99 lines

  1. /*
  2. **         Sambar Server JAVA Engine Implementation
  3. **
  4. **        Confidential Property of Tod Sambar
  5. **        (c) Copyright Tod Sambar 1999
  6. **        All rights reserved.
  7. */
  8. package com.sambar.javaeng;
  9.  
  10. import java.io.*;
  11. import java.net.*;
  12. import java.util.*;
  13. import java.util.Enumeration;
  14.  
  15. /* 
  16. ** Access to Sambar API via native methods
  17. */
  18. public class SambarAPI 
  19. {
  20.     static 
  21.     {
  22.         System.out.println("Loading javaeng library");
  23.  
  24.         try 
  25.         {
  26.             System.loadLibrary("sambarje");
  27.         }
  28.         catch(Exception ex) 
  29.         {
  30.             ex.printStackTrace();
  31.         }
  32.  
  33.         System.out.println("Done loading javaeng library");
  34.     }
  35.  
  36.     // -------------------- Internal codes --------------------
  37.     public final static int FAIL = 0;
  38.     public final static int SUCCEED = 1;
  39.  
  40.     // -------------------- Engine defines --------------------
  41.     public final static String SESSION_ID = "JAVAENGID";
  42.  
  43.     // -------------------- Generic methods --------------------
  44.     public static native void       log(long req, String message);
  45.     public static native void       logctx(long javaeng, String message);
  46.     public static native void       putb(long req, int val);
  47.     public static native void       puts(long req, String text);
  48.     public static native void       flush(long req);
  49.     public static native void       close(long req);
  50.     public static native void       sendError(long req, int status, String msg);
  51.  
  52.     // -------------------- ServletContext methods --------------------
  53.     public static native String     getMimeType(long javaeng, String file);
  54.     public static native String     getInitParameter(long javaeng, String name);
  55.     public static native String     getRealPath(long javaeng, String path);
  56.     public static native String     getServerInfo(long javaeng);
  57.     public static native String     getServletsPath(long javaeng);
  58.     public static native String     getGenericServlet(long javaeng);
  59.  
  60.     // -------------------- ServletRequest methods --------------------
  61.     public static native String     getServletName(long req);
  62.     public static native byte []     getContent(long req);
  63.     public static native int        getContentLength(long req);
  64.     public static native String     getContentType(long req);
  65.     public static native String     getParameter(long req, String name);
  66.     public static native void         setParameter(long req, String name, String val);
  67.     public static native int        getParameterCount(long req);
  68.     public static native String        getParameterName(long req, int pos);
  69.     public static native String        getParameterValue(long req, int pos);
  70.     public static native String     getProtocol(long req);
  71.     public static native String     getScheme(long req);
  72.     public static native String     getHostname(long req);
  73.     public static native String     getServerName(long req);
  74.     public static native int        getServerPort(long req);
  75.     public static native String     getRemoteAddr(long req);
  76.     public static native String     getRemoteHost(long req);
  77.  
  78.     // -------------------- HTTPServletRequest methods --------------------
  79.     public static native String     getAuthType(long req);
  80.     public static native String     getAuthPass(long req);
  81.     public static native String     getHeader(long req, String name);
  82.     public static native int         wasHeaderSent(long req);
  83.     public static native String     getMethod(long req);
  84.     public static native String     getPathInfo(long req);
  85.     public static native String     getPathTranslated(long req);
  86.     public static native String     getQueryString(long req);
  87.     public static native String     getRemoteUser(long req);
  88.     public static native String     getRequestURI(long req);
  89.     public static native String     getServletPath(long req);
  90.     public static native String     getContextPath(long req);
  91.  
  92.     // -------------------- SambarRequest methods --------------------
  93.     public static native int         isSambarAdmin(long req);
  94.     public static native int         isSambarUser(long req);
  95.  
  96.     // -------------------- SambarResponse methods --------------------
  97.     public static native int         setKeepAlive(long req);
  98. }
  99.