1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.submit.filters;
14
15 import com.eviware.soapui.impl.support.AbstractHttpRequest;
16 import com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpRequestTransport;
17 import com.eviware.soapui.model.iface.SubmitContext;
18 import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
19 import com.eviware.soapui.model.propertyexpansion.resolvers.ResolverUtils;
20 import com.eviware.soapui.settings.CommonSettings;
21 import org.apache.log4j.Logger;
22
23 /***
24 * RequestFilter that expands properties in request content
25 *
26 * @author Ole.Matzura
27 */
28
29 public class PropertyExpansionRequestFilter extends AbstractRequestFilter
30 {
31 public final static Logger log = Logger.getLogger(PropertyExpansionRequestFilter.class);
32
33 public void filterAbstractHttpRequest(SubmitContext context, AbstractHttpRequest<?> httpRequest)
34 {
35 String content = (String) context.getProperty( BaseHttpRequestTransport.REQUEST_CONTENT );
36 if( content == null )
37 {
38 log.warn( "Missing request content in context, skipping property expansion" );
39 }
40 else
41 {
42 content = PropertyExpansionUtils.expandProperties(context, content,
43 httpRequest.getSettings().getBoolean( CommonSettings.ENTITIZE_PROPERTIES ));
44
45 if( content != null )
46 {
47 context.setProperty( BaseHttpRequestTransport.REQUEST_CONTENT, content );
48 }
49 }
50 }
51
52 /***
53 * @deprecated
54 */
55
56 public static String expandProperties(SubmitContext context, String content)
57 {
58 return PropertyExpansionUtils.expandProperties( context, content );
59 }
60
61 /***
62 * @deprecated
63 */
64
65 public static String getGlobalProperty( String propertyName )
66 {
67 return PropertyExpansionUtils.getGlobalProperty( propertyName );
68 }
69
70 /***
71 * @deprecated Use {@link ResolverUtils#extractXPathPropertyValue(Object,String)} instead
72 */
73 public static String extractXPathPropertyValue( Object property, String xpath )
74 {
75 return ResolverUtils.extractXPathPropertyValue( property, xpath );
76 }
77 }