本文整理汇总了Java中org.directwebremoting.util.LocalUtil类的典型用法代码示例。如果您正苦于以下问题:Java LocalUtil类的具体用法?Java LocalUtil怎么用?Java LocalUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalUtil类属于org.directwebremoting.util包,在下文中一共展示了LocalUtil类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addConverter
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void addConverter(String match, String type, Map params) throws IllegalArgumentException, InstantiationException, IllegalAccessException
{
Class clazz = (Class) converterTypes.get(type);
if (clazz == null)
{
log.info("Probably not an issue: " + match + " is not available so the " + type + " converter will not load. This is only an problem if you wanted to use it.");
return;
}
Converter converter = (Converter) clazz.newInstance();
converter.setConverterManager(this);
LocalUtil.setParams(converter, params, ignore);
// add the converter for the specified match
addConverter(match, converter);
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:18,
代码来源:DefaultConverterManager.java
示例2: splitInbound
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* The javascript outbound marshaller prefixes the toString value with a
* colon and the original type information. This undoes that.
* @param data The string to be split up
* @return A string array containing the split data
*/
public static String[] splitInbound(String data)
{
String[] reply = new String[2];
int colon = data.indexOf(ProtocolConstants.INBOUND_TYPE_SEPARATOR);
if (colon == -1)
{
log.error("Missing : in conversion data (" + data + ')');
reply[LocalUtil.INBOUND_INDEX_TYPE] = ProtocolConstants.TYPE_STRING;
reply[LocalUtil.INBOUND_INDEX_VALUE] = data;
}
else
{
reply[LocalUtil.INBOUND_INDEX_TYPE] = data.substring(0, colon);
reply[LocalUtil.INBOUND_INDEX_VALUE] = data.substring(colon + 1);
}
return reply;
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:26,
代码来源:ParseUtil.java
示例3: handle
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String scriptName = request.getPathInfo();
scriptName = LocalUtil.replace(scriptName, testHandlerUrl, "");
scriptName = LocalUtil.replace(scriptName, "/", "");
String page = debugPageGenerator.generateTestPage(request.getContextPath() + request.getServletPath(), scriptName);
response.setContentType(MimeConstants.MIME_HTML);
PrintWriter out = response.getWriter();
out.print(page);
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:13,
代码来源:TestHandler.java
示例4: handle
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String scriptName = request.getPathInfo();
scriptName = LocalUtil.replace(scriptName, interfaceHandlerUrl, "");
scriptName = LocalUtil.replace(scriptName, PathConstants.EXTENSION_JS, "");
String path = request.getContextPath() + request.getServletPath();
String script = remoter.generateInterfaceScript(scriptName, path);
// Officially we should use MimeConstants.MIME_JS, but if we cheat and
// use MimeConstants.MIME_PLAIN then it will be easier to read in a
// browser window, and will still work just fine.
response.setContentType(MimeConstants.MIME_PLAIN);
PrintWriter out = response.getWriter();
out.print(script);
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:17,
代码来源:InterfaceHandler.java
示例5: setExclude
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Set a list of properties excluded from conversion
* @param excludes The space or comma separated list of properties to exclude
*/
public void setExclude(String excludes)
{
if (inclusions != null)
{
throw new IllegalArgumentException(Messages.getString("BeanConverter.OnlyIncludeOrExclude"));
}
exclusions = new ArrayList();
String toSplit = LocalUtil.replace(excludes, ",", " ");
StringTokenizer st = new StringTokenizer(toSplit);
while (st.hasMoreTokens())
{
String rule = st.nextToken();
if (rule.startsWith("get"))
{
log.warn("Exclusions are based on property names and not method names. '" + rule + "' starts with 'get' so it looks like a method name and not a property name.");
}
exclusions.add(rule);
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:27,
代码来源:BasicObjectConverter.java
示例6: setInclude
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Set a list of properties included from conversion
* @param includes The space or comma separated list of properties to exclude
*/
public void setInclude(String includes)
{
if (exclusions != null)
{
throw new IllegalArgumentException(Messages.getString("BeanConverter.OnlyIncludeOrExclude"));
}
inclusions = new ArrayList();
String toSplit = LocalUtil.replace(includes, ",", " ");
StringTokenizer st = new StringTokenizer(toSplit);
while (st.hasMoreTokens())
{
String rule = st.nextToken();
if (rule.startsWith("get"))
{
log.warn("Inclusions are based on property names and not method names. '" + rule + "' starts with 'get' so it looks like a method name and not a property name.");
}
inclusions.add(rule);
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:27,
代码来源:BasicObjectConverter.java
示例7: StrutsCreator
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
*
*/
public StrutsCreator()
{
try
{
moduleUtilsClass = LocalUtil.classForName("org.apache.struts.util.ModuleUtils");
getInstanceMethod = moduleUtilsClass.getMethod("getInstance", new Class[0]);
getModuleNameMethod = moduleUtilsClass.getMethod("getModuleName", new Class[] { String.class, ServletContext.class });
getModuleConfigMethod = moduleUtilsClass.getMethod("getModuleConfig", new Class[] { String.class, ServletContext.class });
log.debug("Using Struts 1.2 based ModuleUtils code");
}
catch (Exception ex)
{
moduleUtilsClass = null;
getInstanceMethod = null;
getModuleNameMethod = null;
getModuleConfigMethod = null;
log.debug("Failed to find Struts 1.2 ModuleUtils code. Falling back to 1.1 based code");
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:25,
代码来源:StrutsCreator.java
示例8: processAjaxFilters
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* J2EE role based method level security added here.
* @param javascript The name of the creator
* @param parent The container of the include and exclude elements.
*/
private void processAjaxFilters(String javascript, Element parent)
{
NodeList nodes = parent.getElementsByTagName(ELEMENT_FILTER);
for (int i = 0; i < nodes.getLength(); i++)
{
Element include = (Element) nodes.item(i);
String type = include.getAttribute(ATTRIBUTE_CLASS);
AjaxFilter filter = (AjaxFilter) LocalUtil.classNewInstance(javascript, type, AjaxFilter.class);
if (filter != null)
{
LocalUtil.setParams(filter, createSettingMap(include), ignore);
ajaxFilterManager.addAjaxFilter(filter, javascript);
}
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:22,
代码来源:DwrXmlConfigurator.java
示例9: addCreator
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void addCreator(String scriptName, String typeName, Map params) throws InstantiationException, IllegalAccessException, IllegalArgumentException
{
if (!LocalUtil.isJavaIdentifier(scriptName))
{
log.error("Illegal identifier: '" + scriptName + "'");
return;
}
Class clazz = (Class) creatorTypes.get(typeName);
if (clazz == null)
{
log.error("Missing creator: " + typeName + " (while initializing creator for: " + scriptName + ".js)");
return;
}
Creator creator = (Creator) clazz.newInstance();
LocalUtil.setParams(creator, params, ignore);
creator.setProperties(params);
// add the creator for the script name
addCreator(scriptName, creator);
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:24,
代码来源:DefaultCreatorManager.java
示例10: createDefaultContainer
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Create a {@link DefaultContainer}, allowing users to upgrade to a child
* of DefaultContainer using an {@link ServletConfig} init parameter of
* <code>org.directwebremoting.Container</code>. Note that while the
* parameter name is the classname of {@link Container}, currently the only
* this can only be used to create children that inherit from
* {@link DefaultContainer}. This restriction may be relaxed in the future.
* Unlike {@link #setupDefaultContainer(DefaultContainer, ServletConfig)},
* this method does not call any setup methods.
* @param servletConfig The source of init parameters
* @return An unsetup implementaion of DefaultContainer
* @throws ServletException If the specified class could not be found
* @see ServletConfig#getInitParameter(String)
*/
public static DefaultContainer createDefaultContainer(ServletConfig servletConfig) throws ServletException
{
try
{
String typeName = servletConfig.getInitParameter(Container.class.getName());
if (typeName == null)
{
return new DefaultContainer();
}
log.debug("Using alternate Container implementation: " + typeName);
Class type = LocalUtil.classForName(typeName);
return (DefaultContainer) type.newInstance();
}
catch (Exception ex)
{
throw new ServletException(ex);
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:34,
代码来源:ContainerUtil.java
示例11: processGlobalFilter
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Global Filters apply to all classes
* @param clazz The class to use as a filter
* @param globalFilterAnn The filter annotation
* @param container The IoC container to configure
* @throws InstantiationException In case we can't create the given clazz
* @throws IllegalAccessException In case we can't create the given clazz
*/
private void processGlobalFilter(Class<?> clazz, GlobalFilter globalFilterAnn, Container container) throws InstantiationException, IllegalAccessException
{
if (!AjaxFilter.class.isAssignableFrom(clazz))
{
throw new IllegalArgumentException(clazz.getName() + " is not an AjaxFilter implementation");
}
Map<String, String> filterParams = getParamsMap(globalFilterAnn.params());
AjaxFilter filter = (AjaxFilter) clazz.newInstance();
if (filter != null)
{
LocalUtil.setParams(filter, filterParams, null);
AjaxFilterManager filterManager = (AjaxFilterManager) container.getBean(AjaxFilterManager.class.getName());
filterManager.addAjaxFilter(filter);
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:25,
代码来源:AnnotationsConfigurator.java
示例12: setServletResourceName
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Load the configuration from classpath resource
*
* @param resource
* @throws IOException
* @throws ParserConfigurationException
* @throws SAXException
*/
public void setServletResourceName(Resource resource)
throws IOException, ParserConfigurationException, SAXException {
if (resource == null) {
throw new IOException("Missing config resource");
}
InputStream in = null;
try {
in = resource.getInputStream();
if (in == null) {
throw new IOException(Messages.getString("DwrXmlConfigurator.MissingConfigFile", resource.getURL()));
}
setInputStream(in);
} finally {
LocalUtil.close(in);
}
}
开发者ID:jaffa-projects,
项目名称:jaffa-framework,
代码行数:26,
代码来源:DwrXmlConfigurator.java
示例13: loadActionProcessor
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Tries to instantiate an <code>IDWRActionProcessor</code> if defined in web.xml.
* @param actionProcessorClassName
* @return an instance of <code>IDWRActionProcessor</code> if the init-param is defined or <code>null</code>
* @throws ServletException thrown if the <code>IDWRActionProcessor</code> cannot be loaded and instantiated
*/
private static IDWRActionProcessor loadActionProcessor(String actionProcessorClassName) throws ServletException
{
if (null == actionProcessorClassName || "".equals(actionProcessorClassName))
{
return null;
}
IDWRActionProcessor reply = LocalUtil.classNewInstance("DWRActionProcessor", actionProcessorClassName, IDWRActionProcessor.class);
if (reply == null)
{
throw new ServletException("Cannot load DWRActionProcessor class '" + actionProcessorClassName + "'");
}
return reply;
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:22,
代码来源:DWRAction.java
示例14: getConverterManager
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
*
*/
private static ConverterManager getConverterManager()
{
String name = typeName.get();
try
{
@SuppressWarnings("unchecked")
Class<? extends ConverterManager> cls = (Class<? extends ConverterManager>) LocalUtil.classForName(name);
return cls.newInstance();
}
catch (Exception e)
{
if (name != null && !"".equals(name))
{
log.warn("Couldn't make ConverterManager from type: " + name);
}
return new DefaultConverterManager();
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:22,
代码来源:InternalConverterManager.java
示例15: setClass
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Specified via {@link org.directwebremoting.annotations.RemoteProxy @RemoteProxy}
* or via a parameter in XML configuration.
*/
@Override
public void setClass(String classname)
{
try
{
// Don't use LocalUtil.classForName because it insists
// on a default constructor, and we want to be able to
// use an @Inject constructor.
this.type = LocalUtil.classForName(classname);
}
catch (ClassNotFoundException ex)
{
throw new IllegalArgumentException(String.format("GuiceCreator: class %s not found", classname));
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:20,
代码来源:GuiceCreator.java
示例16: getAjaxFilterManager
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
private static AjaxFilterManager getAjaxFilterManager()
{
String name = typeName.get();
try
{
@SuppressWarnings("unchecked")
Class<? extends AjaxFilterManager> cls = (Class<? extends AjaxFilterManager>) LocalUtil.classForName(name);
return cls.newInstance();
}
catch (Exception e)
{
if (name != null && !"".equals(name))
{
log.warn("Couldn't make AjaxFilterManager from type: " + name);
}
return new DefaultAjaxFilterManager();
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:19,
代码来源:InternalAjaxFilterManager.java
示例17: getCreatorManager
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
private static CreatorManager getCreatorManager()
{
String name = typeName.get();
try
{
@SuppressWarnings("unchecked")
Class<? extends CreatorManager> cls = (Class<? extends CreatorManager>) LocalUtil.classForName(name);
return cls.newInstance();
}
catch (Exception e)
{
if (name != null && !"".equals(name))
{
log.warn("Couldn't make CreatorManager from type: " + name);
}
return new DefaultCreatorManager();
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:19,
代码来源:InternalCreatorManager.java
示例18: StrutsCreator
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
*
*/
public StrutsCreator()
{
try
{
Class<?> moduleUtilsClass = LocalUtil.classForName("org.apache.struts.util.ModuleUtils");
getInstanceMethod = moduleUtilsClass.getMethod("getInstance");
getModuleNameMethod = moduleUtilsClass.getMethod("getModuleName", String.class, ServletContext.class);
getModuleConfigMethod = moduleUtilsClass.getMethod("getModuleConfig", String.class, ServletContext.class);
Loggers.STARTUP.debug("Using Struts 1.2 based ModuleUtils code");
}
catch (Exception ex)
{
getInstanceMethod = null;
getModuleNameMethod = null;
getModuleConfigMethod = null;
Loggers.STARTUP.debug("Failed to find Struts 1.2 ModuleUtils code. Falling back to 1.1 based code");
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:24,
代码来源:StrutsCreator.java
示例19: sanitizeErrorMessage
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public static String sanitizeErrorMessage(String errorMessage)
{
boolean debug = false;
Object debugVal = WebContextFactory.get().getContainer().getBean("debug");
if (debugVal != null)
{
debug = LocalUtil.simpleConvert(debugVal.toString(), Boolean.class);
}
if (debug)
{
return "null /* " + errorMessage.replace("*/", "* /") + " */";
}
else
{
return "null";
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:20,
代码来源:ErrorOutboundVariable.java
示例20: addFileTransfer
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public String addFileTransfer(FileTransfer transfer) throws IOException
{
OutputStreamLoader loader = null;
ByteArrayOutputStream out = null;
try
{
out = new ByteArrayOutputStream();
String mimeType = transfer.getMimeType();
loader = transfer.getOutputStreamLoader();
loader.load(out);
String base64data = new String(Base64.encodeBase64(out.toByteArray()));
return "'data:" + mimeType + ";base64," + base64data + "'";
}
finally
{
LocalUtil.close(loader);
LocalUtil.close(out);
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:20,
代码来源:DataUrlDownloadManager.java
示例21: MethodDeclaration
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Initializes the logical method declaration from primitive data.
* @param moduleName
* @param methodName
* @param genericParameterTypes
* @param varArgs
* @param genericReturnType
*/
public MethodDeclaration(String moduleName, String methodName, Type[] genericParameterTypes, boolean varArgs, Type genericReturnType)
{
this.moduleName = moduleName;
this.methodName = methodName;
this.genericParameterTypes = genericParameterTypes;
this.varArgs = varArgs;
this.genericReturnType = genericReturnType;
// Interpolate raw parameter types
parameterTypes = new Class<?>[genericParameterTypes.length];
for (int i = 0; i < genericParameterTypes.length; i++) {
parameterTypes[i] = LocalUtil.toClass(genericParameterTypes[i], toString());
}
// Interpolate raw return type
returnType = LocalUtil.toClass(genericReturnType, toString());
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:26,
代码来源:MethodDeclaration.java
示例22: testPattern
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
protected static boolean testPattern(String pattern, String value, boolean caseInsensitive)
{
boolean result = pattern.equals(value);
if (!result && LocalUtil.hasText(value))
{
String javaPattern = pattern.replace("?", ".").replace("*", ".*");
if (LocalUtil.hasText(pattern))
{
Pattern p = caseInsensitive
? Pattern.compile(javaPattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE)
: Pattern.compile(javaPattern);
result = p.matcher(value).matches();
}
else
{
result = true;
}
}
return result;
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:22,
代码来源:AbstractStoreProvider.java
示例23: handle
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void handle(HttpServletRequest request, HttpServletResponse response) throws IOException
{
String scriptName = request.getPathInfo();
scriptName = scriptName.replace(testHandlerUrl, "");
while(scriptName.endsWith("/"))
{
scriptName = scriptName.substring(0, scriptName.length() - 1);
}
if (!LocalUtil.isValidScriptName(scriptName))
{
throw new SecurityException("Illegal script name.");
}
String page = debugPageGenerator.generateTestPage(request.getContextPath() + request.getServletPath(), scriptName);
response.setContentType(MimeConstants.MIME_HTML);
PrintWriter out = response.getWriter();
out.print(page);
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:20,
代码来源:TestHandler.java
示例24: generateTemplate
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
@Override
protected String generateTemplate(String contextPath, String servletPath, String pathInfo) throws IOException
{
StringWriter sw = new StringWriter();
InputStream raw = null;
try
{
raw = LocalUtil.getInternalResourceAsStream(resource);
if (raw == null)
{
throw new IOException("Failed to find resource: " + resource);
}
CopyUtils.copy(raw, sw);
}
finally
{
LocalUtil.close(raw);
}
return sw.toString();
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:24,
代码来源:FileJavaScriptHandler.java
示例25: getCopyright
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Gets the copyright text to be prepended to the response.
* @return String copyright text
* @throws IOException
*/
protected String getCopyright() throws IOException
{
StringWriter sw = new StringWriter();
InputStream raw = null;
if(copyright != null )
{
try
{
raw = LocalUtil.getInternalResourceAsStream(copyright);
if (raw == null)
{
throw new IOException("Failed to find resource: " + copyright);
}
CopyUtils.copy(raw, sw);
}
finally
{
LocalUtil.close(raw);
}
}
return sw.toString();
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:30,
代码来源:FileJavaScriptHandler.java
示例26: parseBrokenMacPost
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
private static void parseBrokenMacPost(Map<String, FormField> paramMap) {
log.debug("Using Broken Safari POST mode");
Iterator it = paramMap.keySet().iterator();
if (!(it.hasNext())) {
throw new IllegalStateException("No entries in non empty map!");
}
String key = (String) it.next();
String value = ((FormField) paramMap.get(key)).getString();
String line = key + "=" + value;
StringTokenizer st = new StringTokenizer(line, "\n");
while (st.hasMoreTokens()) {
String part = st.nextToken();
part = LocalUtil.decode(part);
parsePostLine(part, paramMap);
}
}
开发者ID:wufeisoft,
项目名称:ryf_mms2,
代码行数:21,
代码来源:ParseUtil.java
示例27: setServletResourceName
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Setter for the resource name that we can use to read a file from the
* servlet context
* @param servletResourceName The name to lookup
* @throws IOException On file read failure
* @throws ParserConfigurationException On XML setup failure
* @throws SAXException On XML parse failure
*/
public void setServletResourceName(ServletContext servletContext, String servletResourceName) throws IOException, ParserConfigurationException, SAXException
{
this.servletResourceName = servletResourceName;
InputStream in = null;
try
{
in = servletContext.getResourceAsStream(servletResourceName);
if (in == null)
{
throw new IOException("Missing config file: '" + servletResourceName + "'");
}
Loggers.STARTUP.debug("Configuring from servlet resource: " + servletResourceName);
setInputStream(in);
}
finally
{
LocalUtil.close(in);
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:30,
代码来源:DwrXmlConfigurator.java
示例28: processAjaxFilters
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* J2EE role based method level security added here.
* @param javascript The name of the creator
* @param parent The container of the include and exclude elements.
*/
private void processAjaxFilters(String javascript, Element parent)
{
NodeList nodes = parent.getElementsByTagName(ELEMENT_FILTER);
for (int i = 0; i < nodes.getLength(); i++)
{
Element include = (Element) nodes.item(i);
String type = include.getAttribute(ATTRIBUTE_CLASS);
AjaxFilter filter = LocalUtil.classNewInstance(javascript, type, AjaxFilter.class);
if (filter != null)
{
LocalUtil.setParams(filter, createSettingMap(include), ignore);
ajaxFilterManager.addAjaxFilter(filter, javascript);
}
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:22,
代码来源:DwrXmlConfigurator.java
示例29: addCreator
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public void addCreator(String typeName, Map<String, String> params) throws InstantiationException, IllegalAccessException, IllegalArgumentException
{
Class<? extends Creator> clazz = creatorTypes.get(typeName);
if (clazz == null)
{
Loggers.STARTUP.error("Missing creator: " + typeName + " (while initializing creator for: " + params.get("javascript") + ".js)");
return;
}
Creator creator = clazz.newInstance();
LocalUtil.setParams(creator, params, ignore);
creator.setProperties(params);
// add the creator for the script name
addCreator(creator);
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:18,
代码来源:DefaultCreatorManager.java
示例30: getMappedJavaScriptClassName
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Convenience method to find a class's mapped JavaScript class name IF
* the Java class is being converted and IF there is a mapped class name.
* @param clazz the java class
* @return a non-empty classname, or null if not found
*/
protected String getMappedJavaScriptClassName(Class<?> clazz)
{
Converter conv = getConverter(clazz);
if (conv != null)
{
// Check if mapped
if (conv instanceof NamedConverter)
{
NamedConverter namedConv = (NamedConverter) conv;
if (LocalUtil.hasLength(namedConv.getJavascript()))
{
return namedConv.getJavascript();
}
}
}
return null;
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:24,
代码来源:DefaultConverterManager.java
示例31: resolveEntity
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
{
for (int i = 0; i < MAPPINGS.length; i++)
{
if (publicId.equals(MAPPINGS[i][0]))
{
if (i != MAPPINGS.length - 1)
{
String doctype = "<!DOCTYPE dwr PUBLIC \"" +
MAPPINGS[MAPPINGS.length - 1][0] + "\" \"http://getahead.org/dwr/" +
MAPPINGS[MAPPINGS.length - 1][1] + "\">";
log.warn("Deprecated public id in dwr.xml. Use: " + doctype);
}
String dtdname = DwrConstants.PACKAGE_PATH + MAPPINGS[i][1];
InputStream raw = LocalUtil.getInternalResourceAsStream(dtdname);
return new InputSource(raw);
}
}
throw new SAXException("Failed to resolve: publicId=" + publicId + " systemId=" + systemId);
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:24,
代码来源:DTDEntityResolver.java
示例32: retrieveClassFromClassImports
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Attempts to retrieve a Class from the signatures class imports. Returns null
* if no class can be found.
*
* @param itype
* @return Class<?>
*/
private Class<?> retrieveClassFromClassImports(String itype)
{
try
{
String full = classImports.get(itype);
if (full == null)
{
full = itype;
}
return LocalUtil.classForName(full);
}
catch (Exception ex)
{
log.debug("SignatureParser - Can't find class in signature class imports, will attempt package imports.");
}
return null;
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:25,
代码来源:SignatureParser.java
示例33: retrieveClassFromPackageImports
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Attempts to retrieve a Class from the package imports. Returns null
* if no class can be found.
*
* @param itype
* @return Class<?>
*/
private Class<?> retrieveClassFromPackageImports(String itype)
{
for (String pkg : packageImports)
{
String lookup = pkg + '.' + itype;
try
{
return LocalUtil.classForName(lookup);
}
catch (Exception ex)
{
log.debug("SignatureParser - Can't find class in package imports: " + lookup);
}
}
return null;
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:25,
代码来源:SignatureParser.java
示例34: createDefaultContainer
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Create a {@link DefaultContainer}, allowing users to upgrade to a child
* of DefaultContainer using an {@link ServletConfig} init parameter of
* <code>org.directwebremoting.Container</code>. Note that while the
* parameter name is the classname of {@link Container}, currently the only
* this can only be used to create children that inherit from
* {@link DefaultContainer}. This restriction may be relaxed in the future.
* Unlike {@link #setupDefaultContainer(DefaultContainer, ServletConfig)},
* this method does not call any setup methods.
* @param servletConfig The source of init parameters
* @return An un'setup' implementation of DefaultContainer
* @throws ContainerConfigurationException If the specified class could not be found
* @see ServletConfig#getInitParameter(String)
*/
public static DefaultContainer createDefaultContainer(ServletConfig servletConfig) throws ContainerConfigurationException
{
try
{
String typeName = servletConfig.getInitParameter(LocalUtil.originalDwrClassName(Container.class.getName()));
if (typeName == null)
{
return new DefaultContainer();
}
Loggers.STARTUP.debug("Using alternate Container implementation: " + typeName);
Class<?> type = LocalUtil.classForName(typeName);
return (DefaultContainer) type.newInstance();
}
catch (Exception ex)
{
throw new ContainerConfigurationException(ex);
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:34,
代码来源:StartupUtil.java
示例35: setupDefaults
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Take a DefaultContainer and setup the default beans
* @param container The container to configure
* @throws ContainerConfigurationException If we can't use a bean
*/
public static void setupDefaults(DefaultContainer container) throws ContainerConfigurationException
{
try
{
InputStream in = LocalUtil.getInternalResourceAsStream(DwrConstants.SYSTEM_DEFAULT_PROPERTIES_PATH);
Properties defaults = new Properties();
defaults.load(in);
for (Map.Entry<?, ?> entry : defaults.entrySet())
{
String key = (String) entry.getKey();
String value = (String) entry.getValue();
container.addParameter(key, value);
}
}
catch (IOException ex)
{
throw new ContainerConfigurationException("Failed to load system defaults", ex);
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:26,
代码来源:StartupUtil.java
示例36: processGlobalFilter
点赞 3
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Global Filters apply to all classes
* @param clazz The class to use as a filter
* @param globalFilterAnn The filter annotation
* @param container The IoC container to configure
* @throws InstantiationException In case we can't create the given clazz
* @throws IllegalAccessException In case we can't create the given clazz
*/
protected void processGlobalFilter(Class<?> clazz, GlobalFilter globalFilterAnn, Container container) throws InstantiationException, IllegalAccessException
{
if (!AjaxFilter.class.isAssignableFrom(clazz))
{
throw new IllegalArgumentException(clazz.getName() + " is not an AjaxFilter implementation");
}
Map<String, String> filterParams = getParamsMap(globalFilterAnn.params());
AjaxFilter filter = (AjaxFilter) clazz.newInstance();
if (filter != null)
{
LocalUtil.setParams(filter, filterParams, null);
AjaxFilterManager filterManager = container.getBean(AjaxFilterManager.class);
filterManager.addAjaxFilter(filter);
}
}
开发者ID:directwebremoting,
项目名称:dwr,
代码行数:25,
代码来源:AnnotationsConfigurator.java
示例37: loadActionProcessor
点赞 2
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Tries to instantiate an <code>IDWRActionProcessor</code> if defined in web.xml.
*
* @param actionProcessorClassName
* @return an instance of <code>IDWRActionProcessor</code> if the init-param is defined or <code>null</code>
* @throws ServletException thrown if the <code>IDWRActionProcessor</code> cannot be loaded and instantiated
*/
private static IDWRActionProcessor loadActionProcessor(String actionProcessorClassName) throws ServletException
{
if (null == actionProcessorClassName || "".equals(actionProcessorClassName))
{
return null;
}
try
{
Class actionProcessorClass = LocalUtil.classForName(actionProcessorClassName);
return (IDWRActionProcessor) actionProcessorClass.newInstance();
}
catch(ClassNotFoundException cnfe)
{
throw new ServletException("Cannot load DWRActionProcessor class '" + actionProcessorClassName + "'", cnfe);
}
catch(IllegalAccessException iae)
{
throw new ServletException("Cannot instantiate DWRActionProcessor class '" + actionProcessorClassName + "'. Default constructor is not visible", iae);
}
catch(InstantiationException ie)
{
throw new ServletException("Cannot instantiate DWRActionProcessor class '" + actionProcessorClassName + "'. No default constructor found", ie);
}
catch(Throwable cause)
{
throw new ServletException("Cannot instantiate DWRActionProcessor class '" + actionProcessorClassName + "'", cause);
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:38,
代码来源:DWRAction.java
示例38: setClass
点赞 2
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* What sort of class do we create?
* @param classname The name of the class
*/
public void setClass(String classname)
{
try
{
this.clazz = LocalUtil.classForName(classname);
}
catch (ClassNotFoundException ex)
{
throw new IllegalArgumentException(Messages.getString("Creator.ClassNotFound", classname));
}
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:16,
代码来源:SpringCreator.java
示例39: TypeHintContext
点赞 2
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* External setup this object
* @param converterManager For when we can't work out the parameterized type info
* @param method The method to annotate
* @param parameterNumber The number of the parameter to edit (counts from 0)
*/
public TypeHintContext(ConverterManager converterManager, Method method, int parameterNumber)
{
if (method == null)
{
throw new IllegalArgumentException("The method can not be null");
}
this.converterManager = converterManager;
this.method = method;
this.parameterNumber = parameterNumber;
// Type[] types = method.getGenericParameterTypes();
Object[] types = (Object[]) LocalUtil.invoke(method, getGenericParameterTypesMethod, new Object[0]);
if (types != null)
{
if (parameterNumber >= types.length)
{
throw new IllegalArgumentException("parameterNumber=" + parameterNumber + " is too big when method=" + method.getName() + " returns genericParameterTypes.length=" + types.length);
}
this.parameterType = types[parameterNumber];
}
else
{
this.parameterType = null;
}
parameterNumberTree = new ArrayList();
parameterTypeTree = new ArrayList();
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:38,
代码来源:TypeHintContext.java
示例40: createChildContext
点赞 2
import org.directwebremoting.util.LocalUtil; //导入依赖的package包/类
/**
* Create a child TypeHintContext based on this one
* @param newParameterNumber The index of the item between < and >.
* @return a new TypeHintContext
*/
public TypeHintContext createChildContext(int newParameterNumber)
{
Object/*Type*/ childType = null;
if (isGenericsSupported)
{
//if (parameterType instanceof ParameterizedType)
if (parameterizedTypeClass.isInstance(parameterType))
{
Object/*Type*/ ptype = /*(Type)*/ parameterType;
// Type[] rawParams = ptype.getActualTypeArguments();
Object[] actualTypeArguments = (Object[]) LocalUtil.invoke(ptype, getActualTypeArgumentsMethod, new Object[0]);
if (newParameterNumber >= actualTypeArguments.length)
{
throw new IllegalArgumentException("newParameterNumber=" + newParameterNumber + " is too big when parameterType=" + parameterType + " give actualTypeArguments.length=" + actualTypeArguments.length);
}
childType = actualTypeArguments[newParameterNumber];
}
}
TypeHintContext child = new TypeHintContext(converterManager, this.method, this.parameterNumber, childType);
child.parameterNumberTree.addAll(this.parameterNumberTree);
child.parameterNumberTree.add(new Integer(newParameterNumber));
child.parameterTypeTree.addAll(parameterTypeTree);
child.parameterTypeTree.add(parameterType);
return child;
}
开发者ID:parabuild-ci,
项目名称:parabuild-ci,
代码行数:38,
代码来源:TypeHintContext.java