package com.qbq;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.hsqldb.Server;
public class PathServlet extends HttpServlet {
private Server server = new Server();
public void destroy() {
server.shutdown();
super.destroy();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
public void init(ServletConfig config) throws ServletException {
String args[] = new String[0];
String path=config.getServletContext().getRealPath("/WEB-INF/lib/");
server.setDatabaseName(0, "test");
server.setDatabasePath(0, path);
server.setPort(8086);
server.setSilent(true);
Thread thread=new Thread(new Runnable(){
public void run() {
server.start();
}
});
thread.start();
}
}
|