我的项目是ssh,做了过滤器 <!-- 判断登陆的过滤器 -->
<filter>
<filter-name>LoginFilter</filter-name>
<filter-class>
tools.LoginFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>LoginFilter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>public class LoginFilter implements Filter { protected FilterConfig filterConfig;
protected String encodingName;
protected boolean enable; public LoginFilter() {
encodingName = "GBK";
enable = false;
} // 初始化
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
} // 每个请求设置UTF-8
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("GBK"); HttpServletRequest httprequest = (HttpServletRequest) request;
  HttpServletResponse httpresponse = (HttpServletResponse) response;
  HttpSession session = httprequest.getSession();
  ActingAdminUser user=new ActingAdminUser();
 
  RequestDispatcher dispatcher=request.getRequestDispatcher("/login.jsp");
  String type=request.getParameter("pare");
  try { //获得在session中所记录的isLogin属性,该属性由登录部分的代码写入   
   user = (ActingAdminUser) session.getAttribute("user");
   if (user!=null||(httprequest.getServletPath().startsWith("/adminUser.do")&&type.equals("login"))||httprequest.getServletPath().startsWith("/login.jsp")) //验证成功,继续处理
   {
    chain.doFilter(request, response);
   } else //验证不成功,让用户登录。
   {     
    dispatcher.forward(httprequest, httpresponse);
     
    
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
}
我的里面有上传图片和预览图片的功能,我尝试右键图片看属性复制他的地址http://localhost:8080/项目/image/15/2009/10/17_1255857006.JPG  然后退出浏览器,打开新的页面,没登陆,粘贴到地址栏,可以看到图片
一般这样没什么问题吧,如何需要限制的话过滤器怎么写呢?