java中日志的若干问题

来源:互联网 发布:web前端开发和java 编辑:程序博客网 时间:2024/05/22 07:31

java中日志的若干问题

简单记录下做日志的几个问题:

1  明确思路 

明确调用什么接口以及所需传入的参数:

     如图接口描述:





2 编写的日志工具LogUtil

    2.1 上传参数到指定接口

code如下,仅供参考。参数自定,HttpClientUtils也是自己定义的。

import net.sf.json.JSONObject;import org.apache.log4j.Logger;import javax.servlet.http.HttpServletRequest;import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.*;public final class LogUtil {private static final Logger logger = Logger.getLogger(LogUtil.class);public static final int GAMEBOX_MANAGER_SYSTEM_ID = 1;public static final int APPSTORE_MANAGER_SYSTEM_ID = 2;//调用的日志记录接口private static final String url = "*********";public static void sendLog(int systemId, int  moduleId, String objectName, String objectId, String optType,   HttpServletRequest request) {try {Map<String, String> map = new HashMap<>();map.put("systemId", String.valueOf(systemId));map.put("moduleId", String.valueOf(moduleId));map.put("objectName", objectName);map.put("objectId", objectId);map.put("optType", optType);AdminUser adminUser = (AdminUser) request.getSession(true).getAttribute("adminUser");String optAccount = "unknown";if(adminUser != null) {optAccount = adminUser.getUsername();}map.put("optAccount", optAccount);DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String optTimeStr = format.format(new Date());map.put("optTime", optTimeStr);String result = HttpClientUtils.httpGet(url, map);JSONObject json = JSONObject.fromObject(result);if (json.getInt("code") != 1) {logger.error("提交日志异常: " + result);}} catch (Exception e) {logger.error(e);}}public static void sendLog(int  moduleId, String objectName, String objectId, String optType,  HttpServletRequest request){sendLog(GAMEBOX_MANAGER_SYSTEM_ID, moduleId, objectName, objectId, optType, request);}private LogUtil() {}}


HttpClientUtils的code如下参考:

import java.io.BufferedReader;import java.io.IOException;import java.io.InputStream;import java.io.InputStreamReader;import java.io.UnsupportedEncodingException;import java.net.HttpURLConnection;import java.net.MalformedURLException;import java.net.URL;import java.net.URLConnection;import java.net.URLEncoder;import java.util.List;import java.util.Map;import java.util.Set;import org.apache.commons.httpclient.Header;import org.apache.commons.httpclient.HttpClient;import org.apache.commons.httpclient.HttpException;import org.apache.commons.httpclient.HttpMethod;import org.apache.commons.httpclient.methods.GetMethod;import org.apache.commons.httpclient.methods.HeadMethod;import org.apache.commons.httpclient.methods.PostMethod;import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;import org.apache.commons.httpclient.methods.multipart.Part;import org.apache.commons.httpclient.params.HttpMethodParams;import org.apache.commons.lang.StringUtils;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import com.google.common.collect.Sets;public final class HttpClientUtils {private static final Logger log = LoggerFactory.getLogger(HttpClientUtils.class);public static final String USER_AGENT = "HttpClient/3.1/PP";public static final int UNKNOWN_HTTP_CODE = 600;public static Long getLastModified(String urlAsStr){int code = 200;long timestamp = System.currentTimeMillis();try{URL url = new URL(urlAsStr); URLConnection urlc = url.openConnection();return urlc.getLastModified();}catch(Exception ex){log.error("Fail to get last-modified: {}", new Object[]{urlAsStr}, ex);}return null;}public static final String httpGet(String url){HttpClient client = new HttpClient();client.getHttpConnectionManager().getParams().setConnectionTimeout(2000); GetMethod method = new GetMethod(url);method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET,"utf-8");method.addRequestHeader("User-Agent", USER_AGENT);long timestamp = System.currentTimeMillis();int code = UNKNOWN_HTTP_CODE;try {code = client.executeMethod(method);String msg = method.getResponseBodyAsString();return msg;} catch (HttpException e) {log.error("httpGet error with url: " + url);} catch (IOException e) {log.error("httpGet error with url: " + url);}return null;}public static final String httpGet(String url, Map<String, String> params){return httpGet(url, params, null);}public static final int httpGetReturnCode(String url, Map<String, String> params){return httpGetReturnCode(url, params, null);}public static final int httpGetReturnCode(String url){return httpGetReturnCode(url, null);}public static final String httpGetNTimes(String url, Map<String, String> params, int times){return httpGetNTimes(url, params, null, times);}public static final String httpGetNTimes(String url, Map<String, String> params, Map<String, String> headers, int times){for(int i = 0; i<times; ++i){String response = httpGet(url, params, headers);if(response != null){return response;}}return null;}public static final String httpPostNTimes(String url, Map<String, String> params, int times){return httpPostNTimes(url, params, null, times);}public static final String httpPostNTimes(String url, Map<String, String> params, Map<String, String> headers, int times){for(int i = 0; i<times; ++i){String response = httpPost(url, params, headers);if(response != null){return response;}}return null;}public static final Map<String, Object> httpGetNTimesToMap(String url, Map<String, String> params, int times){return httpGetNTimesToMap(url, params, null, times);}public static final Map<String, Object> httpGetNTimesToMap(String url, Map<String, String> params, Map<String, String> headers, int times){String response = httpGetNTimes(url, params, headers, times);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}Map<String ,Object> responseMap = JSONUtil.decodeJsonToMap(response);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final List<Object> httpGetNTimesToList(String url, Map<String, String> params, int times){return httpGetNTimesToList(url, params, null, times);}public static final List<Object> httpGetNTimesToList(String url, Map<String, String> params, Map<String, String> headers, int times){String response = httpGetNTimes(url, params, headers, times);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}List<Object> responseMap = JSONUtil.decodeJsonToList(response);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final Object httpGetNTimesToObject(String url, Map<String, String> params, int times){return httpGetNTimesToObject(url, params, null, times);}public static final Object httpGetNTimesToObject(String url, Map<String, String> params, Map<String, String> headers, int times){String response = httpGetNTimes(url, params, headers, times);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}Object responseMap = JSONUtil.decodeJson(response, Object.class);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final int httpGetReturnCode(String url, Map<String, String> params, Map<String, String> headers){HttpClient client = new HttpClient();String fullurl = buildGetUrl(url, params);GetMethod method = new GetMethod(fullurl);if(headers != null){for (Map.Entry<String, String> en : headers.entrySet()) {method.addRequestHeader(en.getKey(), en.getValue());}}method.addRequestHeader("User-Agent", USER_AGENT);int code = 0;try {code = client.executeMethod(method);} catch (Exception e) {log.error("httpGetReturnCode,get code err",e);}return code;}public static final String httpGet(String url, Map<String, String> params, Map<String, String> headers){HttpClient client = new HttpClient();String fullurl = buildGetUrl(url, params);GetMethod method = new GetMethod(fullurl);if(headers != null){for (Map.Entry<String, String> en : headers.entrySet()) {method.addRequestHeader(en.getKey(), en.getValue());}}method.addRequestHeader("User-Agent", USER_AGENT);long timestamp = System.currentTimeMillis();int code = UNKNOWN_HTTP_CODE;try {code = client.executeMethod(method);if(isValidHttpCode(code)){return readFullResponseBody(method);}else{log.error("Http response code(" + code + ") is not 200 when get " + fullurl + " with parameters " + params);}} catch (HttpException e) {log.error("Unexpected HttpException when http get " + fullurl + " with parameters " + params, e);} catch (IOException e) {log.error("Unexpected IOException when http get " + fullurl + " with parameters " + params, e);} return null;}public static final InputStream httpGetAsStream(String url, Map<String, String> params){HttpClient client = new HttpClient();String fullurl = buildGetUrl(url, params);GetMethod method = new GetMethod(fullurl);method.addRequestHeader("User-Agent", USER_AGENT);long timestamp = System.currentTimeMillis();int code = UNKNOWN_HTTP_CODE;try {code = client.executeMethod(method);if(isValidHttpCode(code)){return method.getResponseBodyAsStream();}else{log.error("Http response code(" + code + ") is not 200 when get " + fullurl + " with parameters " + params);}} catch (HttpException e) {log.error("Unexpected HttpException when http get " + fullurl + " with parameters " + params, e);} catch (IOException e) {log.error("Unexpected IOException when http get " + fullurl + " with parameters " + params, e);} return null;}public static final Header[] httpHead(String url){return httpHead(url, null, null);}public static final Header[] httpHead(String url, Map<String, String> params){return httpHead(url, params, null);}public static final Header[] httpHead(String url, Map<String, String> params, Map<String, String> headers){HttpClient client = new HttpClient();String fullurl = buildGetUrl(url, params);HeadMethod method = new HeadMethod(fullurl);if(headers != null){for (Map.Entry<String, String> en : headers.entrySet()) {method.addRequestHeader(en.getKey(), en.getValue());}}method.addRequestHeader("User-Agent", USER_AGENT);long timestamp = System.currentTimeMillis();int code = UNKNOWN_HTTP_CODE;try {code = client.executeMethod(method);if(isValidHttpCode(code)){return method.getResponseHeaders();}else{log.error("Http response code(" + code + ") is not 200 when get " + fullurl + " with parameters " + params);}} catch (HttpException e) {log.error("Unexpected HttpException when http get " + fullurl + " with parameters " + params, e);} catch (IOException e) {log.error("Unexpected IOException when http get " + fullurl + " with parameters " + params, e);} return null;}private static final Set<Integer> INVALID_HTTP_CODES = Sets.newHashSet(499, 500, 502, 403, 404);public static final boolean isValidHttpCode(int code){return !INVALID_HTTP_CODES.contains(code);}public static String buildGetUrl(String url, Map<String, String> params) {return params == null || params.isEmpty() ? url : new StringBuilder(256).append(url).append("?").append(urlencode(params)).toString();}public static final Map<String, Object> httpPostToMap(String url, Map<String, String> params){String response = HttpClientUtils.httpPost(url, params, null);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}Map<String ,Object> responseMap = JSONUtil.decodeJsonToMap(response);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final List<Object> httpPostToList(String url, Map<String, String> params){String response = HttpClientUtils.httpPost(url, params, null);if(response == null){log.error("Failed to http post "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}List<Object> responseMap = JSONUtil.decodeJsonToList(response);if(responseMap == null){log.error("Some error happens when getting json from "+url+ " with post parameters " + params + ", the repsonse is " + response);return null;}return responseMap;}public static final Object httpGetToObject(String url, Map<String, String> params){String response = HttpClientUtils.httpGet(url, params, null);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}Object responseMap = JSONUtil.decodeJson(response, Object.class);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final Object httpPostToObject(String url, Map<String, String> params){String response = HttpClientUtils.httpPost(url, params, null);if(response == null){log.error("Failed to http get "+HttpClientUtils.buildGetUrl(url, params) + " for 3 times, please check your network");return null;}Object responseMap = JSONUtil.decodeJson(response, Object.class);if(responseMap == null){log.error("Some error happens when getting json from "+HttpClientUtils.buildGetUrl(url, params) + ", the repsonse is " + response);return null;}return responseMap;}public static final String httpPost(String url, Map<String, String> params){return httpPost(url, params, null);}public static final String httpPost(String url, Map<String, String> params, Map<String, String> headers){HttpClient client = new HttpClient();PostMethod method = new PostMethod(url);if(params != null){for (Map.Entry<String, String> en : params.entrySet()) {if(en.getValue() != null){method.addParameter(en.getKey(), en.getValue());}}}if(headers != null){for (Map.Entry<String, String> en : headers.entrySet()) {method.addRequestHeader(en.getKey(), en.getValue());}}method.addRequestHeader("User-Agent", USER_AGENT);long timestamp = System.currentTimeMillis();int code = UNKNOWN_HTTP_CODE;try {method.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");  method.getParams().setParameter(HttpMethodParams.HTTP_URI_CHARSET, "UTF-8");code = client.executeMethod(method);if(isValidHttpCode(code)){return readFullResponseBody(method);}else{String fullurl = buildGetUrl(url, params);log.error("Http response code(" + code + ") is not 200 when post " + fullurl + " with parameters " + params);}} catch (HttpException e) {String fullurl = buildGetUrl(url, params);log.error("Unexpected HttpException when http post " + fullurl + " with parameters " + params, e);} catch (IOException e) {String fullurl = buildGetUrl(url, params);log.error("Unexpected IOException when http post " + fullurl + " with parameters " + params, e);}return null;}public static final String readFullResponseBody(HttpMethod method){BufferedReader reader = null;try{StringBuilder sb = new StringBuilder(256);reader = new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream(),"utf-8"));for(String line = reader.readLine(); line != null; line = reader.readLine()){sb.append(line).append('\n');}return sb.toString().trim();}catch(IOException ex){log.error("Unexpected IOException when read http response", ex);return null;}}public static final String urlencode(String value){if(StringUtils.isBlank(value)){return "";}try {return URLEncoder.encode(value, "UTF-8");} catch (UnsupportedEncodingException e) {log.error("Fail to encode string " + value + " with UTF-8");return value;}}public static final String urlencode(Map<String, String> params){if(params == null || params.isEmpty()){return null;}StringBuilder sb = new StringBuilder();for(Map.Entry<String, String> en : params.entrySet()){sb.append(urlencode(en.getKey())).append("=").append(urlencode(en.getValue())).append("&");}sb.setLength(sb.length() - 1);return sb.toString();}public static final boolean isValidLink(String link){URL url;try { url = new URL(link); HttpURLConnection connt = (HttpURLConnection)url.openConnection(); connt.setRequestMethod("HEAD"); String strMessage = connt.getResponseMessage(); if (strMessage.compareTo("Not Found") == 0) { return false; } connt.disconnect();} catch (MalformedURLException e) {log.error("url is not valid:" + link);return false;} catch (IOException e) {log.error("url is not valid:"+ link);return false;}return true;}public static Map<String, Object> postMultipartToMap(String url, Part[] parts, HttpClient client) {PostMethod postMethod = new PostMethod(url);    long timestamp = System.currentTimeMillis();        Map<String,Object> responseMap = null;        try {        postMethod.addRequestHeader("User-Agent", USER_AGENT);                //对于MIME类型的请求,httpclient建议全用MulitPartRequestEntity进行包装            MultipartRequestEntity mre = new MultipartRequestEntity(parts, postMethod.getParams());            postMethod.setRequestEntity(mre);            client.getHttpConnectionManager().getParams().setConnectionTimeout(10000);// 设置连接时间            int status = client.executeMethod(postMethod);            if (isValidHttpCode(status)) {            String responeBody = readFullResponseBody(postMethod);            responseMap = JSONUtil.decodeJsonToMap(responeBody);//                System.out.println(postMethod.getResponseBodyAsString());            }else{            log.info("respons status is :"+status + ", url:" + url);            }         } catch (Exception e) {        log.info(e.getLocalizedMessage());        } finally {            //释放连接            postMethod.releaseConnection();            log.info("send file end, total time is {}",System.currentTimeMillis() - timestamp);        }        return responseMap;}}


2.2 使用输入输出流保存日志到 txt文件中

上传指定参数:

public  void saveLog(long uid, String nonce, String authcookie,long qipuId, String machineId, String resultCode){PrintStream  ps = null;File file = null;try {file = new File(LOGFILE_PATH  + "LogInfo.txt");if( !file.exists() ){file.createNewFile();}DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String optDate = df.format(new Date());ps = new PrintStream (new FileOutputStream(file, true),true);ps.println("【Log】" + optDate + " uid:" + uid + " ,nonce:" + nonce +" ,authcookie:" + authcookie +" ,qipu_id:" + qipuId +" ,machine_id:" + machineId + " ,ajaxResult_code:" + resultCode);} catch (FileNotFoundException e) {e.printStackTrace();} catch (IOException e) {e.printStackTrace();}finally{if(ps != null){try {ps.close();} catch (Exception e) {e.printStackTrace();}}}}

也可以存储URL 和 JSON 串信息来得到信息:

//暂时放在D盘private static final String LOGFILE_PATH = "D:\\";public static void saveLog(String requestUrl, String response){PrintStream ps = null;File file = null;try {file = new File(LOGFILE_PATH  + "LogInfo.txt");if( !file.exists() ){file.createNewFile();}DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");String optDate = df.format(new Date());ps = new PrintStream (new FileOutputStream(file, true),true);ps.println(optDate+ " request:"+ requestUrl + " response:" +response);} catch (FileNotFoundException e) {e.printStackTrace();}catch (IOException e) {e.printStackTrace();}finally{if(ps != null){try {ps.close();} catch (Exception e) {e.printStackTrace();}}}}

以下是存储请求信息和和一些JSON信息:

public String getItem(HttpServletRequest request, HttpServletResponse response){//省略内容...//完整的url地址:http://localhost:8080/sub.action?name=aaa&age=12String requestUrl = request.getRequestURL().toString() + "?" + request.getQueryString();String jsonResponse = createJsonResponse(....);//记录日志LogUtil.saveLog(requestUrl, jsonResponse);}

2.3 使用Log4j将信息输入到指定文件:

log4j.rootLogger=INFO, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayoutlog4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} [%p]%m%n# aa接口Venus日志log4j.logger.checkplay=INFO, aalog4j.appender.checkplay=org.apache.log4j.RollingFileAppenderlog4j.appender.checkplay.File=/*/*/*/info.loglog4j.appender.checkplay.MaxFileSize=1MBlog4j.appender.checkplay.MaxBackupIndex=100log4j.appender.checkplay.layout=org.apache.log4j.PatternLayoutlog4j.appender.checkplay.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %m%n


对应接口中记录日志:
org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("interface111");AjaxResult ajaxResult = ***;
String requestUrl = request.getRequestURI() + "?" + request.getQueryString();if(!ajaxResult.getCode().equals(ApiCode.SUCCESS)){String tempErrorJsonResponse = createErrorResponse(ajaxResult.getCode(), ajaxResult.getMsg(), request);logger.info("uid:" + uid + " request:" + requestUrl + " response:" + tempErrorJsonResponse);return tempErrorJsonResponse;}String tempSuccessJsonResponse = createSuccessResponse(ajaxResult.getData(), request);logger.info("uid:" + uid + " request:" + requestUrl + " response:" + tempSuccessJsonResponse);return tempSuccessJsonResponse;


3 遇到的困惑:

当页面中账号放入在session中,想要获取这个账号的时候:

AdminUser adminUser = (AdminUser)request.getSession(true).getAttribute("adminUser");String optAccount = adminUser.getUsername();

4 测试

当在main方法中需要测试某个方法,而这个方法又带有HttpRequest的时候,可以自行创建HttpReques,在getAttribute()方法中进行模拟:

public static void main(String[] args) {sendLog(3, "角色扮演", 104, "编辑", new Date(),new HttpServletRequest() {@Overridepublic String getAuthType() {return null;}@Overridepublic Cookie[] getCookies() {return new Cookie[0];}@Overridepublic long getDateHeader(String s) {return 0;}@Overridepublic String getHeader(String s) {return null;}@Overridepublic Enumeration getHeaders(String s) {return null;}@Overridepublic Enumeration getHeaderNames() {return null;}@Overridepublic int getIntHeader(String s) {return 0;}@Overridepublic String getMethod() {return null;}@Overridepublic String getPathInfo() {return null;}@Overridepublic String getPathTranslated() {return null;}@Overridepublic String getContextPath() {return null;}@Overridepublic String getQueryString() {return null;}@Overridepublic String getRemoteUser() {return null;}@Overridepublic boolean isUserInRole(String s) {return false;}@Overridepublic Principal getUserPrincipal() {return null;}@Overridepublic String getRequestedSessionId() {return null;}@Overridepublic String getRequestURI() {return null;}@Overridepublic StringBuffer getRequestURL() {return null;}@Overridepublic String getServletPath() {return null;}@Overridepublic HttpSession getSession(boolean b) {return new HttpSession() {@Overridepublic long getCreationTime() {return 0;}@Overridepublic String getId() {return null;}@Overridepublic long getLastAccessedTime() {return 0;}@Overridepublic ServletContext getServletContext() {return null;}@Overridepublic void setMaxInactiveInterval(int i) {}@Overridepublic int getMaxInactiveInterval() {return 0;}@Overridepublic HttpSessionContext getSessionContext() {return null;}@Overridepublic Object getAttribute(String s) {return new AdminUser() {@Overridepublic String getUsername() {return "wucao";}};}@Overridepublic Object getValue(String s) {return null;}@Overridepublic Enumeration getAttributeNames() {return null;}@Overridepublic String[] getValueNames() {return new String[0];}@Overridepublic void setAttribute(String s, Object o) {}@Overridepublic void putValue(String s, Object o) {}@Overridepublic void removeAttribute(String s) {}@Overridepublic void removeValue(String s) {}@Overridepublic void invalidate() {}@Overridepublic boolean isNew() {return false;}};}@Overridepublic HttpSession getSession() {return null;}@Overridepublic boolean isRequestedSessionIdValid() {return false;}@Overridepublic boolean isRequestedSessionIdFromCookie() {return false;}@Overridepublic boolean isRequestedSessionIdFromURL() {return false;}@Overridepublic boolean isRequestedSessionIdFromUrl() {return false;}@Overridepublic Object getAttribute(String s) {return null;}@Overridepublic Enumeration getAttributeNames() {return null;}@Overridepublic String getCharacterEncoding() {return null;}@Overridepublic void setCharacterEncoding(String s) throws UnsupportedEncodingException {}@Overridepublic int getContentLength() {return 0;}@Overridepublic String getContentType() {return null;}@Overridepublic ServletInputStream getInputStream() throws IOException {return null;}@Overridepublic String getParameter(String s) {return null;}@Overridepublic Enumeration getParameterNames() {return null;}@Overridepublic String[] getParameterValues(String s) {return new String[0];}@Overridepublic Map getParameterMap() {return null;}@Overridepublic String getProtocol() {return null;}@Overridepublic String getScheme() {return null;}@Overridepublic String getServerName() {return null;}@Overridepublic int getServerPort() {return 0;}@Overridepublic BufferedReader getReader() throws IOException {return null;}@Overridepublic String getRemoteAddr() {return null;}@Overridepublic String getRemoteHost() {return null;}@Overridepublic void setAttribute(String s, Object o) {}@Overridepublic void removeAttribute(String s) {}@Overridepublic Locale getLocale() {return null;}@Overridepublic Enumeration getLocales() {return null;}@Overridepublic boolean isSecure() {return false;}@Overridepublic RequestDispatcher getRequestDispatcher(String s) {return null;}@Overridepublic String getRealPath(String s) {return null;}@Overridepublic int getRemotePort() {return 0;}@Overridepublic String getLocalName() {return null;}@Overridepublic String getLocalAddr() {return null;}@Overridepublic int getLocalPort() {return 0;}});}














0 0
原创粉丝点击