Which MEL expression correctly reads the path parameter named 'state' from a request to /customers/{state}?

Study for the MuleSoft Associate / Development Fundamental Test. Master key concepts with flashcards and multiple choice questions, complete with hints and explanations. Prepare thoroughly for your exam!

Multiple Choice

Which MEL expression correctly reads the path parameter named 'state' from a request to /customers/{state}?

Explanation:
Reading a path parameter in MEL comes from the HTTP inbound properties. The HTTP listener exposes path parameters as a map under message.inboundProperties.'http.uri.params', with each parameter name as a key. Since the path is /customers/{state}, the value you want is stored under the key state in that map. The correct MEL expression grabs the map and then the state entry: #[message.inboundProperties.'http.uri.params'.state]. The quotes around http.uri.params are needed because that key contains dots, so it must be treated as a single map key before accessing the state value. Other options don’t fit because they reference a different key or an incorrect case: stateParam wouldn’t match the parameter name, STATE is case-sensitive and would look for a different key, and city would only be correct if the path defined a city parameter.

Reading a path parameter in MEL comes from the HTTP inbound properties. The HTTP listener exposes path parameters as a map under message.inboundProperties.'http.uri.params', with each parameter name as a key. Since the path is /customers/{state}, the value you want is stored under the key state in that map. The correct MEL expression grabs the map and then the state entry: #[message.inboundProperties.'http.uri.params'.state]. The quotes around http.uri.params are needed because that key contains dots, so it must be treated as a single map key before accessing the state value.

Other options don’t fit because they reference a different key or an incorrect case: stateParam wouldn’t match the parameter name, STATE is case-sensitive and would look for a different key, and city would only be correct if the path defined a city parameter.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy