public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
servletLog.debug("Enter: doGet()");
try {
AxisEngine engine = getEngine();
ServletContext servletContext =
getServletConfig().getServletContext();
String pathInfo = request.getPathInfo();
String realpath = servletContext.getRealPath(request.getServletPath());
if (realpath == null) {
realpath = request.getServletPath();
}
boolean wsdlRequested = false;
boolean listRequested = false;
boolean hasParameters = request.getParameterNames().hasMoreElements();
//JWS pages are special; they are the servlet path and there
//is no pathinfo...we map the pathinfo to the servlet path to keep
//it happy
boolean isJWSPage = request.getRequestURI().endsWith(".jws");
if(isJWSPage) {
pathInfo= request.getServletPath();
}
// check first if we are doing WSDL or a list operation
String queryString = request.getQueryString();
boolean doExplain=false;
if (queryString != null) {
if (queryString.equalsIgnoreCase("wsdl")) {
wsdlRequested = true;
} else if (queryString.equalsIgnoreCase("list")) {
listRequested = true;
}
else {
String operation=request.getParameter("operation");
if(operation!=null) {
if(operation.equals("explain"))
doExplain=true;
}
else if(request.getParameter("query")==null &&
request.getParameter("scanClause")==null)
doExplain=true;
}
}
else
doExplain=true;
boolean hasNoPath = (pathInfo == null || pathInfo.equals(""));
if (!wsdlRequested && !listRequested && hasNoPath && srwInfo.defaultDatabase==null) {
// If the user requested the servlet (i.e. /axis/servlet/AxisServlet)
// with no service name, present the user with a list of deployed
// services to be helpful
// Don't do this if we are doing WSDL or list.
reportAvailableServices(response, request);
} else if (realpath != null || doExplain) {
// We have a pathname, so now we perform WSDL or list operations
// get message context w/ various properties set
MessageContext msgContext = createMessageContext(engine, request, response);
if(doExplain) {
srwInfo.handleExplain(request, response, msgContext);
return;
}
// NOTE: HttpUtils.getRequestURL has been deprecated.
// This line SHOULD be:
// String url = req.getRequestURL().toString()
// HOWEVER!!!! DON'T REPLACE IT! There's a bug in
// req.getRequestURL that is not in HttpUtils.getRequestURL
// req.getRequestURL returns "localhost" in the remote
// scenario rather than the actual host name.
//
// ? Still true? For which JVM's?
//String url = HttpUtils.getRequestURL(request).toString();
String url = request.getRequestURL().toString();
msgContext.setProperty(MessageContext.TRANS_URL, url);
if (wsdlRequested) {
// Do WSDL generation
msgContext.setTargetService("SRW");
processWsdlRequest(msgContext, response);
} else if (listRequested) {
// Do list, if it is enabled
processListRequest(response);
} else if (hasParameters) {
// If we have ?method=x¶m=y in the URL, make a stab
// at invoking the method with the parameters specified
// in the URL
processMethodRequest(msgContext, request, response);
SRWDatabase.putDb((String)msgContext.getProperty("dbname"),
(SRWDatabase) msgContext.getProperty("db"));
} else {
// See if we can locate the desired service. If we
// can't, return a 404 Not Found. Otherwise, just
// print the placeholder message.
String serviceName;
if (pathInfo.startsWith("/")) {
serviceName = pathInfo.substring(1);
} else {
serviceName = pathInfo;
}
SOAPService s = engine.getService(serviceName);
if (s == null) {
//no service: report it
if(isJWSPage) {
reportCantGetJWSService(request, response);
} else {