protected final void processRequest(final HttpServletRequest request,
final HttpServletResponse response)
throws ServletException, IOException {
String myCocktailPath = Utils.getMyCocktailPath(request);
ServiceController serviceController = ServiceController.getInstance(myCocktailPath);
Integer mashupId = null;
String mashupFormat = null;
String callbackFunction = "callback";
String pathInfo = request.getPathInfo();
if (pathInfo!= null && pathInfo.length() > 0) {
pathInfo = pathInfo.substring(1);
mashupId = getMashupId(pathInfo);
mashupFormat = getMashupFormat(pathInfo);
callbackFunction = getCallbackFunction(request, pathInfo);
}
if (mashupId != null) {
Enumeration<String> en = request.getParameterNames();
Map<String,String> mashupParams = new HashMap<String,String>();
while(en.hasMoreElements()) {
String key = en.nextElement();
mashupParams.put(key, request.getParameter(key));
}
String json = serviceController.executeMashup(mashupId, mashupParams);
StringBuilder result = new StringBuilder();
if("JSON".equalsIgnoreCase(mashupFormat)) {
response.setContentType("text/javascript;charset=UTF-8");
result.append(json);
} else if("XML".equalsIgnoreCase(mashupFormat)) {