• 大小: 582KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-24
  • 语言: Java
  • 标签: html5  摄像头  拍照  java  

资源简介

代码只是关键代码,并不能直接使用,可以拷贝到javaweb项目中使用

资源截图

代码片段和文件信息

package com.aobang.servlet.activity;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONobject;

import org.apache.commons.codec.binary.base64;

import com.aobang.util.ToUTF8;

@WebServlet(“/servlet/test“)
public class TestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
doPost(request response);
}

public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
response.setContentType(“text/html;charset=UTF-8“);
response.setCharacterEncoding(“UTF-8“);
request.setCharacterEncoding(“UTF-8“);
PrintWriter out = response.getWriter();
JSONobject jsonRes = new JSONobject();
try {
// data:image/png;base64前缀需要去掉
String base64Code = “iVBORw0KGgoAAAANSUhEUgAAAlgAAAFoCAYAAACL9IXsAAAgAElEQVR4nHS9Z3tb57mtm3+x97d9rmudvbNSnKyUlbi3xJYluZfYiW2527JkdbEXdIAkMHtF74XohQBJkVTz2r/rPh/eCRC01/kwLhDgBOYELQk3xxjP41/kqnXytQb5co18pU6hvkup0aJYbVCsNCiWdylVGlSqu1TKDSrlBuVSXXxdqVEuVymUS+RLRbKlHJlSnmypSKZUIF0qkK6UyVSrpGs1sru7pGsNlFSWuJEiYaRQjDSS6pJQLSTVJCHrSJKKklDQZBldlVF1BVmVSBgyO7rEjq6wrcpIioysqiiKhqJoSIpGQlVJaApxQ2bHlNk2JHZMmZguE1YTRDSFqK4SU3Viis6WbLAjmyiqjaq5KKqNrFhIsknCU1zS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TyQUJBoOEg77CYY2CYfWCYXW8YfW8IXWWfWtsbiyxMrKCuvrq/j96wRDm+LY8CbRiI/tLR872352Yj62o5tsR/zsxAJshQNEQ0EioTChYBi/P4jf58Pv3yQQWWdbChGMrnH99mXOvfY3nn7mrzz74gs889JL/PWlczz96puc//BrPrm6xBe31vjs+iKfXL3Nu59f4cJHX/HhdwsEtAJaqkrC+7PipMuk8jVS

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件      232771  2017-03-16 08:21  commons-codec-1.6.jar
     文件       13210  2017-03-09 15:53  photobooth_min.js
     文件        1523  2017-03-09 16:34  test.jsp
     文件      538044  2017-03-09 17:06  TestServlet.java

评论

共有 条评论