• 大小: 10.5MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-11-13
  • 语言: 其他
  • 标签: websocket  示例java  

资源简介

websocket示例,这个是我在项目中使用过的,绝对好用,非maven项目,直接eclipse部署

资源截图

代码片段和文件信息

package com.java.commons;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class InterfaceFilter implements Filter {

@Override
public void doFilter(ServletRequest arg0 ServletResponse arg1 FilterChain chain) throws IOException ServletException {
HttpServletRequest request=(HttpServletRequest)arg0;
HttpServletResponse response=(HttpServletResponse)arg1;

response.setHeader(“Access-Control-Allow-Origin“ “*“);
request.setCharacterEncoding(“UTF-8“);
response.setCharacterEncoding(“UTF-8“);
response.setContentType(“application/json; charset=utf-8“);

String path = request.getContextPath();

String url = request.getRequestURI();

url = url.substring(path.length()+1);

chain.doFilter(request response);
return;
}

@Override
public void destroy() {
}

@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub

}

}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-08-16 10:43  java\
     文件         771  2017-10-16 16:38  java\.classpath
     文件        1037  2017-06-29 18:40  java\.project
     目录           0  2017-08-16 10:43  java\.settings\
     文件         567  2017-06-13 10:45  java\.settings\.jsdtscope
     文件          57  2017-06-30 14:16  java\.settings\org.eclipse.core.resources.prefs
     文件         670  2017-06-19 12:45  java\.settings\org.eclipse.jdt.core.prefs
     文件         470  2017-06-29 18:51  java\.settings\org.eclipse.wst.common.component
     文件         345  2017-06-13 10:45  java\.settings\org.eclipse.wst.common.project.facet.core.xml
     文件          49  2017-06-13 10:45  java\.settings\org.eclipse.wst.jsdt.ui.superType.container
     文件           6  2017-06-13 10:45  java\.settings\org.eclipse.wst.jsdt.ui.superType.name
     文件        1280  2017-06-19 12:32  java\.settings\org.eclipse.wst.validation.prefs
     目录           0  2017-08-16 10:43  java\build\
     目录           0  2017-10-16 16:38  java\build\classes\
     目录           0  2017-10-16 16:38  java\build\classes\com\
     目录           0  2017-10-16 16:38  java\build\classes\com\java\
     目录           0  2017-10-16 16:38  java\build\classes\com\java\commons\
     文件        1862  2017-10-16 16:38  java\build\classes\com\java\commons\InterfaceFilter.class
     目录           0  2017-10-16 16:38  java\build\classes\com\java\controller\
     文件        1269  2017-10-16 16:38  java\build\classes\com\java\controller\LoginController.class
     文件        1664  2017-10-16 16:47  java\build\classes\com\java\controller\MessageController.class
     文件        1793  2017-10-16 16:38  java\build\classes\com\java\controller\UserController.class
     目录           0  2017-10-16 16:38  java\build\classes\com\java\dao\
     文件         468  2017-10-16 16:38  java\build\classes\com\java\dao\DAO.class
     文件        3361  2017-10-16 16:38  java\build\classes\com\java\dao\DaoSupport.class
     目录           0  2017-10-16 16:38  java\build\classes\com\java\model\
     文件         861  2017-10-16 16:38  java\build\classes\com\java\model\User.class
     目录           0  2017-10-16 16:38  java\build\classes\com\java\service\
     目录           0  2017-10-16 16:38  java\build\classes\com\java\service\impl\
     文件         969  2017-10-16 16:38  java\build\classes\com\java\service\impl\UserServiceImpl.class
     文件         210  2017-10-16 16:38  java\build\classes\com\java\service\UserService.class
............此处省略95个文件信息

评论

共有 条评论