filter ServletContext
import java.io.*;
import java.net.*;
import java.util.*;
import java.text.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import javax.sql.*;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.naming.*;
public class MyFilter implements Filter {
// The filter configuration object we are associated with. If
// this value is null, this filter instance is not currently
// configured.
private FilterConfig filterConfig = null;
String category_server_ip = "";
int category_server_port = 8080;
String category_root = "";
String category_base = "";
/**
* Init method for this filter
*
*/
public void init(FilterConfig filterConfig) {
this.filterConfig = filterConfig;
ServletContext sctx = filterConfig.getServletContext();
sctx.getServletContextName();
category_server_ip = (String)sctx.getAttribute("category_server_ip");
category_server_port=stringToInt((String)
sctx.getAttribute("category_server_port"));
category_root = (String)sctx.getAttribute("category_root");
category_base = (String)sctx.getAttribute("category_base");
if (filterConfig != null) {
if(debug){
log("MyFilter :Initializing filter");
}
}
}
public MyFilter(){
}
}
'JAVA' 카테고리의 다른 글
[JAVA]filter 사용자관리 (0) | 2017.11.16 |
---|---|
[JAVA]Filter XSS Cross-Site Scripting (XSS) 필터 (0) | 2017.11.16 |
[JAVA]Filter sendRedirect (0) | 2017.11.16 |
[JAVA]Filter responseWrapper (0) | 2017.11.16 |
[JAVA]filter multpart (0) | 2017.11.16 |