當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。