资源简介
代码只是关键代码,并不能直接使用,可以拷贝到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+RLRbKlHJlSnmypSKZUIF0qkK6UyVSrpGs1sru7pGsNlFSWuJEiYaRQjDSS6pJQLSTVJCHrSJKKklDQZBldlVF1BVmVSBgyO7rEjq6wrcpIioysqiiKhqJoSIpGQlVJaApxQ2bHlNk2JHZMmZguE1YTRDSFqK4SU3Viis6WbLAjmyiqjaq5KKqNrFhIsknCU1zSSMg6ielxiosi2WiKg646aLKBKpkoskVCtYhrNtuaQ1S22NYcdnSXhJ4kobkoSkpITaJqydn5ZMVCUi0kzUHSbBKqhaK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shQNEQ0EioTChYBi/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
- 上一篇:autoitx4java.jar
- 下一篇:cec2010测试函数源码及文章
相关资源
- C#、C++、HTML5、JAVA、Python、数据结构与
- 有关Android中从图库或拍照获取头像并
- Android前置摄像头预览并检测人脸,获
- Android手机摄像头采集图片上传pc显示
- Android自动聚焦、拍照、缩放标准大小
- Android后台开启服务默默拍照
- Android实时预览摄像头、绘制浮层
- jquery 的photobooth.js JSP页面拍照插件
- (手机移动web)iscroll+html5+css3+js实现
- Android开发之拍照功能实现
- Android静默拍照
- Android 通过摄像头检测心率
- android选择图片或拍照图片上传到服务
- jsp页面实现对摄像头的调用 能录取图
- Uploadify HTML5 收费版本($5) UploadFiv
- js调用本地摄像头拍照并上传到web服务
- android 之 webView 显示h5 执行选择图片或
- WEB调用海康威视摄像头
- html5+js实现手机录音功能,支持微信等
- html5小游戏 接水果
- 使用 HTML5 webSocket API实现即时通讯的功
- android无预览静默拍照
- DroidCam谷歌Play版6.7.1
- DroidCamX 6.7(含手机端、电脑端两个文
- 安卓端DroidCamX.Wireless.Webcam.Pro.v6.4.8.
- DroidCam Wireless Webcam 电脑端和安卓版安
- 基于HTML5的网页视频播放器
- 大华摄像头视频监控OCX控件WEB3.0.接口
- 使用HTML5技术制作在线PDF阅读器
- webcam-capture-0.3.12-dist.rar
评论
共有 条评论