У меня есть метод веб-сервиса
@WebMethod
public void getCapturedImages(String image)
System.out.println(" image " + image);
}
И мой класс сервлета:
public class GetWebApplicationPathServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static ServletContext context;
public static ServletContext getContext() {
return context;
}
public static void setContext(ServletContext context) {
GetWebApplicationPathServlet.context = context;
}
/**
* @see HttpServlet#HttpServlet()
*/
public GetWebApplicationPathServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
System.out.println("doGet(HttpServletRequest");
String path = getServletContext().getRealPath("");
context = getServletContext();
String path1 = context.getRealPath("/images");
System.out.println("path1"+path1);
/*
* PrintWriter writer = response.getWriter();
* writer.println("Application path: " + path);
*/
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
Можем ли мы вызвать мой класс сервлета внутри этого метода веб-сервиса.