use of org.apache.axis.transport.http.QSWSDLHandler in project Lucee by lucee.
the class RPCServer method doGet.
private boolean doGet(HttpServletRequest request, HttpServletResponse response, PrintWriter writer, Component component) throws AxisFault, ClassException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
String path = request.getServletPath();
String queryString = request.getQueryString();
AxisEngine engine = getEngine();
Iterator i = this.transport.getOptions().keySet().iterator();
if (queryString == null) {
return false;
}
String servletURI = request.getContextPath() + path;
String reqURI = request.getRequestURI();
// service name
String serviceName;
if (servletURI.length() + 1 < reqURI.length()) {
serviceName = reqURI.substring(servletURI.length() + 1);
} else {
serviceName = "";
}
while (i.hasNext()) {
String queryHandler = (String) i.next();
if (queryHandler.startsWith("qs.")) {
// Only attempt to match the query string with transport
// parameters prefixed with "qs:".
String handlerName = queryHandler.substring(queryHandler.indexOf(".") + 1).toLowerCase();
// Determine the name of the plugin to invoke by using all text
// in the query string up to the first occurence of &, =, or the
// whole string if neither is present.
int length = 0;
boolean firstParamFound = false;
while (firstParamFound == false && length < queryString.length()) {
char ch = queryString.charAt(length++);
if (ch == '&' || ch == '=') {
firstParamFound = true;
--length;
}
}
if (length < queryString.length()) {
queryString = queryString.substring(0, length);
}
if (queryString.toLowerCase().equals(handlerName) == true) {
if (this.transport.getOption(queryHandler).equals("")) {
return false;
}
// Attempt to dynamically load the query string handler
// and its "invoke" method.
MessageContext msgContext = createMessageContext(engine, request, response, component);
msgContext.setProperty(MessageContext.TRANS_URL, HttpUtils.getRequestURL(request).toString().toLowerCase());
// msgContext.setProperty(MessageContext.TRANS_URL, "http://DefaultNamespace");
msgContext.setProperty(HTTPConstants.PLUGIN_SERVICE_NAME, serviceName);
msgContext.setProperty(HTTPConstants.PLUGIN_NAME, handlerName);
msgContext.setProperty(HTTPConstants.PLUGIN_IS_DEVELOPMENT, Caster.toBoolean(isDevelopment));
msgContext.setProperty(HTTPConstants.PLUGIN_ENABLE_LIST, Boolean.FALSE);
msgContext.setProperty(HTTPConstants.PLUGIN_ENGINE, engine);
msgContext.setProperty(HTTPConstants.PLUGIN_WRITER, writer);
msgContext.setProperty(HTTPConstants.PLUGIN_LOG, toLog(log));
msgContext.setProperty(HTTPConstants.PLUGIN_EXCEPTION_LOG, toLog(exceptionLog));
String handlerClassName = (String) this.transport.getOption(queryHandler);
if ("org.apache.axis.transport.http.QSWSDLHandler".equals(handlerClassName)) {
QSWSDLHandler handler = new QSWSDLHandler();
handler.invoke(msgContext);
} else {
// Invoke the plugin.
Class plugin = ClassUtil.loadClass((String) this.transport.getOption(queryHandler));
Method pluginMethod = plugin.getDeclaredMethod("invoke", new Class[] { msgContext.getClass() });
pluginMethod.invoke(ClassUtil.loadInstance(plugin), new Object[] { msgContext });
}
writer.close();
return true;
}
}
}
return false;
}
Aggregations