📄 defaulttestprocessor.java
字号:
{
value = "[]"; //$NON-NLS-1$
}
else if (Map.class.isAssignableFrom(paramType))
{
value = "{}"; //$NON-NLS-1$
}
out.print(" <input class='itext' type='text' size='10' value='" + value + "' id='p" + i + j + "' title='Will be converted to: " + paramType.getName() + "'/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
out.println(j == paramTypes.length - 1 ? HtmlConstants.BLANK : ", "); //$NON-NLS-1$
}
out.println(" );"); //$NON-NLS-1$
String onclick = scriptName + '.' + methodName + "("; //$NON-NLS-1$
for (int j = 0; j < paramTypes.length; j++)
{
if (!LocalUtil.isServletClass(paramTypes[j]))
{
onclick += "objectEval($(\"p" + i + j + "\").value), "; //$NON-NLS-1$ //$NON-NLS-2$
}
}
onclick += "reply" + i + ");"; //$NON-NLS-1$ //$NON-NLS-2$
out.println(" <input class='ibutton' type='button' onclick='" + onclick + "' value='Execute' title='Calls " + scriptName + '.' + methodName + "(). View source for details.'/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
out.println(" <script type='text/javascript'>"); //$NON-NLS-1$
out.println(" var reply" + i + " = function(data)"); //$NON-NLS-1$ //$NON-NLS-2$
out.println(" {"); //$NON-NLS-1$
out.println(" if (data != null && typeof data == 'object') alert(DWRUtil.toDescriptiveString(data, 2));"); //$NON-NLS-1$
out.println(" else DWRUtil.setValue('d" + i + "', DWRUtil.toDescriptiveString(data, 1));"); //$NON-NLS-1$ //$NON-NLS-2$
out.println(" }"); //$NON-NLS-1$
out.println(" </script>"); //$NON-NLS-1$
out.println(" <span id='d" + i + "' class='reply'></span>"); //$NON-NLS-1$ //$NON-NLS-2$
// Print a warning if this method is overloaded
boolean overloaded = false;
for (int j = 0; j < methods.length; j++)
{
if (j != i && methods[j].getName().equals(methodName))
{
overloaded = true;
}
}
if (overloaded)
{
out.println("<br/><span class='warning'>(Warning: overloaded methods are not recommended. See <a href='#overloadedMethod'>below</a> for more including notes on false positives)</span>"); //$NON-NLS-1$
}
// Print a warning if the method uses un-marshallable types
for (int j = 0; j < paramTypes.length; j++)
{
if (!converterManager.isConvertable(paramTypes[j]))
{
out.println("<br/><span class='warning'>(Warning: No Converter for " + paramTypes[j].getName() + ". See <a href='#missingConverter'>below</a>)</span>"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
if (!converterManager.isConvertable(method.getReturnType()))
{
out.println("<br/><span class='warning'>(Warning: No Converter for " + method.getReturnType().getName() + ". See <a href='#missingConverter'>below</a>)</span>"); //$NON-NLS-1$ //$NON-NLS-2$
}
// See also the call to getReasonToNotDisplay() above
String warning = accessControl.getReasonToNotExecute(req, creator, scriptName, method);
if (warning != null)
{
out.println("<br/><span class='warning'>(Warning: Role restructions in place: " + warning + ".)</span>"); //$NON-NLS-1$ //$NON-NLS-2$
}
out.println("</li>"); //$NON-NLS-1$
}
out.println(HtmlConstants.BLANK);
out.println("</ul>"); //$NON-NLS-1$
out.println("<h2>Other Links</h2>"); //$NON-NLS-1$
out.println("<ul>"); //$NON-NLS-1$
out.println("<li>Back to <a href='" + req.getContextPath() + servletPath + "/'>class index</a>.</li>"); //$NON-NLS-1$ //$NON-NLS-2$
out.println("<li>Up to <a href='" + req.getContextPath() + "/'>top level of web app</a>.</li>"); //$NON-NLS-1$ //$NON-NLS-2$
out.println("</ul>"); //$NON-NLS-1$
synchronized (scriptCache)
{
String output = (String) scriptCache.get(HtmlConstants.FILE_HELP);
if (output == null)
{
StringBuffer buffer = new StringBuffer();
InputStream raw = getClass().getResourceAsStream(AbstractDWRServlet.PACKAGE + HtmlConstants.FILE_HELP);
if (raw == null)
{
log.error(Messages.getString("DefaultProcessor.MissingHelp", HtmlConstants.FILE_HELP)); //$NON-NLS-1$
output = "<p>Failed to read help text from resource file. Check dwr.jar is built to include html files.</p>"; //$NON-NLS-1$
}
else
{
BufferedReader in = new BufferedReader(new InputStreamReader(raw));
while (true)
{
String line = in.readLine();
if (line == null)
{
break;
}
buffer.append(line);
buffer.append('\n');
}
output = buffer.toString();
}
scriptCache.put(HtmlConstants.FILE_HELP, output);
}
out.println(output);
}
out.println("</body></html>"); //$NON-NLS-1$
out.flush();
}
/**
* Accessor for the DefaultCreatorManager that we configure
* @param converterManager The new DefaultConverterManager
*/
public void setConverterManager(ConverterManager converterManager)
{
this.converterManager = converterManager;
}
/**
* Accessor for the DefaultCreatorManager that we configure
* @param creatorManager The new DefaultConverterManager
*/
public void setCreatorManager(CreatorManager creatorManager)
{
this.creatorManager = creatorManager;
}
/**
* Accessor for the security manager
* @param accessControl The accessControl to set.
*/
public void setAccessControl(AccessControl accessControl)
{
this.accessControl = accessControl;
}
/**
* Do we allow impossible tests for debug purposes
* @param allowImpossibleTests The allowImpossibleTests to set.
*/
public void setAllowImpossibleTests(boolean allowImpossibleTests)
{
this.allowImpossibleTests = allowImpossibleTests;
}
/**
* How we convert parameters
*/
protected ConverterManager converterManager = null;
/**
* How we create new beans
*/
protected CreatorManager creatorManager = null;
/**
* The security manager
*/
protected AccessControl accessControl = null;
/**
* This helps us test that access rules are being followed
*/
private boolean allowImpossibleTests = false;
/**
* We cache the script output for speed
*/
protected final Map scriptCache = new HashMap();
/**
* The means by which we strip comments
*/
private JavascriptUtil jsutil = new JavascriptUtil();
/**
* The log stream
*/
private static final Logger log = Logger.getLogger(DefaultTestProcessor.class);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -