当前位置: 首页>>代码示例>>Java>>正文


Java Filter.destroy方法代码示例

本文整理汇总了Java中javax.servlet.Filter.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java Filter.destroy方法的具体用法?Java Filter.destroy怎么用?Java Filter.destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.servlet.Filter的用法示例。


在下文中一共展示了Filter.destroy方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMissingHostname

import javax.servlet.Filter; //导入方法依赖的package包/类
@Test
public void testMissingHostname() throws Exception {
  ServletRequest request = Mockito.mock(ServletRequest.class);
  Mockito.when(request.getRemoteAddr()).thenReturn(null);

  ServletResponse response = Mockito.mock(ServletResponse.class);

  final AtomicBoolean invoked = new AtomicBoolean();

  FilterChain chain = new FilterChain() {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
      throws IOException, ServletException {
      assertTrue(HostnameFilter.get().contains("???"));
      invoked.set(true);
    }
  };

  Filter filter = new HostnameFilter();
  filter.init(null);
  assertNull(HostnameFilter.get());
  filter.doFilter(request, response, chain);
  assertTrue(invoked.get());
  assertNull(HostnameFilter.get());
  filter.destroy();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestHostnameFilter.java

示例2: destroy

import javax.servlet.Filter; //导入方法依赖的package包/类
public void destroy()
{
  //Destroy filter services
  for(Filter f:_filters)
  {
    f.destroy();
  }

  _filters = null;
}
 
开发者ID:apache,项目名称:myfaces-trinidad,代码行数:11,代码来源:TrinidadFilterImpl.java

示例3: destroy

import javax.servlet.Filter; //导入方法依赖的package包/类
/**
 * Clean up all the filters supplied, calling each one's destroy method in turn, but in reverse order.
 *
 * @see Filter#init(FilterConfig)
 */
@Override
public void destroy() {
	for (int i = filters.size(); i-- > 0;) {
		Filter filter = filters.get(i);
		filter.destroy();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:CompositeFilter.java

示例4: hostname

import javax.servlet.Filter; //导入方法依赖的package包/类
@Test
public void hostname() throws Exception {
  ServletRequest request = Mockito.mock(ServletRequest.class);
  Mockito.when(request.getRemoteAddr()).thenReturn("localhost");

  ServletResponse response = Mockito.mock(ServletResponse.class);

  final AtomicBoolean invoked = new AtomicBoolean();

  FilterChain chain = new FilterChain() {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse)
      throws IOException, ServletException {
      // Hostname was set to "localhost", but may get resolved automatically to
      // "127.0.0.1" depending on OS.
      assertTrue(HostnameFilter.get().contains("localhost") ||
        HostnameFilter.get().contains("127.0.0.1"));
      invoked.set(true);
    }
  };

  Filter filter = new HostnameFilter();
  filter.init(null);
  assertNull(HostnameFilter.get());
  filter.doFilter(request, response, chain);
  assertTrue(invoked.get());
  assertNull(HostnameFilter.get());
  filter.destroy();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestHostnameFilter.java

示例5: destroy

import javax.servlet.Filter; //导入方法依赖的package包/类
public void destroy() {
    for (int i = filters.size(); i-- > 0;) {
        Filter filter = filters.get(i);
        filter.destroy();
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:7,代码来源:BeforeInvocationFilter.java

示例6: destroy

import javax.servlet.Filter; //导入方法依赖的package包/类
public void destroy() {
	for(Filter obj : filters){
		System.out.println("[复合Filter]-->Destroying Filter defined in ApplicationContext: '" + obj.toString() + "'");
		obj.destroy();
	}
}
 
开发者ID:v5java,项目名称:demo-cas-client,代码行数:7,代码来源:MSCompositeFilter.java

示例7: destroyDelegate

import javax.servlet.Filter; //导入方法依赖的package包/类
/**
 * Destroy the Filter delegate.
 * Default implementation simply calls {@code Filter.destroy} on it.
 * @param delegate the Filter delegate (never {@code null})
 * @see #isTargetFilterLifecycle()
 * @see javax.servlet.Filter#destroy()
 */
protected void destroyDelegate(Filter delegate) {
	if (isTargetFilterLifecycle()) {
		delegate.destroy();
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:DelegatingFilterProxy.java


注:本文中的javax.servlet.Filter.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。