Package com.logica.mycocktail.controller

Examples of com.logica.mycocktail.controller.ServiceController


    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)) {
View Full Code Here

TOP

Related Classes of com.logica.mycocktail.controller.ServiceController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.