/** * A helper method which allows instantiate an action if this action extends * {@link com.opensymphony.xwork2.ActionSupport} or any other action class * that requires framework's dependencies injection. */ protected <T> T createAction(Class<T> clazz) { return container.inject(clazz); }
/** * @param obj */ protected Object injectInternalBeans(Object obj) { if (obj != null && container != null) { container.inject(obj); } return obj; }
/** * A helper method which allows instantiate an action if this action extends * {@link com.opensymphony.xwork2.ActionSupport} or any other action class * that requires framework's dependencies injection. */ protected <T> T createAction(Class<T> clazz) { return container.inject(clazz); }
/** * Injects dependencies on an Object using Struts internal IoC container */ protected void injectStrutsDependencies(Object object) { container.inject(object); }
/** * Injects dependencies on an Object using Struts internal IoC container */ protected void injectStrutsDependencies(Object object) { container.inject(object); }
@SuppressWarnings("unchecked") public T create(Context context) { Object obj = context.getContainer().inject(implementation); return (T) obj; }
public ValueStack createValueStack() { ValueStack stack = new OgnlValueStack(xworkConverter, compoundRootAccessor, textProvider, allowStaticMethodAccess); container.inject(stack); stack.getContext().put(ActionContext.CONTAINER, container); return stack; }
public ValueStack createValueStack(ValueStack stack) { ValueStack result = new OgnlValueStack(stack, xworkConverter, compoundRootAccessor, allowStaticMethodAccess); container.inject(result); stack.getContext().put(ActionContext.CONTAINER, container); return result; }
public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) { ActionInvocation inv = createActionInvocation(extraContext, true); container.inject(inv); return createActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext); }
public ActionProxy createActionProxy(ActionInvocation inv, String namespace, String actionName, String methodName, boolean executeResult, boolean cleanupContext) { DefaultActionProxy proxy = new DefaultActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext); container.inject(proxy); proxy.prepare(); return proxy; }
/** * Injects dependencies on an Object using Struts internal IoC container */ protected void injectStrutsDependencies(Object object) { Dispatcher.getInstance().getContainer().inject(object); }
@Override public ActionProxy createActionProxy(String namespace, String actionName, String methodName, Map<String, Object> extraContext, boolean executeResult, boolean cleanupContext) { if (this.namespace == null || namespace.startsWith(this.namespace)) { ActionInvocation inv = new RestActionInvocation(extraContext, true); container.inject(inv); return createActionProxy(inv, namespace, actionName, methodName, executeResult, cleanupContext); } else { return super.createActionProxy(namespace, actionName, methodName, extraContext, executeResult, cleanupContext); } }
public static String url(String value) { Dispatcher instance = Dispatcher.getInstance(); if( instance == null) return null; Container container = instance.getContainer(); UrlFunction function = new UrlFunction(); container.inject(function); return function.getUrl(value); } }
public static String resource(String resourcePath) { Dispatcher instance = Dispatcher.getInstance(); if (instance == null) return null; Container container = instance.getContainer(); ResourceUrlFunction function = new ResourceUrlFunction(); container.inject(function); return function.getExternalUrlForResource(resourcePath); } }
public static String resource(String resourcePath) { Dispatcher instance = Dispatcher.getInstance(); if (instance == null) return null; Container container = instance.getContainer(); ResourceUrlFunction function = new ResourceUrlFunction(); container.inject(function); return function.getExternalUrlForResource(resourcePath); } }
protected Dispatcher initDispatcher(Map<String, String> params) { dispatcher = StrutsTestCaseHelper.initDispatcher(servletContext, params); configurationManager = dispatcher.getConfigurationManager(); configuration = configurationManager.getConfiguration(); container = configuration.getContainer(); container.inject(dispatcher); return dispatcher; }
public static String url(String value) { Dispatcher instance = Dispatcher.getInstance(); if( instance == null) return null; Container container = instance.getContainer(); UrlFunction function = new UrlFunction(); container.inject(function); return function.getUrl(value); } }
public ObjectFactory create(Context xworkContext) throws Exception { SpringObjectFactory f = new SpringObjectFactory(); xworkContext.getContainer().inject(f); f.setApplicationContext(_applicationContext); f.setAutowireStrategy(_autoWireStrategy); return f; } });
public static String configValue(String key) { Dispatcher instance = Dispatcher.getInstance(); if (instance == null) return null; Container container = instance.getContainer(); ConfigurationValueFunction cv = new ConfigurationValueFunction(); container.inject(cv); return cv.lookup(key); }
protected HtmlClosure getGxpClosure() { final Gxp gxp = getUseInstances() ? GxpInstance.getInstance(getGxpName()) : Gxp.getInstance(getGxpName()); if (null == gxp) { // TODO(lwerner): OGNL or Struts 2 seems to be swallowing this exception // rather than logging or rethrowing it, so you never see this message // TODO(dpb): Is this true now that this work is not done in a setter? throw new NullPointerException("The GXP " + getGxpName() + " could not be loaded. This is probably because you have" + " a typo in your config."); } container.inject(gxp); return new HtmlClosure() { public void write(Appendable out, GxpContext gxpContext) throws IOException { gxp.write(out, gxpContext); } }; }