[ESBJAVA-4648] The interface to a Registry from Synapse should improve to get the resource media type Created: 02/Jun/16  Updated: 24/May/17  Resolved: 24/May/17

Status: Resolved
Project: WSO2 ESB
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Normal
Reporter: Krishan Malan Assignee: Chanaka Fernando
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Severity: Major
Estimated Complexity: Moderate
Test cases added: Yes


When going to implement class mediator to create a registry endpoint template it will not identify as a registry template.

After analyzing further, identified that endpoint template should have media type application/vnd.wso2.template.endpoint and artifacts created through the class mediator not having this media type.

We required to improve the registry API for the synapse in order to send media type when creating the endpoint template.

Do following change in org.wso2.carbon.mediation.registry.WSO2Registry.java [1]

public void newResource(String key, boolean isDirectory, String mediaType) {


Registry registry = getRegistry(key);
String resolvedKey = resolvePath(key);
try {
Resource resource;
if (isDirectory)

{ resource = registry.newCollection(); }


{ resource = registry.newResource(); resource.setMediaType(mediaType); }

registry.put(resolvedKey, resource);
} catch (RegistryException e)

{ handleException("Error while saving a resource at " + key, e); }


[1] https://github.com/wso2/carbon-mediation/blob/master/components/mediation-registry/org.wso2.carbon.mediation.registry/src/main/java/org/wso2/carbon/mediation/registry/WSO2Registry.java#L317

Comment by Sohani Weerasinghe [ 04/May/17 ]

This is fixed in ESB 5.0.0 and please find the commit at [1]

[1] https://github.com/wso2/carbon-mediation/commit/2d125e72e35cede371fb587ee279d0480e2d0664

Generated at Fri May 26 21:35:45 IST 2017 using JIRA 7.2.2#72004-sha1:9d5132893cc8c728a3601a9034a1f8547ef5c7be.