本文整理汇总了Java中org.directwebremoting.extend.CreatorManager类的典型用法代码示例。如果您正苦于以下问题:Java CreatorManager类的具体用法?Java CreatorManager怎么用?Java CreatorManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CreatorManager类属于org.directwebremoting.extend包,在下文中一共展示了CreatorManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCreatorManager
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
private static CreatorManager getCreatorManager()
{
String name = typeName.get();
try
{
Class<? extends CreatorManager> cls =
(Class<? extends CreatorManager>) Class.forName(name);
return cls.newInstance();
}
catch (Exception e)
{
if (name != null && !"".equals(name)) {
log.warn("Couldn't make CreatorManager from type: " + name);
}
return new DefaultCreatorManager();
}
}
示例2: testHandle
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Test method for {@link org.directwebremoting.jsonrpc.JsonRpcCallHandler#handle(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)}.
*/
@Test
public void testHandle() throws Exception
{
Container container = TestEnvironment.getContainer();
JsonRpcCallHandler handler = (JsonRpcCallHandler) container.getBean("url:/jsonrpc");
handler.setJsonRpcEnabled(true);
CreatorManager creatorManager = container.getBean(CreatorManager.class);
NewCreator creator = new NewCreator();
creator.setClassName("com.example.dwr.simple.Demo");
creator.setJavascript("Demo");
creatorManager.addCreator(creator);
List<String> validTests = TestUtil.parseTestInput(getClass(), "validJsonRpc.txt");
for (String test : validTests)
{
FakeHttpServletRequest request = FakeHttpServletRequestFactory.create();
request.setContent(test);
FakeHttpServletResponse response = new FakeHttpServletResponse();
handler.handle(request, response);
String output = new String(response.getContentAsByteArray());
log.info(output);
}
}
示例3: getCreatorManager
import org.directwebremoting.extend.CreatorManager; //导入依赖的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();
}
}
示例4: configure
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
public void configure(Container container)
{
converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName());
ajaxFilterManager = (AjaxFilterManager) container.getBean(AjaxFilterManager.class.getName());
accessControl = (AccessControl) container.getBean(AccessControl.class.getName());
creatorManager = (CreatorManager) container.getBean(CreatorManager.class.getName());
configure();
setState(STATE_COMPLETE);
}
示例5: configure
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
public void configure(Container container)
{
accessControl = (AccessControl) container.getBean(AccessControl.class.getName());
ajaxFilterManager = (AjaxFilterManager) container.getBean(AjaxFilterManager.class.getName());
converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName());
creatorManager = (CreatorManager) container.getBean(CreatorManager.class.getName());
Element root = document.getDocumentElement();
NodeList rootChildren = root.getChildNodes();
for (int i = 0; i < rootChildren.getLength(); i++)
{
Node node = rootChildren.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
Element child = (Element) node;
if (child.getNodeName().equals(ELEMENT_INIT))
{
loadInits(child);
}
else if (child.getNodeName().equals(ELEMENT_ALLOW))
{
loadAllows(child);
}
else if (child.getNodeName().equals(ELEMENT_SIGNATURES))
{
loadSignature(child);
}
}
}
}
示例6: SignatureParser
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Simple ctor
* @param converterManager Having understood the extra type info we add it in here.
* @param creatorManager If we can't find a class by Java name we can lookup by Javascript name
*/
public SignatureParser(ConverterManager converterManager, CreatorManager creatorManager)
{
this.converterManager = converterManager;
this.creatorManager = creatorManager;
packageImports.add("java.lang");
}
示例7: configure
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
public void configure(Container container)
{
converterManager = container.getBean(ConverterManager.class);
ajaxFilterManager = container.getBean(AjaxFilterManager.class);
accessControl = container.getBean(AccessControl.class);
creatorManager = container.getBean(CreatorManager.class);
configure();
setState(STATE_COMPLETE);
}
示例8: configure
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
public void configure(Container container)
{
accessControl = container.getBean(AccessControl.class);
ajaxFilterManager = container.getBean(AjaxFilterManager.class);
converterManager = container.getBean(ConverterManager.class);
creatorManager = container.getBean(CreatorManager.class);
Element root = document.getDocumentElement();
NodeList rootChildren = root.getChildNodes();
for (int i = 0; i < rootChildren.getLength(); i++)
{
Node node = rootChildren.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE)
{
Element child = (Element) node;
if (child.getNodeName().equals(ELEMENT_INIT))
{
loadInits(child);
}
else if (child.getNodeName().equals(ELEMENT_ALLOW))
{
loadAllows(child);
}
else if (child.getNodeName().equals(ELEMENT_SIGNATURES))
{
loadSignature(child);
}
}
}
}
示例9: SignatureParser
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Simple ctor
* @param converterManager Having understood the extra type info we add it in here.
* @param creatorManager If we can't find a class by Java name we can lookup by Javascript name
*/
public SignatureParser(ConverterManager converterManager, CreatorManager creatorManager)
{
this.converterManager = converterManager;
this.creatorManager = creatorManager;
packageImports.add("java.lang");
}
示例10: setUp
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
converterManager = EasyMock.createMock(ConverterManager.class);
creatorManager = EasyMock.createMock(CreatorManager.class);
parser = new SignatureParser(converterManager, creatorManager);
}
示例11: setCreatorManager
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Accessor for the DefaultCreatorManager that we configure
* @param creatorManager The new DefaultConverterManager
*/
public void setCreatorManager(CreatorManager creatorManager)
{
this.creatorManager = creatorManager;
}
示例12: setupDefaults
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Take a DefaultContainer and setup the default beans
* @param container The container to configure
* @param servletConfig The source of init parameters
* @throws InstantiationException If we can't instantiate a bean
* @throws IllegalAccessException If we have access problems creating a bean
*/
public static void setupDefaults(DefaultContainer container, ServletConfig servletConfig) throws InstantiationException, IllegalAccessException
{
container.addParameter(AccessControl.class.getName(), DefaultAccessControl.class.getName());
container.addParameter(ConverterManager.class.getName(), DefaultConverterManager.class.getName());
container.addParameter(CreatorManager.class.getName(), DefaultCreatorManager.class.getName());
container.addParameter(UrlProcessor.class.getName(), UrlProcessor.class.getName());
container.addParameter(WebContextBuilder.class.getName(), DefaultWebContextBuilder.class.getName());
container.addParameter(ServerContextBuilder.class.getName(), DefaultServerContextBuilder.class.getName());
container.addParameter(AjaxFilterManager.class.getName(), DefaultAjaxFilterManager.class.getName());
container.addParameter(Remoter.class.getName(), DefaultRemoter.class.getName());
container.addParameter(DebugPageGenerator.class.getName(), DefaultDebugPageGenerator.class.getName());
container.addParameter(PlainCallMarshaller.class.getName(), PlainCallMarshaller.class.getName());
container.addParameter(HtmlCallMarshaller.class.getName(), HtmlCallMarshaller.class.getName());
container.addParameter(PlainPollHandler.class.getName(), PlainPollHandler.class.getName());
container.addParameter(HtmlPollHandler.class.getName(), HtmlPollHandler.class.getName());
container.addParameter(ScriptSessionManager.class.getName(), DefaultScriptSessionManager.class.getName());
container.addParameter(PageNormalizer.class.getName(), DefaultPageNormalizer.class.getName());
if (servletConfig.getServletContext().getServerInfo().startsWith("jetty-6"))
{
container.addParameter(ServerLoadMonitor.class.getName(), ThreadDroppingServerLoadMonitor.class.getName());
}
else
{
container.addParameter(ServerLoadMonitor.class.getName(), DefaultServerLoadMonitor.class.getName());
}
// Mapping handlers to URLs
createUrlMapping(container, "/index.html", "indexHandlerUrl", IndexHandler.class);
createUrlMapping(container, "/engine.js", "engineHandlerUrl", EngineHandler.class);
createUrlMapping(container, "/util.js", "utilHandlerUrl", UtilHandler.class);
createUrlMapping(container, "/auth.js", "authHandlerUrl", AuthHandler.class);
createUrlMapping(container, "/webwork/DWRActionUtil.js", "webworkUtilHandlerUrl", WebworkUtilHandler.class);
createUrlMapping(container, "/about", "aboutHandlerUrl", AboutHandler.class);
createUrlMapping(container, "/test/", "testHandlerUrl", TestHandler.class);
createUrlMapping(container, "/interface/", "interfaceHandlerUrl", InterfaceHandler.class);
// The Poll and Call URLs can not be changed easily because they are
// referenced from engine.js. Maybe one day this would be a good
// extension
createUrlMapping(container, "/call/plaincall/", "plainCallHandlerUrl", PlainCallHandler.class);
createUrlMapping(container, "/call/plainpoll/", "plainPollHandlerUrl", PlainPollHandler.class);
createUrlMapping(container, "/call/htmlcall/", "htmlCallHandlerUrl", HtmlCallHandler.class);
createUrlMapping(container, "/call/htmlpoll/", "htmlPollHandlerUrl", HtmlPollHandler.class);
}
示例13: debugConfig
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Create a bunch of debug information about a container
* @param container The container to print debug information about
*/
public static void debugConfig(Container container)
{
if (log.isDebugEnabled())
{
// Container level debug
log.debug("Container");
log.debug(" Type: " + container.getClass().getName());
Collection beanNames = container.getBeanNames();
for (Iterator it = beanNames.iterator(); it.hasNext();)
{
String name = (String) it.next();
Object object = container.getBean(name);
if (object instanceof String)
{
log.debug(" Param: " + name + " = " + object + " (" + object.getClass().getName() + ")");
}
else
{
log.debug(" Bean: " + name + " = " + object + " (" + object.getClass().getName() + ")");
}
}
// AccessControl debugging
AccessControl accessControl = (AccessControl) container.getBean(AccessControl.class.getName());
log.debug("AccessControl");
log.debug(" Type: " + accessControl.getClass().getName());
// AjaxFilterManager debugging
AjaxFilterManager ajaxFilterManager = (AjaxFilterManager) container.getBean(AjaxFilterManager.class.getName());
log.debug("AjaxFilterManager");
log.debug(" Type: " + ajaxFilterManager.getClass().getName());
// ConverterManager debugging
ConverterManager converterManager = (ConverterManager) container.getBean(ConverterManager.class.getName());
log.debug("ConverterManager");
log.debug(" Type: " + converterManager.getClass().getName());
// CreatorManager debugging
CreatorManager creatorManager = (CreatorManager) container.getBean(CreatorManager.class.getName());
log.debug("CreatorManager");
log.debug(" Type: " + creatorManager.getClass().getName());
Collection creatorNames = creatorManager.getCreatorNames();
for (Iterator it = creatorNames.iterator(); it.hasNext();)
{
String creatorName = (String) it.next();
Creator creator = creatorManager.getCreator(creatorName);
log.debug(" Creator: " + creatorName + " = " + creator + " (" + creator.getClass().getName() + ")");
}
}
}
示例14: setCreatorManager
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Accessor for the CreatorManager that we configure
* @param creatorManager The new ConverterManager
*/
public void setCreatorManager(CreatorManager creatorManager)
{
this.creatorManager = creatorManager;
}
示例15: processCreate
import org.directwebremoting.extend.CreatorManager; //导入依赖的package包/类
/**
* Process the @RemoteProxy annotaion on a given class
* @param clazz The class annotated with @RemoteProxy
* @param createAnn The annotation
* @param container The IoC container to configure
*/
private void processCreate(Class<?> clazz, RemoteProxy createAnn, Container container)
{
Class<? extends Creator> creator = createAnn.creator();
String creatorClass = creator.getName();
Map<String, String> creatorParams = getParamsMap(createAnn.creatorParams());
ScriptScope scope = createAnn.scope();
CreatorManager creatorManager = (CreatorManager) container.getBean(CreatorManager.class.getName());
String creatorName = LocalUtil.replace(creatorClass, ".", "_");
creatorManager.addCreatorType(creatorName, creatorClass);
Map<String, String> params = new HashMap<String, String>();
if (NewCreator.class.isAssignableFrom(creator))
{
params.put("class", clazz.getName());
}
params.putAll(creatorParams);
params.put("scope", scope.getValue());
String name = createAnn.name();
if (name == null || name.length() == 0)
{
name = LocalUtil.getShortClassName(clazz);
}
try
{
log.info("Adding class " + clazz.getName() + " as " + name);
creatorManager.addCreator(name, creatorName, params);
}
catch (Exception ex)
{
log.error("Failed to add class as Creator: " + clazz.getName(), ex);
}
AccessControl accessControl = (AccessControl) container.getBean(AccessControl.class.getName());
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++)
{
if (methods[i].getAnnotation(RemoteMethod.class) != null)
{
accessControl.addIncludeRule(name, methods[i].getName());
Auth authAnn = methods[i].getAnnotation(Auth.class);
if (authAnn != null)
{
accessControl.addRoleRestriction(name, methods[i].getName(), authAnn.role());
}
}
}
Filters filtersAnn = clazz.getAnnotation(Filters.class);
if (filtersAnn != null)
{
Filter[] fs = filtersAnn.value();
for (int i = 0; i < fs.length; i++)
{
processFilter(fs[i], name, container);
}
}
// process single filter for convenience
else
{
Filter filterAnn = clazz.getAnnotation(Filter.class);
if (filterAnn != null)
{
processFilter(filterAnn, name, container);
}
}
}