2424import com .ocpsoft .pretty .PrettyException ;
2525import com .ocpsoft .pretty .faces .config .PrettyConfig ;
2626import com .ocpsoft .pretty .faces .config .mapping .PathValidator ;
27+ import com .ocpsoft .pretty .faces .config .mapping .QueryParameter ;
28+ import com .ocpsoft .pretty .faces .config .mapping .UrlAction ;
2729import com .ocpsoft .pretty .faces .config .mapping .UrlMapping ;
2830import com .ocpsoft .pretty .faces .spi .ConfigurationPostProcessor ;
2931
@@ -67,10 +69,52 @@ private void createAncestry(PrettyConfig config, UrlMapping m)
6769 }
6870 m .setPattern (parent .getPattern () + m .getPattern ());
6971 mergeValidators (parent , m );
72+ mergeActions (parent , m );
73+ mergeQueryParams (parent , m );
7074 seen .add (m );
7175 }
7276 }
7377
78+ private void mergeQueryParams (UrlMapping parent , UrlMapping child )
79+ {
80+ List <QueryParameter > result = new ArrayList <QueryParameter >();
81+ for (QueryParameter queryParam : parent .getQueryParams ())
82+ {
83+ if (!result .contains (queryParam ))
84+ {
85+ result .add (copy (queryParam ));
86+ }
87+ }
88+ for (QueryParameter queryParam : child .getQueryParams ())
89+ {
90+ if (!result .contains (queryParam ))
91+ {
92+ result .add (copy (queryParam ));
93+ }
94+ }
95+ child .setQueryParams (result );
96+ }
97+
98+ private void mergeActions (UrlMapping parent , UrlMapping child )
99+ {
100+ List <UrlAction > result = new ArrayList <UrlAction >();
101+ for (UrlAction action : parent .getActions ())
102+ {
103+ if (!result .contains (action ))
104+ {
105+ result .add (copy (action ));
106+ }
107+ }
108+ for (UrlAction action : child .getActions ())
109+ {
110+ if (!result .contains (action ))
111+ {
112+ result .add (copy (action ));
113+ }
114+ }
115+ child .setActions (result );
116+ }
117+
74118 private void mergeValidators (UrlMapping parent , UrlMapping child )
75119 {
76120 List <PathValidator > result = new ArrayList <PathValidator >();
@@ -90,6 +134,27 @@ private void mergeValidators(UrlMapping parent, UrlMapping child)
90134 child .setPathValidators (result );
91135 }
92136
137+ private QueryParameter copy (QueryParameter queryParameter )
138+ {
139+ QueryParameter result = new QueryParameter ();
140+ result .setExpression (queryParameter .getExpression ());
141+ result .setName (queryParameter .getName ());
142+ result .setOnError (queryParameter .getOnError ());
143+ result .setOnPostback (queryParameter .isOnPostback ());
144+ result .setValidatorExpression (queryParameter .getValidatorExpression ());
145+ result .setValidatorIds (queryParameter .getValidatorIds ());
146+ return result ;
147+ }
148+
149+ private UrlAction copy (UrlAction urlAction )
150+ {
151+ UrlAction result = new UrlAction ();
152+ result .setAction (urlAction .getAction ());
153+ result .setOnPostback (urlAction .onPostback ());
154+ result .setPhaseId (result .getPhaseId ());
155+ return result ;
156+ }
157+
93158 private PathValidator copy (PathValidator pathValidator )
94159 {
95160 PathValidator result = new PathValidator ();
0 commit comments