struts.xml extends attribute - struts2

can you please tell me how we can extend more then one package in the tag extends attribute in the strtus.xml using struts 2
Usman.sk

yes ...you can do it by seperating it through comma's...

Related

How is AbstractTestCase linked to UiTestBase<D> in QAF 2.18 version?

I am new to QAF 2.18 & trying to understand how an AbstractTestCase is able to accept a type parameter using Generic's in below case.
public abstract class AbstractTestCase<D, B extends UiTestBase<D>>
The WebDriverTestCase extends AbstractTestCase<D, B extends UiTestBase<D>> that said, the AbstractTestCase must and should make a use of Interface UiTestBase or the classes that have the implementation of the interface UiTestBase<D>. I tried to drill down more & couldn't find that QAFExtendedWebDriver and WebDriverTestBase classes don't implement UiTestBase in any way. Could anyone help me understand how is this working? Thanks in advance.
public class WebDriverTestCase extends AbstractTestCase<QAFExtendedWebDriver, WebDriverTestBase>

Apply struts interceptor to subset of paths?

I'd like to apply a Struts interceptor to a subset of paths only. E.g. only requests whose path start with "/api", for example.
Seems sort of like a no-brainer but so far my google-fu is failing me badly. Can someone point me in the right direction?
Thanks!
Interceptors can be defined per-package, e.g., with a default interceptor. In your example, it would be the package with the "/api" namespace.
The other option is to configure the interceptor(s) per-action, which is irritating.
In your struts.xml, you can define a new package
<package name="yourpackage" extends="default" namespace="/api">
<default-interceptor-ref name="yourInterceptorStack"/>
</package>
In your action classes, you can specify the package as follows,
#ParentPackage("yourpackage")
public class YourAction extends ActionSupport {
...
}

Inject IAuthorizationFilter using Unity

I am trying to inject IAuthorizationFilter with SecurityAuthorizationFilter using Unity through configuration. I get an exception The type name or alias IAuthorizationFilter could not be resolved. Please check your configuration file and verify this type name. I checked the types and all of them looks good. Please somebody direct me how can I typically inject the action filters. Thanks in advance
My configuration as follows
<typeAlias alias="IAuthorizationFilter" type="System.Web.Mvc.IAuthorizationFilter, System.Web.Mvc"/>
<typeAlias alias="SecurityAuthorizationFilter" type="JQS.Infrastructure.Security.Filters.SecurityAuthorizationFilter, JQS.Infrastructure.Security"/>
<register type="IAuthorizationFilter" mapTo="SecurityAuthorizationFilter"/>
-George
Try to write full assembly name in type attribute for IAuthorizationFilter alias ( I mean version, culture, public token )

Is it posssible to extend/override component class, that "cc.myFunc" will be available in facelet?

I've already asked here two questions about the subject, but the answers was uninformative. May be I did not explain well, what I want. Now, I will be more specific. I know that "Composite components are a Facelets feature, not a JSF feature", I know that "Facelets is that Facelets is a view technology which is designed with JSF in mind". I don't know exactly, but I guess that abbreviations "cc.attrs" and "cc.clientId" assume, that there is some java class for component, behind the scene. I want to know, if it is possible to override/extend it in such way that "cc.myFunc" will be available?
You can provide a custom class for a composite component. The requirement is that the class has to be an UIComponent and implement the interface NamingContainer. There is a base class UINamingContainer that you can extend.
To declare it in your composite use something like:
<cc:interface componentType="my.CustomComponent">
</cc:interface>
The class could be something like:
#FacesComponent("my.CustomComponent") //Component type in the composite
public class AComponent extends UINamingContainer{
private int a;
//setter and getter for a
public void sayHello(){
System.out.println("Hello");
}
}
Note that the value of componentType attribute is the value of FacesComponent annotation.
In the implementation of your composite component, you would use #{cc.sayHello()}. The parentheses are required because without them the Facelets ELResolver would try to look for an attribute sayHello.

FilterAttribute Order not working

I have 2 attributes that I use within the controllers of my MVC application. AttributeA extends System.Web.Mvc.AuthorizeAttribute and AttributeB extends System.Web.Mvc.ActionFilterAttribute. I want AttributeB to always be run first.
I have tried all possible combinations of Order based on this article, but AttributeA is always run before AttributeB. Can anyone help?
If you look at the System.Web.Mvc.ControllerActionInvoker.InvokeAction method with reflector you will see that all filters implementing IAuthorizationFilter are invoked before attributes deriving from ActionFilterAttribute and that's because authorization is made before invoking the action.

Resources