CodeSV Blog!by CA Technologies, A Broadcom Company

URL Parameters

How Can We Help?
< Back

[expand title=”Prerequisites” expanded=”true”]


This service is configured to respond to GET requests. These are defined using the forGet(String url) method with a URL that contains a parameter {year}, that is matched against the real request URL. You can reference this parameter in the response body using the annotation ${attribute.year}, which is replaced with a real parameter from the request.

URL Parameter Matching

private static final String URL = "{year}";

private static final String JSON_EXAMPLES_PORTFOLIO = "{"
+ "\"portfolio\": {\n"
+ " \"id\": \"1\",\n"
+ " \"year\": \"${attribute.year}\",\n"
+ " \"productNamesList\": [\n"
+ " \"CA Server Automation\",\n"
+ " \"CA Service Catalog\",\n"
+ " \"CA Service Desk Manager\",\n"
+ " \"CA Service Management\",\n"
+ " \"CA Service Operations Insight\",\n"
+ " \"CA Service Virtualization\"\n"
+ " ]\n"
+ "}}";

public VirtualServerRule vs = new VirtualServerRule();

public void testAdvancedHttpUsage() throws Exception {

HttpClient client = HttpClientBuilder.create().build();
HttpGet request = new HttpGet("");
HttpResponse response;

response = client.execute(request);

BufferedReader rd = new BufferedReader(
new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line;
while ((line = rd.readLine()) != null) {

String body = result.toString();

assertEquals(200, response.getStatusLine().getStatusCode());

For a complete example see: UrlParameterExample

Next Basic Authorization
Table of Contents

Comments are currently closed.