我正在尝试使用ServletContext
我的网络服务,但WebServiceContext
总是NULL
如此。谁能告诉我我做错了什么,我正在使用 spring 框架和 tomcat。
package com.xyz.webser;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.Resource;
import javax.jws.WebService;
import javax.servlet.http.HttpSession;
import javax.servlet.ServletContext;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
@WebService(serviceName = "myWebService", endpointInterface = "com.xyz.webser.MyWebService")
public class MyWebServiceImpl implements MyWebService {
@Resource
private WebServiceContext context;
public void setContext(WebServiceContext context) {
this.context = context;
}