Skip to content

Commit

Permalink
WW-5478 Deprecate DefaultResultFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
kusalk committed Nov 2, 2024
1 parent 8566c14 commit fe46ad9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
*/
public class ResultConfig extends Located implements Serializable {

protected Map<String,String> params;
protected Map<String, String> params;
protected String className;
protected String name;

Expand All @@ -63,7 +63,7 @@ public String getName() {
return name;
}

public Map<String,String> getParams() {
public Map<String, String> getParams() {
return params;
}

Expand Down Expand Up @@ -140,7 +140,7 @@ public Builder addParam(String name, String value) {
return this;
}

public Builder addParams(Map<String,String> params) {
public Builder addParams(Map<String, String> params) {
target.params.putAll(params);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
import com.opensymphony.xwork2.factory.ConverterFactory;
import com.opensymphony.xwork2.factory.DefaultActionFactory;
import com.opensymphony.xwork2.factory.DefaultInterceptorFactory;
import com.opensymphony.xwork2.factory.DefaultResultFactory;
import com.opensymphony.xwork2.factory.DefaultUnknownHandlerFactory;
import com.opensymphony.xwork2.factory.DefaultValidatorFactory;
import com.opensymphony.xwork2.factory.InterceptorFactory;
Expand Down Expand Up @@ -109,6 +108,7 @@
import org.apache.struts2.conversion.StrutsConversionPropertiesProcessor;
import org.apache.struts2.conversion.StrutsTypeConverterCreator;
import org.apache.struts2.conversion.StrutsTypeConverterHolder;
import org.apache.struts2.factory.StrutsResultFactory;
import org.apache.struts2.ognl.OgnlGuard;
import org.apache.struts2.ognl.ProviderAllowlist;
import org.apache.struts2.ognl.StrutsOgnlGuard;
Expand Down Expand Up @@ -363,7 +363,7 @@ public static ContainerBuilder bootstrapFactories(ContainerBuilder builder) {
// TODO: SpringObjectFactoryTest fails when these are SINGLETON
.factory(ObjectFactory.class, Scope.PROTOTYPE)
.factory(ActionFactory.class, DefaultActionFactory.class, Scope.PROTOTYPE)
.factory(ResultFactory.class, DefaultResultFactory.class, Scope.PROTOTYPE)
.factory(ResultFactory.class, StrutsResultFactory.class, Scope.PROTOTYPE)
.factory(InterceptorFactory.class, DefaultInterceptorFactory.class, Scope.PROTOTYPE)
.factory(ValidatorFactory.class, DefaultValidatorFactory.class, Scope.PROTOTYPE)
.factory(ConverterFactory.class, StrutsConverterFactory.class, Scope.PROTOTYPE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
import com.opensymphony.xwork2.util.reflection.ReflectionException;
import com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler;
import com.opensymphony.xwork2.util.reflection.ReflectionProvider;
import org.apache.struts2.factory.StrutsResultFactory;

import java.util.Map;

/**
* Default implementation
*
* @deprecated since 6.7.0, use {@link StrutsResultFactory} instead.
*/
@Deprecated
public class DefaultResultFactory implements ResultFactory {

private ObjectFactory objectFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;


/**
Expand Down Expand Up @@ -101,11 +102,11 @@ public void loadPackages() throws ConfigurationException {
HashMap<String, String> interceptorParams = new HashMap<>();
interceptorParams.put("excludes", "blah,bar");

HashMap successParams1 = new HashMap();
Map<String, String> successParams1 = new HashMap<>();
successParams1.put("propertyName", "baz");
successParams1.put("expectedValue", 1);
successParams1.put("expectedValue", "1");

HashMap successParams2 = new HashMap();
Map<String, String> successParams2 = new HashMap<>();
successParams2.put("propertyName", "blah");
successParams2.put("expectedValue", null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import com.opensymphony.xwork2.config.entities.ResultTypeConfig;
import com.opensymphony.xwork2.config.impl.DefaultConfiguration;
import com.opensymphony.xwork2.factory.DefaultInterceptorFactory;
import com.opensymphony.xwork2.factory.DefaultResultFactory;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Scope.Strategy;
import com.opensymphony.xwork2.ognl.OgnlReflectionProvider;
Expand Down Expand Up @@ -97,6 +96,7 @@
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.dontfind.DontFindMeAction;
import org.apache.struts2.factory.StrutsResultFactory;
import org.apache.struts2.ognl.ProviderAllowlist;
import org.apache.struts2.result.ServletDispatcherResult;
import org.easymock.EasyMock;
Expand Down Expand Up @@ -918,7 +918,7 @@ public void setProperty(String name, Object value, Object o, Map<String, Object>
dif.setObjectFactory((ObjectFactory) obj);
dif.setReflectionProvider(rp);

DefaultResultFactory drf = new DefaultResultFactory();
StrutsResultFactory drf = new StrutsResultFactory();
drf.setObjectFactory((ObjectFactory) obj);
drf.setReflectionProvider(rp);

Expand Down

0 comments on commit fe46ad9

Please sign in to comment.