亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? imageserver.java

?? 大量java源程序
?? JAVA
字號:
/*
 * @(#)ImageServer
 *
 * Copyright (c) 1998 Karl Moss. All Rights Reserved.
 *
 * You may study, use, modify, and distribute this software for any
 * purpose provided that this copyright notice appears in all copies.
 *
 * This software is provided WITHOUT WARRANTY either expressed or
 * implied.
 *
 * @author  Karl Moss
 * @version 1.0
 * @date    04Apr98
 *
 */

package javaservlets.db;

import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;

/**
 * <p>This servlet will query the database for a stored binary
 * image, read it, and return it to the client.
 */

public class ImageServer extends HttpServlet
{
  // Our connection pool. Note that instance variables are
  // actually global to all clients since there is only
  // one instance of the servlet that has multiple threads
  // of execution
  javaservlets.jdbc.ConnectionPool m_connectionPool;

  /**
    * <p>Performs the HTTP GET operation
    *
    * @param req The request from the client
    * @param resp The response from the servlet
    */

  public void doGet(HttpServletRequest req,
                    HttpServletResponse resp)
    throws ServletException, java.io.IOException
    {
      // Get the table to query
      String tableName = req.getParameter("table");

      // Get the column to query
      String columnName = req.getParameter("column");
      System.out.println("columnName: "+columnName);
      // Get the 'where' clause for the query
      String whereClause = req.getParameter("where");
      //whereClause="Empno=4";
      System.out.println("where : "+whereClause);
      // Attempt to get the image
      getImage(resp, tableName, columnName, whereClause);
    }

  /**
    * <p>Reads the database for an image and outputs that image
    * to the client
    *
    * @param resp The response from the servlet
    * @param table The name of the table containing the data
    * @param column The column name of the stored image
    * @param where The SQL where clause to uniquely identify
    * the row
    */
  private void getImage(HttpServletResponse resp,
                        String table, String column,
                        String where)
    throws java.io.IOException
    {

      // Format the SQL string
      String sql = "select " + column + " from " + table +
        " where  " +"Empno="+ where;
      System.out.println("sql="+sql);
      // The JDBC Connection object
      Connection con = null;

      // The JDBC Statement object
      Statement stmt = null;

      // The JDBC ResultSet object
      ResultSet rs = null;

      try {

        // Get an available connection from our connection pool
        con = m_connectionPool.getConnection();

        // Create a statement object that we can execute queries
        // with
        stmt = con.createStatement();

        // Execute the query
        rs = stmt.executeQuery(sql);

        // If this is an empty result set, send back a nice
        // error message
        if (!rs.next()) {
          resp.setContentType("text/html");
          // Create a PrintWriter to write the response
          java.io.PrintWriter pout =
            new java.io.PrintWriter(resp.getOutputStream());

          pout.println("No matching record found");
          pout.flush();
          pout.close();
        }

        // We have results! Read the image and write it to
        // our output stream
        resp.setContentType("image/jpeg");

        // Get the output stream
        javax.servlet.ServletOutputStream out =
          resp.getOutputStream();

        // Get an input stream to the stored image
        java.io.InputStream in = rs.getBinaryStream(1);

        // Some database systems may not be able to tell us
        // how big the data actuall is. Let's read all of it
        // into a buffer.
        java.io.ByteArrayOutputStream baos =
          new java.io.ByteArrayOutputStream();

        byte b[] = new byte[1024];
        while (true) {
          int bytes = in.read(b);

          // If there was nothing read, get out of loop
          if (bytes == -1) {
            break;
          }

          // Write the buffer to our byte array
          baos.write(b, 0, bytes);
        }

        // Now we have the entire image in the buffer. Get
        // the length and write it to the output stream
        b = baos.toByteArray();

        resp.setContentLength(b.length);
        out.write(b, 0, b.length);
        out.flush();
        out.close();
      }
      catch (Exception ex) {
        // Set the content type of the response
        resp.setContentType("text/html");

        // Create a PrintWriter to write the response
        java.io.PrintWriter pout =
          new java.io.PrintWriter(resp.getOutputStream());

        pout.println("Exception!");
        ex.printStackTrace(pout);
        pout.flush();
        pout.close();
      }
      finally {
        try {
          // Always close properly
          if (rs != null) {
            rs.close();
          }
          if (stmt != null) {
            stmt.close();
          }
          if (con != null) {
            // Put the connection back into the pool
            m_connectionPool.close(con);
          }
        }
        catch (Exception ex) {
          // Ignore any errors here
        }
      }

    }

  /**
    * <p>Initialize the servlet. This is called once when the
    * servlet is loaded. It is guaranteed to complete before any
    * requests are made to the servlet
    *
    * @param cfg Servlet configuration information
    */

  public void init(ServletConfig cfg)
    throws ServletException
    {
      super.init(cfg);

      // Create our connection pool
      m_connectionPool = new javaservlets.jdbc.ConnectionPool();

      // Initialize the connection pool. This will start all
      // of the connections as specified in the connection
      // pool configuration file
      try {
        m_connectionPool.initialize();
      }
      catch (Exception ex) {
        // Convert the exception
        ex.printStackTrace();
        throw new ServletException
          ("Unable to initialize connection pool");
      }
    }

  /**
    * <p>Destroy the servlet. This is called once when the servlet
    * is unloaded.
    */

  public void destroy()
    {
      // Tear down our connection pool if it was created
      if (m_connectionPool != null) {
        m_connectionPool.destroy();
      }
      super.destroy();
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩小说| 国产成人鲁色资源国产91色综 | 欧美精品自拍偷拍| 亚洲妇熟xx妇色黄| 9191久久久久久久久久久| 日本午夜精品视频在线观看| 日韩欧美的一区| 国产成人精品午夜视频免费| 中日韩av电影| 日本高清不卡在线观看| 亚洲丶国产丶欧美一区二区三区| 欧美三级资源在线| 美国欧美日韩国产在线播放| 久久综合色鬼综合色| 国产91综合一区在线观看| 中文字幕一区二区三区av| 欧美一a一片一级一片| 美女视频网站久久| 精品对白一区国产伦| 成人av午夜电影| 一片黄亚洲嫩模| 日韩三级视频在线看| 国产不卡视频一区二区三区| 亚洲综合男人的天堂| 日韩欧美电影一区| caoporm超碰国产精品| 石原莉奈在线亚洲三区| 久久久美女艺术照精彩视频福利播放| 91丨porny丨首页| 日本不卡中文字幕| 亚洲人成7777| www欧美成人18+| 在线免费观看视频一区| 国产麻豆欧美日韩一区| 亚洲影视资源网| 国产日韩精品一区二区三区在线| 色婷婷一区二区| 国产精品一区在线观看你懂的| 亚洲色图一区二区三区| 精品国产乱码久久久久久免费| 色999日韩国产欧美一区二区| 久久se精品一区精品二区| 亚洲精品va在线观看| 国产亚洲一本大道中文在线| 9191成人精品久久| 91美女片黄在线| 国产乱码精品一区二区三区av| 亚洲一区电影777| 国产精品久久久爽爽爽麻豆色哟哟 | 三级成人在线视频| 中文字幕在线不卡一区二区三区| 91麻豆精品91久久久久久清纯| 国产成人8x视频一区二区| 天堂va蜜桃一区二区三区 | 亚洲欧美日韩国产手机在线| 日韩免费视频一区二区| 欧美日韩1区2区| 欧美成人精品福利| 欧美性猛片xxxx免费看久爱| 成人国产精品视频| 国产精一品亚洲二区在线视频| 日本免费新一区视频| 一区二区三区中文在线观看| 国产日韩欧美制服另类| 精品毛片乱码1区2区3区 | 欧美mv日韩mv| 欧美日韩视频专区在线播放| 色综合色狠狠综合色| 国产99久久久国产精品免费看 | 日韩亚洲欧美在线| 制服.丝袜.亚洲.另类.中文 | 欧美一区二区成人6969| 欧美群妇大交群中文字幕| 色综合久久综合中文综合网| 风间由美中文字幕在线看视频国产欧美| 加勒比av一区二区| 激情另类小说区图片区视频区| 青青国产91久久久久久| 日日骚欧美日韩| 同产精品九九九| 丝袜美腿亚洲一区二区图片| 日本一区中文字幕| 美女网站视频久久| 久草热8精品视频在线观看| 精品一区二区三区免费毛片爱| 男女男精品视频| 秋霞电影网一区二区| 精品无人码麻豆乱码1区2区 | 性做久久久久久免费观看| 亚州成人在线电影| 奇米影视7777精品一区二区| 美女免费视频一区二区| 久久成人av少妇免费| 精品一区在线看| 丰满白嫩尤物一区二区| 91视频精品在这里| 欧美三区在线观看| 欧美tk丨vk视频| 中文字幕 久热精品 视频在线| 国产精品萝li| 亚洲制服丝袜一区| 麻豆国产欧美一区二区三区| 国产麻豆精品视频| 色婷婷综合五月| 日韩一区二区三区视频在线观看| 久久精品夜色噜噜亚洲aⅴ| 综合av第一页| 五月激情六月综合| 国产一区二区电影| 91福利精品第一导航| 欧美白人最猛性xxxxx69交| 欧美激情一区二区三区在线| 亚洲一区中文在线| 国产美女主播视频一区| 在线视频一区二区免费| 精品国产乱码久久久久久免费| 1区2区3区国产精品| 欧美aaaaa成人免费观看视频| 国产精品18久久久久久久网站| 91在线视频播放| 日韩精品影音先锋| 亚洲乱码国产乱码精品精的特点| 青青草视频一区| 99精品国产视频| 日韩精品一区二区三区视频在线观看 | 轻轻草成人在线| 99久久精品一区二区| 4438x成人网最大色成网站| 国产亚洲一区二区三区四区| 亚洲午夜免费视频| 粉嫩aⅴ一区二区三区四区五区| 欧美日韩一区二区电影| 亚洲国产精品传媒在线观看| 亚洲成人免费观看| 成人性视频免费网站| 91精品蜜臀在线一区尤物| 国产精品丝袜一区| 美女免费视频一区二区| 91国偷自产一区二区三区观看| www一区二区| 日韩国产欧美在线观看| 色综合天天综合色综合av| 久久在线观看免费| 日韩经典中文字幕一区| 99久久精品国产精品久久| 久久一区二区三区国产精品| 午夜欧美电影在线观看| 91蝌蚪porny| 国产精品入口麻豆原神| 国产一区欧美二区| 日韩一区二区三区视频在线观看| 亚洲国产精品人人做人人爽| 成人va在线观看| 欧美国产一区在线| 国产精品123区| 亚洲精品一线二线三线无人区| 日日夜夜精品免费视频| 欧美日本韩国一区二区三区视频| 亚洲素人一区二区| 高清国产一区二区| 久久久久久久久久久电影| 国内精品免费**视频| 日韩精品影音先锋| 精品一区二区三区在线观看| 欧美一区二区三级| 日本亚洲一区二区| 日韩视频免费观看高清完整版 | 国产呦萝稀缺另类资源| 欧美一区二区日韩一区二区| 日韩电影免费在线看| 337p亚洲精品色噜噜噜| 蜜臀av一区二区| 日韩免费观看高清完整版在线观看| 喷水一区二区三区| 精品电影一区二区| 国产美女在线观看一区| 国产欧美日本一区二区三区| 东方aⅴ免费观看久久av| 日本一区免费视频| 91在线视频18| 亚洲成av人在线观看| 欧美一区二区久久| 国产精品亚洲综合一区在线观看| 中文字幕乱码一区二区免费| 97国产精品videossex| 亚洲自拍都市欧美小说| 欧美剧情电影在线观看完整版免费励志电影| 亚洲午夜精品久久久久久久久| 在线不卡一区二区| 激情综合色综合久久综合| 国产欧美一区在线| 色94色欧美sute亚洲线路二 | 亚洲网友自拍偷拍| 欧美精品1区2区| 国产精品系列在线观看| 亚洲欧美综合网| 欧美精品乱码久久久久久| 久久精品国产99国产| 欧美国产视频在线| 色老汉一区二区三区|