You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/16 18:18:08 UTC

svn commit: r357187 [16/25] - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: ./ addressing/ client/ client/async/ context/ deployment/ deployment/listener/ deployment/repository/util/ deployment/scheduler/ deployment/util/ descript...

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ListingAgent.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 
 package org.apache.axis2.transport.http;
 
@@ -45,43 +46,29 @@
      * Field LIST_MULTIPLE_SERVICE_JSP_NAME
      */
     private static final String LIST_MULTIPLE_SERVICE_JSP_NAME = "listServices.jsp";
-
     private static final String LIST_SERVICE_GROUP_JSP = "ListServiceGroup.jsp";
-
     private static final String LIST_SRVICES_JSP_NAME = "listService.jsp";
-
     private static final String SELECT_SERVICE_JSP_NAME = "SelectService.jsp";
-
     private static final String REMOVE_SERVICE_JSP_NAME = "RemoveService.jsp";
 
-    public static final String ADMIN_JSP_NAME = "admin.jsp";
-
-    private static final String LIST_AVAILABLE_MODULES_JSP_NAME = "listModules.jsp";
-
-    private static final String LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME = "globalModules.jsp";
-
-    private static final String LIST_PHASES_JSP_NAME = "viewphases.jsp";
-
-    private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME = "engagingglobally.jsp";
-
-    private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME = "engagingtoaservice.jsp";
-    private static final String ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME = "EngageToServiceGroup.jsp";
-
     /**
      * Field LIST_SINGLE_SERVICE_JSP_NAME
      */
     private static final String LIST_SINGLE_SERVICE_JSP_NAME = "listSingleService.jsp";
+    private static final String LIST_PHASES_JSP_NAME = "viewphases.jsp";
+    private static final String LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME = "globalModules.jsp";
+    private static final String LIST_AVAILABLE_MODULES_JSP_NAME = "listModules.jsp";
+    private static final String ENGAGING_MODULE_TO_SERVICE_JSP_NAME =
+            "engagingtoaservice.jsp";
+    private static final String ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME =
+            "EngageToServiceGroup.jsp";
+    private static final String ENGAGING_MODULE_GLOBALLY_JSP_NAME = "engagingglobally.jsp";
+    public static final String ADMIN_JSP_NAME = "admin.jsp";
     private static final String VIEW_GLOBAL_HANDLERS_JSP_NAME = "ViewGlobalHandlers.jsp";
     private static final String VIEW_SERVICE_HANDLERS_JSP_NAME = "ViewServiceHandlers.jsp";
-
-    private static final String ENGAGE_TO_OPERATION_JSP_NAME = "engagingtoanoperation.jsp";
     private static final String SERVICE_PARA_EDIT_JSP_NAME = "ServiceParaEdit.jsp";
+    private static final String ENGAGE_TO_OPERATION_JSP_NAME = "engagingtoanoperation.jsp";
 
-    public ListingAgent(ConfigurationContext configContext) {
-        this.configContext = configContext;
-    }
-
-    private ConfigurationContext configContext;
     /**
      * Field allowListServices
      */
@@ -90,451 +77,370 @@
      * Field allowListSingleService
      */
     private OutputStream out = null;
+    private ConfigurationContext configContext;
 
-    public void handle(HttpServletRequest httpServletRequest,
-                       HttpServletResponse httpServletResponse,
-                       OutputStream out)
-            throws IOException, Exception {
-        this.out = out;
-        String filePart = httpServletRequest.getRequestURL().toString();
-        if ((filePart != null) &&
-                filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
-            listAdminServices(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.LIST_MODULES)) {
-            listModules(httpServletRequest, httpServletResponse);
-            return;
-        } else if (
-                (filePart != null) &&
-                        filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
-            listGloballyModules(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.LIST_PHASES)) {
-            listPhases(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.ENGAGE_GLOBAL_MODULE)) {
-            engageModulesGlobally(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)) {
-            engageModulesToService(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE_GROUP)) {
-            engageModulesToServiceGroup(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.ADMIN_LOGIN)) {
-            adminLogging(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
-            viewGlobalHandlers(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.SELECT_SERVICE)) {
-            selectService(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)) {
-            viewServiceHandlers(httpServletRequest, httpServletResponse);
-            return;
-        } else if (
-                (filePart != null) &&
-                        filePart.endsWith(Constants.LIST_SERVICE_FOR_MODULE_ENGAGEMENT)) {
-            lsitServiceformodules(httpServletRequest, httpServletResponse);
-            return;
-        } else if (
-                (filePart != null) &&
-                        filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)) {
-            engageModulesToOperation(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.REMOVE_SERVICE)) {
-            removeService(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.SELECT_SERVICE_FOR_PARA_EDIT)) {
-            lsitServiceforParameterChanged(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.EDIR_SERVICE_PARA)) {
-            chageParameters(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.LIST_SERVICE_GROUPS)) {
-            listServiceGroups(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.LIST_CONTEXTS)) {
-            listContexts(httpServletRequest, httpServletResponse);
-            return;
-        } else if ((filePart != null) &&
-                filePart.endsWith(Constants.LOGOUT)) {
-            logout(httpServletRequest, httpServletResponse);
-            return;
+    public ListingAgent(ConfigurationContext configContext) {
+        this.configContext = configContext;
+    }
+
+    private void adminLogging(HttpServletRequest req, HttpServletResponse res)
+            throws AdminAppException, IOException {
+        String username = req.getParameter("userName");
+        String password = req.getParameter("password");
+
+        if ((username == null) || (password == null) || username.trim().equals("")
+                || password.trim().equals("")) {
+            throw new AdminAppException(Messages.getMessage("invaliduser"));
         }
 
-        if ((filePart != null) &&
-                filePart.endsWith(Constants.LIST_SERVICES)) {
-            listServices(httpServletRequest, httpServletResponse);
+        String adminUserName = (String) configContext.getAxisConfiguration().getParameter(
+                Constants.USER_NAME).getValue();
+        String adminPassword = (String) configContext.getAxisConfiguration().getParameter(
+                Constants.PASSWORD).getValue();
+
+        if (username.equals(adminUserName) && password.equals(adminPassword)) {
+            req.getSession().setAttribute(Constants.LOGGED, "Yes");
+            res.sendRedirect(ADMIN_JSP_NAME);
         } else {
-            listService(httpServletRequest, httpServletResponse, filePart);
+            throw new AdminAppException(Messages.getMessage("invaliduser"));
         }
     }
 
-    /**
-     * Method listServices
-     *
-     * @param req
-     * @param res
-     * @throws IOException
-     */
-    private void listServices(HttpServletRequest req, HttpServletResponse res) throws IOException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
-                configContext.getAxisConfiguration().getFaultyServices());
-        res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
-    }
+    private void chageParameters(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        if (req.getParameter("editServicepara") != null) {
+            String serviceName = req.getParameter("axisService");
+            AxisService service = configContext.getAxisConfiguration().getService(serviceName);
 
-    private void listServiceGroups(HttpServletRequest req, HttpServletResponse res) throws IOException {
-        Iterator serviceGroups = configContext.getAxisConfiguration().getServiceGroups();
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, serviceGroups);
-        res.sendRedirect(LIST_SERVICE_GROUP_JSP);
-    }
+            if (service != null) {
+                ArrayList service_para = service.getParameters();
 
+                for (int i = 0; i < service_para.size(); i++) {
+                    Parameter parameter = (Parameter) service_para.get(i);
+                    String para = req.getParameter(serviceName + "_" + parameter.getName());
 
-    private void listContexts(HttpServletRequest req, HttpServletResponse res) throws IOException {
-        req.getSession().setAttribute(Constants.CONFIG_CONTEXT, configContext);
-        res.sendRedirect("ViewContexts.jsp");
-    }
+                    service.addParameter(new ParameterImpl(parameter.getName(), para));
+                }
 
-    private void logout(HttpServletRequest req, HttpServletResponse res) throws IOException {
-        req.getSession().invalidate();
-        res.sendRedirect("index.jsp");
-    }
+                HashMap operation = service.getOperations();
+                Collection op_col = operation.values();
 
-    /**
-     * @param req
-     * @param res
-     * @throws IOException
-     */
-    private void listAdminServices(HttpServletRequest req,
-                                   HttpServletResponse res)
-            throws IOException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
-                configContext.getAxisConfiguration().getFaultyServices());
-        res.sendRedirect(LIST_SRVICES_JSP_NAME);
-    }
+                for (Iterator iterator = op_col.iterator(); iterator.hasNext();) {
+                    AxisOperation axisOperation = (AxisOperation) iterator.next();
+                    String op_name = axisOperation.getName().getLocalPart();
+                    ArrayList operation_para = axisOperation.getParameters();
 
-    private void selectService(HttpServletRequest req,
-                               HttpServletResponse res)
-            throws IOException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "VIEW");
-        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
-    }
+                    for (int i = 0; i < operation_para.size(); i++) {
+                        Parameter parameter = (Parameter) operation_para.get(i);
+                        String para = req.getParameter(op_name + "_" + parameter.getName());
 
-    private void adminLogging(HttpServletRequest req, HttpServletResponse res) throws AdminAppException, IOException {
-        String username = req.getParameter("userName");
-        String password = req.getParameter("password");
-        if (username == null
-                || password == null
-                || username.trim().equals("")
-                || password.trim().equals("")) {
-            throw new AdminAppException(Messages.getMessage("invaliduser"));
-        }
-        String adminUserName =
-                (String) configContext.getAxisConfiguration()
-                        .getParameter(Constants.USER_NAME)
-                        .getValue();
-        String adminPassword =
-                (String) configContext.getAxisConfiguration()
-                        .getParameter(Constants.PASSWORD)
-                        .getValue();
-        if (username.equals(adminUserName)
-                && password.equals(adminPassword)) {
-            req.getSession().setAttribute(Constants.LOGGED, "Yes");
-            res.sendRedirect(ADMIN_JSP_NAME);
+                        axisOperation.addParameter(new ParameterImpl(parameter.getName(), para));
+                    }
+                }
+            }
+
+            res.setContentType("text/css");
+
+            PrintWriter out_writer = new PrintWriter(out);
+
+            out_writer.println("Parameters  changed Successfully");
+            out_writer.flush();
+            out_writer.close();
+            req.getSession().removeAttribute(Constants.SERVICE);
+
+            return;
         } else {
-            throw new AdminAppException(Messages.getMessage("invaliduser"));
+            String service = req.getParameter("axisService");
+
+            if (service != null) {
+                req.getSession().setAttribute(
+                        Constants.SERVICE, configContext.getAxisConfiguration().getService(service));
+            }
         }
-    }
 
-    private void listModules(HttpServletRequest req, HttpServletResponse res) throws IOException {
-        HashMap modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
-        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
-        req.getSession().setAttribute(Constants.ERROR_MODULE_MAP,
-                configContext.getAxisConfiguration().getFaultyModules());
-        res.sendRedirect(LIST_AVAILABLE_MODULES_JSP_NAME);
+        res.sendRedirect(SERVICE_PARA_EDIT_JSP_NAME);
     }
 
-    private void engageModulesGlobally(HttpServletRequest req,
-                                       HttpServletResponse res)
+    private void engageModulesGlobally(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        HashMap modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+        HashMap modules = ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+
         req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+
         String moduleName = req.getParameter("modules");
+
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+
         if (moduleName != null) {
             try {
-                configContext.getAxisConfiguration().engageModule(
-                        new QName(moduleName));
+                configContext.getAxisConfiguration().engageModule(new QName(moduleName));
                 req.getSession().setAttribute(Constants.ENGAGE_STATUS,
                         moduleName + " module engaged globally Successfully");
             } catch (AxisFault axisFault) {
-                req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                        axisFault.getMessage());
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
             }
         }
+
         req.getSession().setAttribute("modules", null);
         res.sendRedirect(ENGAGING_MODULE_GLOBALLY_JSP_NAME);
     }
 
-    private void engageModulesToOperation(HttpServletRequest req,
-                                          HttpServletResponse res)
+    private void engageModulesToOperation(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        HashMap modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+        HashMap modules = ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+
         req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+
         String moduleName = req.getParameter("modules");
 
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
         req.getSession().setAttribute("modules", null);
 
         String serviceName = req.getParameter("service");
+
         if (serviceName != null) {
             req.getSession().setAttribute("service", serviceName);
         } else {
             serviceName = (String) req.getSession().getAttribute("service");
         }
-        req.getSession().setAttribute(Constants.OPERATION_MAP,
-                configContext
-                        .getAxisConfiguration()
-                        .getService(serviceName)
-                        .getOperations());
+
+        req.getSession().setAttribute(
+                Constants.OPERATION_MAP,
+                configContext.getAxisConfiguration().getService(serviceName).getOperations());
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
+
         String operationName = req.getParameter("operation");
-        if (serviceName != null && moduleName != null && operationName != null) {
+
+        if ((serviceName != null) && (moduleName != null) && (operationName != null)) {
             try {
-                AxisOperation od =
-                        configContext.getAxisConfiguration().getService(
-                                serviceName)
-                                .getOperation(new QName(operationName));
+                AxisOperation od = configContext.getAxisConfiguration().getService(
+                        serviceName).getOperation(new QName(operationName));
+
                 od.engageModule(
-                        configContext.getAxisConfiguration().getModule(
-                                new QName(moduleName)), configContext.getAxisConfiguration());
+                        configContext.getAxisConfiguration().getModule(new QName(moduleName)),
+                        configContext.getAxisConfiguration());
                 req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                        moduleName +
-                                " module engaged to the operation Successfully");
+                        moduleName
+                                + " module engaged to the operation Successfully");
             } catch (AxisFault axisFault) {
-                req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                        axisFault.getMessage());
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
             }
         }
+
         req.getSession().setAttribute("operation", null);
         res.sendRedirect(ENGAGE_TO_OPERATION_JSP_NAME);
     }
 
-
-    private void engageModulesToServiceGroup(HttpServletRequest req,
-                                             HttpServletResponse res)
+    private void engageModulesToService(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        HashMap modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+        HashMap modules = ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+
         req.getSession().setAttribute(Constants.MODULE_MAP, modules);
-        Iterator services = configContext.getAxisConfiguration().getServiceGroups();
-        req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, services);
+
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+
         String moduleName = req.getParameter("modules");
+
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
         req.getSession().setAttribute("modules", null);
+
         String serviceName = req.getParameter("service");
+
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
-        if (serviceName != null && moduleName != null) {
-            configContext.getAxisConfiguration().getServiceGroup(
-                    serviceName)
-                    .engageModuleToGroup(new QName(moduleName));
-            req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                    moduleName +
-                            " module engaged to the serviceGroup Successfully");
+
+        if ((serviceName != null) && (moduleName != null)) {
+            try {
+                configContext.getAxisConfiguration().getService(serviceName).engageModule(
+                        configContext.getAxisConfiguration().getModule(new QName(moduleName)),
+                        configContext.getAxisConfiguration());
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS,
+                        moduleName
+                                + " module engaged to the service Successfully");
+            } catch (AxisFault axisFault) {
+                req.getSession().setAttribute(Constants.ENGAGE_STATUS, axisFault.getMessage());
+            }
         }
+
         req.getSession().setAttribute("service", null);
-        res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME);
+        res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_JSP_NAME);
     }
 
-    private void engageModulesToService(HttpServletRequest req,
-                                        HttpServletResponse res)
+    private void engageModulesToServiceGroup(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        HashMap modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+        HashMap modules = ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+
         req.getSession().setAttribute(Constants.MODULE_MAP, modules);
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+
+        Iterator services = configContext.getAxisConfiguration().getServiceGroups();
+
+        req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, services);
+
         String moduleName = req.getParameter("modules");
+
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
         req.getSession().setAttribute("modules", null);
+
         String serviceName = req.getParameter("service");
+
         req.getSession().setAttribute(Constants.ENGAGE_STATUS, null);
-        if (serviceName != null && moduleName != null) {
-            try {
 
-                configContext.getAxisConfiguration().getService(
-                        serviceName)
-                        .engageModule(
-                                configContext.getAxisConfiguration().getModule(
-                                        new QName(moduleName)), configContext.getAxisConfiguration());
-                req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                        moduleName +
-                                " module engaged to the service Successfully");
-            } catch (AxisFault axisFault) {
-                req.getSession().setAttribute(Constants.ENGAGE_STATUS,
-                        axisFault.getMessage());
-            }
+        if ((serviceName != null) && (moduleName != null)) {
+            configContext.getAxisConfiguration().getServiceGroup(serviceName).engageModuleToGroup(
+                    new QName(moduleName));
+            req.getSession().setAttribute(Constants.ENGAGE_STATUS,
+                    moduleName
+                            + " module engaged to the serviceGroup Successfully");
         }
+
         req.getSession().setAttribute("service", null);
-        res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_JSP_NAME);
+        res.sendRedirect(ENGAGING_MODULE_TO_SERVICE_GROUP_JSP_NAME);
     }
 
-    private void listGloballyModules(HttpServletRequest req,
-                                     HttpServletResponse res)
-            throws IOException {
-        Collection modules =
-                ((AxisConfiguration) configContext.getAxisConfiguration()).getEngagedModules();
-        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
-        res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
-    }
+    public void handle(HttpServletRequest httpServletRequest,
+                       HttpServletResponse httpServletResponse, OutputStream out)
+            throws IOException, Exception {
+        this.out = out;
 
-    private void lsitServiceformodules(HttpServletRequest req,
-                                       HttpServletResponse res)
-            throws IOException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "MODULE");
-        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
-    }
+        String filePart = httpServletRequest.getRequestURL().toString();
 
-    private void lsitServiceforParameterChanged(HttpServletRequest req,
-                                                HttpServletResponse res)
-            throws IOException {
-        HashMap services = configContext.getAxisConfiguration().getServices();
-        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "SERVICE_PARAMETER");
-        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
-    }
+        if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LISTSERVICES)) {
+            listAdminServices(httpServletRequest, httpServletResponse);
 
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.LIST_MODULES)) {
+            listModules(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.LIST_GLOABLLY_ENGAGED_MODULES)) {
+            listGloballyModules(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.LIST_PHASES)) {
+            listPhases(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_GLOBAL_MODULE)) {
+            engageModulesGlobally(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE)) {
+            engageModulesToService(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.ENGAGE_MODULE_TO_SERVICE_GROUP)) {
+            engageModulesToServiceGroup(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.ADMIN_LOGIN)) {
+            adminLogging(httpServletRequest, httpServletResponse);
 
-    private void chageParameters(HttpServletRequest req,
-                                 HttpServletResponse res)
-            throws IOException {
-        if (req.getParameter("editServicepara") != null) {
-            String serviceName = req.getParameter("axisService");
-            AxisService service = configContext.getAxisConfiguration().
-                    getService(serviceName);
-            if (service != null) {
-                ArrayList service_para = service.getParameters();
-                for (int i = 0; i < service_para.size(); i++) {
-                    Parameter parameter = (Parameter) service_para.get(i);
-                    String para = req.getParameter(serviceName + "_" + parameter.getName());
-                    service.addParameter(new ParameterImpl(parameter.getName(), para));
-                }
-                HashMap operation = service.getOperations();
-                Collection op_col = operation.values();
-                for (Iterator iterator = op_col.iterator(); iterator.hasNext();) {
-                    AxisOperation axisOperation =
-                            (AxisOperation) iterator.next();
-                    String op_name = axisOperation.getName().getLocalPart();
-                    ArrayList operation_para = axisOperation.getParameters();
-                    for (int i = 0; i < operation_para.size(); i++) {
-                        Parameter parameter = (Parameter) operation_para.get(i);
-                        String para = req.getParameter(op_name + "_" + parameter.getName());
-                        axisOperation.addParameter(
-                                new ParameterImpl(parameter.getName(), para));
-                    }
-                }
-            }
-            res.setContentType("text/css");
-            PrintWriter out_writer = new PrintWriter(out);
-            out_writer.println("Parameters  changed Successfully");
-            out_writer.flush();
-            out_writer.close();
-            req.getSession().removeAttribute(Constants.SERVICE);
             return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_GLOBAL_HANDLERS)) {
+            viewGlobalHandlers(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.SELECT_SERVICE)) {
+            selectService(httpServletRequest, httpServletResponse);
 
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.VIEW_SERVICE_HANDLERS)) {
+            viewServiceHandlers(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.LIST_SERVICE_FOR_MODULE_ENGAGEMENT)) {
+            lsitServiceformodules(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.LIST_OPERATIONS_FOR_THE_SERVICE)) {
+            engageModulesToOperation(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.REMOVE_SERVICE)) {
+            removeService(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null)
+                && filePart.endsWith(Constants.SELECT_SERVICE_FOR_PARA_EDIT)) {
+            lsitServiceforParameterChanged(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.EDIR_SERVICE_PARA)) {
+            chageParameters(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.LIST_SERVICE_GROUPS)) {
+            listServiceGroups(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.LIST_CONTEXTS)) {
+            listContexts(httpServletRequest, httpServletResponse);
+
+            return;
+        } else if ((filePart != null) && filePart.endsWith(Constants.LOGOUT)) {
+            logout(httpServletRequest, httpServletResponse);
+
+            return;
+        }
+
+        if ((filePart != null) && filePart.endsWith(Constants.LIST_SERVICES)) {
+            listServices(httpServletRequest, httpServletResponse);
         } else {
-            String service = req.getParameter("axisService");
-            if (service != null) {
-                req.getSession().setAttribute(Constants.SERVICE,
-                        configContext.getAxisConfiguration().getService(
-                                service));
-            }
+            listService(httpServletRequest, httpServletResponse, filePart);
         }
-        res.sendRedirect(SERVICE_PARA_EDIT_JSP_NAME);
     }
 
-    private void removeService(HttpServletRequest req,
-                               HttpServletResponse res)
+    /**
+     * @param req
+     * @param res
+     * @throws IOException
+     */
+    private void listAdminServices(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        if (req.getParameter("submit") != null) {
-            String serviceName = req.getParameter("service");
-            String turnoff = req.getParameter("turnoff");
-            if (serviceName != null) {
-                if (turnoff != null) {
-                    configContext.getAxisConfiguration().removeService(serviceName);
-                    res.setContentType("text/css");
-                    PrintWriter out_writer = new PrintWriter(out);
-                    out_writer.println("Service removed from the system Successfully");
-                    out_writer.flush();
-                    out_writer.close();
-                    return;
-                }
-            }
+        HashMap services = configContext.getAxisConfiguration().getServices();
 
-        } else {
-            HashMap services = configContext.getAxisConfiguration().getServices();
-            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
-        }
-        res.sendRedirect(REMOVE_SERVICE_JSP_NAME);
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
+                configContext.getAxisConfiguration().getFaultyServices());
+        res.sendRedirect(LIST_SRVICES_JSP_NAME);
     }
 
-    private void viewGlobalHandlers(HttpServletRequest req,
-                                    HttpServletResponse res)
-            throws IOException {
-        req.getSession().setAttribute(Constants.GLOBAL_HANDLERS,
-                configContext.getAxisConfiguration());
-        res.sendRedirect(VIEW_GLOBAL_HANDLERS_JSP_NAME);
+    private void listContexts(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        req.getSession().setAttribute(Constants.CONFIG_CONTEXT, configContext);
+        res.sendRedirect("ViewContexts.jsp");
     }
 
-    private void viewServiceHandlers(HttpServletRequest req,
-                                     HttpServletResponse res)
+    private void listGloballyModules(HttpServletRequest req, HttpServletResponse res)
             throws IOException {
-        String service = req.getParameter("axisService");
-        if (service != null) {
-            req.getSession().setAttribute(Constants.SERVICE_HANDLERS,
-                    configContext.getAxisConfiguration().getService(
-                            service));
-        }
-        res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
+        Collection modules =
+                ((AxisConfiguration) configContext.getAxisConfiguration()).getEngagedModules();
+
+        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+        res.sendRedirect(LIST_GLOABLLY_ENGAGED_MODULES_JSP_NAME);
+    }
+
+    private void listModules(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        HashMap modules = ((AxisConfiguration) configContext.getAxisConfiguration()).getModules();
+
+        req.getSession().setAttribute(Constants.MODULE_MAP, modules);
+        req.getSession().setAttribute(Constants.ERROR_MODULE_MAP,
+                configContext.getAxisConfiguration().getFaultyModules());
+        res.sendRedirect(LIST_AVAILABLE_MODULES_JSP_NAME);
     }
 
     private void listPhases(HttpServletRequest req, HttpServletResponse res) throws IOException {
         ArrayList phaselist = new ArrayList();
         PhasesInfo info = configContext.getAxisConfiguration().getPhasesInfo();
+
         phaselist.add(info.getINPhases());
         phaselist.add(info.getIN_FaultPhases());
         phaselist.add(info.getOUTPhases());
         phaselist.add(info.getOUT_FaultPhases());
-
         phaselist.add(info.getOperationInPhases());
         phaselist.add(info.getOperationInFaultPhases());
         phaselist.add(info.getOperationOutPhases());
@@ -551,34 +457,139 @@
      * @param filePart
      * @throws IOException
      */
-    private void listService(HttpServletRequest req,
-                             HttpServletResponse res,
-                             String filePart)
+    private void listService(HttpServletRequest req, HttpServletResponse res, String filePart)
             throws IOException {
-        String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1,
-                filePart.length());
+        String serviceName = filePart.substring(filePart.lastIndexOf("/") + 1, filePart.length());
         HashMap services = configContext.getAxisConfiguration().getServices();
         String wsdl = req.getParameter("wsdl");
+
         if ((services != null) && !services.isEmpty()) {
             Object serviceObj = services.get(serviceName);
+
             if (serviceObj != null) {
                 if (wsdl != null) {
                     res.setContentType("text/xml");
+
                     PrintWriter out_writer = new PrintWriter(out);
-                    ((AxisService) serviceObj).printWSDL(out_writer,
-                            filePart);
+
+                    ((AxisService) serviceObj).printWSDL(out_writer, filePart);
                     out.flush();
                     out.close();
+
                     return;
                 } else {
-                    req.getSession().setAttribute(Constants.SINGLE_SERVICE,
-                            serviceObj);
+                    req.getSession().setAttribute(Constants.SINGLE_SERVICE, serviceObj);
                 }
             }
         }
+
         String URI = req.getRequestURI();
+
         URI = URI.substring(0, URI.indexOf("services"));
         res.sendRedirect(URI + LIST_SINGLE_SERVICE_JSP_NAME);
     }
 
+    private void listServiceGroups(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        Iterator serviceGroups = configContext.getAxisConfiguration().getServiceGroups();
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SERVICE_GROUP_MAP, serviceGroups);
+        res.sendRedirect(LIST_SERVICE_GROUP_JSP);
+    }
+
+    /**
+     * Method listServices
+     *
+     * @param req
+     * @param res
+     * @throws IOException
+     */
+    private void listServices(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.ERROR_SERVICE_MAP,
+                configContext.getAxisConfiguration().getFaultyServices());
+        res.sendRedirect(LIST_MULTIPLE_SERVICE_JSP_NAME);
+    }
+
+    private void logout(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        req.getSession().invalidate();
+        res.sendRedirect("index.jsp");
+    }
+
+    private void lsitServiceforParameterChanged(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "SERVICE_PARAMETER");
+        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+    }
+
+    private void lsitServiceformodules(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "MODULE");
+        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+    }
+
+    private void removeService(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        if (req.getParameter("submit") != null) {
+            String serviceName = req.getParameter("service");
+            String turnoff = req.getParameter("turnoff");
+
+            if (serviceName != null) {
+                if (turnoff != null) {
+                    configContext.getAxisConfiguration().removeService(serviceName);
+                    res.setContentType("text/css");
+
+                    PrintWriter out_writer = new PrintWriter(out);
+
+                    out_writer.println("Service removed from the system Successfully");
+                    out_writer.flush();
+                    out_writer.close();
+
+                    return;
+                }
+            }
+        } else {
+            HashMap services = configContext.getAxisConfiguration().getServices();
+
+            req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        }
+
+        res.sendRedirect(REMOVE_SERVICE_JSP_NAME);
+    }
+
+    private void selectService(HttpServletRequest req, HttpServletResponse res) throws IOException {
+        HashMap services = configContext.getAxisConfiguration().getServices();
+
+        req.getSession().setAttribute(Constants.SERVICE_MAP, services);
+        req.getSession().setAttribute(Constants.SELECT_SERVICE_TYPE, "VIEW");
+        res.sendRedirect(SELECT_SERVICE_JSP_NAME);
+    }
+
+    private void viewGlobalHandlers(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        req.getSession().setAttribute(Constants.GLOBAL_HANDLERS,
+                configContext.getAxisConfiguration());
+        res.sendRedirect(VIEW_GLOBAL_HANDLERS_JSP_NAME);
+    }
+
+    private void viewServiceHandlers(HttpServletRequest req, HttpServletResponse res)
+            throws IOException {
+        String service = req.getParameter("axisService");
+
+        if (service != null) {
+            req.getSession().setAttribute(Constants.SERVICE_HANDLERS,
+                    configContext.getAxisConfiguration().getService(service));
+        }
+
+        res.sendRedirect(VIEW_SERVICE_HANDLERS_JSP_NAME);
+    }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/RESTSender.java Fri Dec 16 09:13:57 2005
@@ -1,9 +1,9 @@
 /*
- * Created on Nov 28, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
+* Created on Nov 28, 2005
+*
+* TODO To change the template for this generated file go to
+* Window - Preferences - Java - Code Style - Code Templates
+*/
 package org.apache.axis2.transport.http;
 
 import org.apache.axis2.AxisFault;
@@ -32,11 +32,74 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
-
 public class RESTSender extends AbstractHTTPSender {
-
     private Log log = LogFactory.getLog(getClass());
 
+    public RequestData createRequest(MessageContext msgContext, OMElement dataout) {
+
+        // Obtain two strings;one to go in the url and rest to pass in the body
+        // when doing POST in application/x-www-form-urlencoded form.
+        RequestData data = new RequestData();
+        Iterator iter1 = dataout.getChildElements();
+        ArrayList paraList = new ArrayList();
+        ArrayList urlList = new ArrayList();
+
+        // TODO: s is ALWAYS EMPTY. so what gets added to urllist????
+        String[]  s = new String[]{};
+        OMElement bodypara = OMAbstractFactory.getOMFactory().createOMElement("temp", null);
+
+        while (iter1.hasNext()) {
+            OMElement ele = (OMElement) iter1.next();
+            boolean has = false;
+
+            for (int i = 0; i < s.length; i++) {
+                if (s[i].equals(ele.getLocalName())) {
+                    has = true;
+
+                    break;
+                }
+            }
+
+            String parameter1;
+
+            if (has) {
+                parameter1 = ele.getLocalName() + "=" + ele.getText();
+                urlList.add(parameter1);
+            } else {
+                bodypara.addChild(ele);
+            }
+        }
+
+        String urlString = "";
+
+        for (int i = 0; i < urlList.size(); i++) {
+            String c = (String) urlList.get(i);
+
+            urlString = urlString + "&" + c;
+            data.urlRequest = urlString;
+        }
+
+        Iterator it = bodypara.getChildElements();
+
+        while (it.hasNext()) {
+            OMElement ele1 = (OMElement) it.next();
+            String parameter2;
+
+            parameter2 = ele1.getLocalName() + "=" + ele1.getText();
+            paraList.add(parameter2);
+        }
+
+        String paraString = "";
+
+        for (int j = 0; j < paraList.size(); j++) {
+            String b = (String) paraList.get(j);
+
+            paraString = paraString + "&" + b;
+            data.bodyRequest = paraString;
+        }
+
+        return data;
+    }
 
     /**
      * By this time, you must have identified that you are doing REST here. Following default values
@@ -48,99 +111,162 @@
      * @param url
      * @param soapActionString
      */
-    public void send(MessageContext msgContext,
-                     OMElement dataout, URL url, String soapActionString) {
+    public void send(MessageContext msgContext, OMElement dataout, URL url,
+                     String soapActionString) {
         try {
-            String httpMethod = (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
+            String httpMethod =
+                    (String) msgContext.getProperty(Constants.Configuration.HTTP_METHOD);
 
-            if (httpMethod != null && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
+            if ((httpMethod != null)
+                    && Constants.Configuration.HTTP_METHOD_GET.equalsIgnoreCase(httpMethod)) {
                 this.sendViaGet(msgContext, url);
+
                 return;
             }
-            this.sendViaPost(msgContext, dataout, url,
-                    soapActionString);
 
+            this.sendViaPost(msgContext, dataout, url, soapActionString);
         } catch (Exception e) {
             log.error("Error in extracting transport properties from message context", e);
         }
     }
 
-    private void sendViaPost(MessageContext msgContext,
-                             OMElement dataout, URL url, String soapActionString) {
-        //execuite the HtttpMethodBase - a connection manager can be given for
+    private void sendViaGet(MessageContext msgContext, URL url)
+            throws MalformedURLException, AxisFault, IOException {
+        String param = getParam(msgContext);
+        GetMethod getMethod = new GetMethod();
+
+        getMethod.setPath(url.getFile() + "?" + param);
+
+        // Serialization as "application/x-www-form-urlencoded"
+        String charEncoding =
+                (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+
+        if (charEncoding == null) {    // Default encoding scheme
+            getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + MessageContext.DEFAULT_CHAR_SET_ENCODING);
+        } else {
+            getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
+                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
+                            + charEncoding);
+        }
+
+        this.httpClient = new HttpClient();
+
+        HostConfiguration hostConfig = this.getHostConfiguration(httpClient, msgContext, url);
+
+        // this.getHostConfiguration(msgContext, url);
+
+        // Get the timeout values set in the runtime
+        getTimeoutValues(msgContext);
+
+        // SO_TIMEOUT -- timeout for blocking reads
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
+
+        // timeout for initial connection
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
+
+        /**
+         * with HostConfiguration
+         */
+        this.httpClient.executeMethod(hostConfig, getMethod, null);
+
+        if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
+            processResponse(getMethod, msgContext);
+        } else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
+            return;
+        } else if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
+            Header contenttypeHheader =
+                    getMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            String value = contenttypeHheader.getValue();
+
+            if (value != null) {
+                if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
+                        || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
+                    processResponse(getMethod, msgContext);
+                }
+            }
+        } else {
+            throw new AxisFault(Messages.getMessage("transportError",
+                    String.valueOf(getMethod.getStatusCode()),
+                    getMethod.getResponseBodyAsString()));
+        }
+    }
+
+    private void sendViaPost(MessageContext msgContext, OMElement dataout, URL url,
+                             String soapActionString) {
+
+        // execuite the HtttpMethodBase - a connection manager can be given for
         // handle multiple
         httpClient = new HttpClient();
-        //hostConfig handles the socket functions..
-        //HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
 
-        //Get the timeout values set in the runtime
+        // hostConfig handles the socket functions..
+        // HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
+
+        // Get the timeout values set in the runtime
         getTimeoutValues(msgContext);
 
         // SO_TIMEOUT -- timeout for blocking reads
-        httpClient.getHttpConnectionManager().getParams().setSoTimeout(
-                soTimeout);
-        // timeout for initial connection
-        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(
-                connectionTimeout);
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
 
-        //todo giving proxy and NTLM support
+        // timeout for initial connection
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
 
+        // todo giving proxy and NTLM support
         PostMethod postMethod = new PostMethod(url.toString());
         String httpContentType;
+
         if (msgContext.getProperty(Constants.Configuration.CONTENT_TYPE) != null) {
             httpContentType = (String) msgContext.getProperty(Constants.Configuration.CONTENT_TYPE);
         } else {
             httpContentType = HTTPConstants.MEDIA_TYPE_APPLICATION_XML;
         }
 
+        msgContext.setProperty(CommonsHTTPTransportSender.HTTP_METHOD, postMethod);
+
+        String charEncoding =
+                (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
 
-        msgContext.setProperty(CommonsHTTPTransportSender.HTTP_METHOD,
-                postMethod);
-        String charEncoding = (String) msgContext
-                .getProperty(MessageContext.CHARACTER_SET_ENCODING);
         if (charEncoding == null) {
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
 
-        //if POST as application/x-www-form-urlencoded
+        // if POST as application/x-www-form-urlencoded
         RequestData reqData;
 
-        //System.out.print((String)msgContext.);
-
+        // System.out.print((String)msgContext.);
         if (httpContentType.equalsIgnoreCase(HTTPConstants.MEDIA_TYPE_X_WWW_FORM)) {
             reqData = createRequest(msgContext, dataout);
-            postMethod
-                    .setPath(url.getPath()
-                            + ((reqData.urlRequest) != null ? ("?" + reqData.urlRequest)
-                            : ""));
-            postMethod.setRequestEntity(new AxisRESTRequestEntity(
-                    reqData.bodyRequest, charEncoding, msgContext,
-                    httpContentType));
-
+            postMethod.setPath(url.getPath() + ((reqData.urlRequest) != null
+                    ? ("?" + reqData.urlRequest)
+                    : ""));
+            postMethod.setRequestEntity(new AxisRESTRequestEntity(reqData.bodyRequest,
+                    charEncoding, msgContext, httpContentType));
         } else {
             postMethod.setPath(url.getPath());
-
-            postMethod.setRequestEntity(new AxisRequestEntity(dataout,
-                    chuncked, msgContext, charEncoding, soapActionString));
+            postMethod.setRequestEntity(new AxisRequestEntity(dataout, chuncked, msgContext,
+                    charEncoding, soapActionString));
         }
 
         if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chuncked) {
             postMethod.setContentChunked(true);
         }
-        postMethod
-                .setRequestHeader(HTTPConstants.HEADER_USER_AGENT, "Axis/2.0");
+
+        postMethod.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, "Axis/2.0");
+
         if (msgContext.isSOAP11() && !msgContext.isDoingREST()) {
-            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
-                    soapActionString);
+            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapActionString);
         }
+
         postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
+
         if (httpVersion != null) {
             if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-
                 httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
                         HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
             } else {
+
                 // allowing keep-alive for 1.1
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
                         HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
@@ -152,202 +278,74 @@
         /**
          * main excecution takes place..
          */
-
         try {
-            HostConfiguration config = this.getHostConfiguration(httpClient,
-                    msgContext, url);
+            HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
 
             this.httpClient.executeMethod(config, postMethod);
 
             if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
                 processResponse(postMethod, msgContext);
+
                 return;
             } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
                 return;
             } else if (postMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
-                Header contenttypeHheader = postMethod
-                        .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+                Header contenttypeHheader =
+                        postMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
 
                 if (contenttypeHheader != null) {
                     String value = contenttypeHheader.getValue();
-                    if (value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0
-                            || value
-                            .indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0) {
+
+                    if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
+                            || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
                         processResponse(postMethod, msgContext);
+
                         return;
                     }
                 }
             }
-            throw new AxisFault(Messages.getMessage("transportError", String
-                    .valueOf(postMethod.getStatusCode()), postMethod
-                    .getResponseBodyAsString()));
+
+            throw new AxisFault(Messages.getMessage("transportError",
+                    String.valueOf(postMethod.getStatusCode()),
+                    postMethod.getResponseBodyAsString()));
         } catch (Exception e) {
             log.error("Error in processing POST request", e);
         }
     }
 
-    private void sendViaGet(MessageContext msgContext, URL url)
-            throws MalformedURLException, AxisFault, IOException {
-
-        String param = getParam(msgContext);
-        GetMethod getMethod = new GetMethod();
-        getMethod.setPath(url.getFile() + "?" + param);
-
-        //Serialization as "application/x-www-form-urlencoded"
-
-        String charEncoding = (String) msgContext
-                .getProperty(MessageContext.CHARACTER_SET_ENCODING);
-        if (charEncoding == null) //Default encoding scheme
-            getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
-                            + MessageContext.DEFAULT_CHAR_SET_ENCODING);
-        else
-            getMethod.setRequestHeader(HTTPConstants.HEADER_CONTENT_TYPE,
-                    HTTPConstants.MEDIA_TYPE_X_WWW_FORM + "; charset="
-                            + charEncoding);
-
-        this.httpClient = new HttpClient();
-
-        HostConfiguration hostConfig = this.getHostConfiguration(httpClient,
-                msgContext, url);
-        //this.getHostConfiguration(msgContext, url);
-
-        //Get the timeout values set in the runtime
-        getTimeoutValues(msgContext);
-
-        // SO_TIMEOUT -- timeout for blocking reads
-        httpClient.getHttpConnectionManager().getParams().setSoTimeout(
-                soTimeout);
-        // timeout for initial connection
-        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(
-                connectionTimeout);
-
-        /**
-         * with HostConfiguration
-         */
-        this.httpClient.executeMethod(hostConfig, getMethod, null);
-
-        if (getMethod.getStatusCode() == HttpStatus.SC_OK) {
-            processResponse(getMethod, msgContext);
-        } else if (getMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
-            return;
-        } else if (getMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
-
-            Header contenttypeHheader = getMethod
-                    .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
-
-            String value = contenttypeHheader.getValue();
-            if (value != null) {
-                if (value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0
-                        || value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0) {
-                    processResponse(getMethod, msgContext);
-                }
-
-            }
-        } else {
-            throw new AxisFault(Messages.getMessage("transportError", String
-                    .valueOf(getMethod.getStatusCode()), getMethod
-                    .getResponseBodyAsString()));
-        }
-    }
-
     public String getParam(MessageContext msgContext) {
         OMElement dataOut;
+
         dataOut = msgContext.getEnvelope().getBody().getFirstElement();
+
         Iterator iter1 = dataOut.getChildElements();
         ArrayList paraList = new ArrayList();
 
         while (iter1.hasNext()) {
             OMElement ele = (OMElement) iter1.next();
             String parameter;
+
             parameter = ele.getLocalName() + "=" + ele.getText();
             paraList.add(parameter);
         }
 
         String paraString = "";
         int count = paraList.size();
+
         for (int i = 0; i < count; i++) {
             String c = (String) paraList.get(i);
+
             paraString = paraString + "&" + c;
         }
 
         return paraString;
     }
 
-    public RequestData createRequest(MessageContext msgContext,
-                                     OMElement dataout) {
-        //Obtain two strings;one to go in the url and rest to pass in the body
-        // when doing POST in application/x-www-form-urlencoded form.
-        RequestData data = new RequestData();
-        Iterator iter1 = dataout.getChildElements();
-        ArrayList paraList = new ArrayList();
-        ArrayList urlList = new ArrayList();
-
-        //TODO: s is ALWAYS EMPTY. so what gets added to urllist????
-        String[] s = new String[]{};
-        OMElement bodypara = OMAbstractFactory.getOMFactory().createOMElement(
-                "temp", null);
-
-        while (iter1.hasNext()) {
-            OMElement ele = (OMElement) iter1.next();
-            boolean has = false;
-
-            for (int i = 0; i < s.length; i++) {
-                if (s[i].equals(ele.getLocalName())) {
-                    has = true;
-                    break;
-                }
-            }
-            String parameter1;
-
-            if (has) {
-                parameter1 = ele.getLocalName() + "=" + ele.getText();
-                urlList.add(parameter1);
-
-            } else {
-                bodypara.addChild(ele);
-            }
-        }
-
-        String urlString = "";
-        for (int i = 0; i < urlList.size(); i++) {
-            String c = (String) urlList.get(i);
-            urlString = urlString + "&" + c;
-            data.urlRequest = urlString;
-        }
-
-        Iterator it = bodypara.getChildElements();
-        while (it.hasNext()) {
-            OMElement ele1 = (OMElement) it.next();
-            String parameter2;
-            parameter2 = ele1.getLocalName() + "=" + ele1.getText();
-            paraList.add(parameter2);
-        }
-
-        String paraString = "";
-        for (int j = 0; j < paraList.size(); j++) {
-            String b = (String) paraList.get(j);
-            paraString = paraString + "&" + b;
-            data.bodyRequest = paraString;
-        }
-        return data;
-    }
-
-    private class RequestData {
-        private String urlRequest;
-
-        private String bodyRequest;
-    }
-
     public class AxisRESTRequestEntity implements RequestEntity {
-
         private String charSetEnc;
-
-        private String postRequestBody;
-
-        private MessageContext msgCtxt;
-
         private String contentType;
+        private MessageContext msgCtxt;
+        private String postRequestBody;
 
         public AxisRESTRequestEntity(String postRequestBody, String charSetEnc,
                                      MessageContext msgCtxt, String contentType) {
@@ -357,10 +355,6 @@
             this.contentType = contentType;
         }
 
-        public boolean isRepeatable() {
-            return true;
-        }
-
         public void writeRequest(OutputStream output) throws IOException {
             output.write(postRequestBody.getBytes());
         }
@@ -373,5 +367,14 @@
             return this.contentType;
         }
 
+        public boolean isRepeatable() {
+            return true;
+        }
+    }
+
+
+    private class RequestData {
+        private String bodyRequest;
+        private String urlRequest;
     }
-}
\ No newline at end of file
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SOAPOverHTTPSender.java Fri Dec 16 09:13:57 2005
@@ -1,9 +1,9 @@
 /*
- * Created on Nov 28, 2005
- *
- * TODO To change the template for this generated file go to
- * Window - Preferences - Java - Code Style - Code Templates
- */
+* Created on Nov 28, 2005
+*
+* TODO To change the template for this generated file go to
+* Window - Preferences - Java - Code Style - Code Templates
+*/
 package org.apache.axis2.transport.http;
 
 import org.apache.axis2.AxisFault;
@@ -29,68 +29,61 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 
-
 public class SOAPOverHTTPSender extends AbstractHTTPSender {
-
-    public void send(MessageContext msgContext,
-                     OMElement dataout, URL url, String soapActionString)
+    public void send(MessageContext msgContext, OMElement dataout, URL url, String soapActionString)
             throws MalformedURLException, AxisFault, IOException {
 
         // execute the HtttpMethodBase - a connection manager can be given for
         // handle multiple
         httpClient = new HttpClient();
-        //hostConfig handles the socket functions..
-        //HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
 
-        //Get the timeout values set in the runtime
+        // hostConfig handles the socket functions..
+        // HostConfiguration hostConfig = getHostConfiguration(msgContext, url);
+
+        // Get the timeout values set in the runtime
         getTimeoutValues(msgContext);
 
         // SO_TIMEOUT -- timeout for blocking reads
-        httpClient.getHttpConnectionManager().getParams().setSoTimeout(
-                soTimeout);
-        // timeout for initial connection
-        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(
-                connectionTimeout);
-
+        httpClient.getHttpConnectionManager().getParams().setSoTimeout(soTimeout);
 
+        // timeout for initial connection
+        httpClient.getHttpConnectionManager().getParams().setConnectionTimeout(connectionTimeout);
 
         PostMethod postMethod = new PostMethod(url.toString());
 
-        msgContext.setProperty(CommonsHTTPTransportSender.HTTP_METHOD,
-                postMethod);
+        msgContext.setProperty(CommonsHTTPTransportSender.HTTP_METHOD, postMethod);
+
         String charEncoding =
-                (String) msgContext.getProperty(
-                        MessageContext.CHARACTER_SET_ENCODING);
+                (String) msgContext.getProperty(MessageContext.CHARACTER_SET_ENCODING);
+
         if (charEncoding == null) {
             charEncoding = MessageContext.DEFAULT_CHAR_SET_ENCODING;
         }
 
         postMethod.setPath(url.getPath());
-
-        postMethod.setRequestEntity(new AxisSOAPRequestEntity(dataout, chuncked,
-                msgContext, charEncoding, soapActionString));
+        postMethod.setRequestEntity(new AxisSOAPRequestEntity(dataout, chuncked, msgContext,
+                charEncoding, soapActionString));
 
         if (!httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10) && chuncked) {
             postMethod.setContentChunked(true);
         }
-        postMethod
-                .setRequestHeader(HTTPConstants.HEADER_USER_AGENT, "Axis/2.0");
 
+        postMethod.setRequestHeader(HTTPConstants.HEADER_USER_AGENT, "Axis/2.0");
 
         if (msgContext.isSOAP11()) {
-            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION,
-                    soapActionString);
-        }else{
-
+            postMethod.setRequestHeader(HTTPConstants.HEADER_SOAP_ACTION, soapActionString);
+        } else {
         }
+
         postMethod.setRequestHeader(HTTPConstants.HEADER_HOST, url.getHost());
+
         if (httpVersion != null) {
             if (httpVersion.equals(HTTPConstants.HEADER_PROTOCOL_10)) {
-
                 httpClient.getParams().setVersion(HttpVersion.HTTP_1_0);
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
                         HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
             } else {
+
                 // allowing keep-alive for 1.1
                 postMethod.setRequestHeader(HTTPConstants.HEADER_CONNECTION,
                         HTTPConstants.HEADER_CONNECTION_KEEPALIVE);
@@ -100,63 +93,52 @@
         }
 
         /*
-           * main excecution takes place..
-           */
-
-        HostConfiguration config = this.getHostConfiguration(httpClient,
-                msgContext, url);
-
+         *   main excecution takes place..
+         */
+        HostConfiguration config = this.getHostConfiguration(httpClient, msgContext, url);
 
         this.httpClient.executeMethod(config, postMethod);
+
         /*
-           * Execution is over
-           */
+         *   Execution is over
+         */
         if (postMethod.getStatusCode() == HttpStatus.SC_OK) {
             processResponse(postMethod, msgContext);
+
             return;
         } else if (postMethod.getStatusCode() == HttpStatus.SC_ACCEPTED) {
             return;
         } else if (postMethod.getStatusCode() == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
-            Header contentTypeHeader = postMethod
-                    .getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
+            Header contentTypeHeader =
+                    postMethod.getResponseHeader(HTTPConstants.HEADER_CONTENT_TYPE);
 
             if (contentTypeHeader != null) {
                 String value = contentTypeHeader.getValue();
-                if (value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0
-                        || value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0) {
+
+                if ((value.indexOf(SOAP11Constants.SOAP_11_CONTENT_TYPE) >= 0)
+                        || (value.indexOf(SOAP12Constants.SOAP_12_CONTENT_TYPE) >= 0)) {
                     processResponse(postMethod, msgContext);
+
                     return;
                 }
             }
         }
-        throw new AxisFault(Messages.getMessage("transportError", String
-                .valueOf(postMethod.getStatusCode()), postMethod
-                .getResponseBodyAsString()));
 
+        throw new AxisFault(Messages.getMessage("transportError",
+                String.valueOf(postMethod.getStatusCode()), postMethod.getResponseBodyAsString()));
     }
 
     public class AxisSOAPRequestEntity implements RequestEntity {
-
+        private boolean doingMTOM = false;
+        private byte[] bytes;
         private String charSetEnc;
-
-        private OMElement element;
-
         private boolean chuncked;
-
-        private byte[] bytes;
-
-        private boolean doingMTOM = false;
-
-        private String soapActionString;
-
+        private OMElement element;
         private MessageContext msgCtxt;
+        private String soapActionString;
 
-        public AxisSOAPRequestEntity(
-                OMElement element,
-                boolean chuncked,
-                MessageContext msgCtxt,
-                String charSetEncoding,
-                String soapActionString) {
+        public AxisSOAPRequestEntity(OMElement element, boolean chuncked, MessageContext msgCtxt,
+                                     String charSetEncoding, String soapActionString) {
             this.element = element;
             this.chuncked = chuncked;
             this.msgCtxt = msgCtxt;
@@ -165,8 +147,9 @@
             this.soapActionString = soapActionString;
         }
 
-        public boolean isRepeatable() {
-            return true;
+        private void handleOMOutput(OutputStream out, boolean doingMTOM) throws XMLStreamException {
+            format.setDoOptimize(doingMTOM);
+            element.serializeAndConsume(out, format);
         }
 
         public byte[] writeBytes() throws AxisFault {
@@ -175,14 +158,16 @@
 
                 if (!doingMTOM) {
                     OMOutputFormat format2 = new OMOutputFormat();
+
                     format2.setCharSetEncoding(charSetEnc);
                     element.serializeAndConsume(bytesOut, format2);
-                    return bytesOut.toByteArray();
 
+                    return bytesOut.toByteArray();
                 } else {
                     format.setCharSetEncoding(charSetEnc);
                     format.setDoOptimize(true);
                     element.serializeAndConsume(bytesOut, format);
+
                     return bytesOut.toByteArray();
                 }
             } catch (XMLStreamException e) {
@@ -192,24 +177,18 @@
             }
         }
 
-        private void handleOMOutput(OutputStream out, boolean doingMTOM)
-                throws XMLStreamException {
-            format.setDoOptimize(doingMTOM);
-            element.serializeAndConsume(out, format);
-        }
-
         public void writeRequest(OutputStream out) throws IOException {
             try {
-                if (doingMTOM) { //chagened ..
+                if (doingMTOM) {    // chagened ..
                     if (chuncked) {
                         this.handleOMOutput(out, doingMTOM);
                     } else {
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         out.write(bytes);
                     }
-
                 } else {
                     if (chuncked) {
                         this.handleOMOutput(out, doingMTOM);
@@ -217,9 +196,11 @@
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         out.write(bytes);
                     }
                 }
+
                 out.flush();
             } catch (XMLStreamException e) {
                 throw new AxisFault(e);
@@ -232,13 +213,14 @@
 
         public long getContentLength() {
             try {
-                if (doingMTOM) {    //chagened
+                if (doingMTOM) {    // chagened
                     if (chuncked) {
                         return -1;
                     } else {
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         return bytes.length;
                     }
                 } else {
@@ -248,6 +230,7 @@
                         if (bytes == null) {
                             bytes = writeBytes();
                         }
+
                         return bytes.length;
                     }
                 }
@@ -257,18 +240,24 @@
         }
 
         public String getContentType() {
-
             String encoding = format.getCharSetEncoding();
             String contentType = format.getContentType();
+
             if (encoding != null) {
                 contentType += "; charset=" + encoding;
             }
 
             // action header is not mandated in SOAP 1.2. So putting it, if available
-            if (!msgCtxt.isSOAP11() && soapActionString != null && !"".equals(soapActionString.trim())) {
+            if (!msgCtxt.isSOAP11() && (soapActionString != null)
+                    && !"".equals(soapActionString.trim())) {
                 contentType = contentType + ";action=\"" + soapActionString + "\";";
             }
+
             return contentType;
+        }
+
+        public boolean isRepeatable() {
+            return true;
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/ServletBasedOutTransportInfo.java Fri Dec 16 09:13:57 2005
@@ -1,18 +1,19 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 
 package org.apache.axis2.transport.http;
 
@@ -30,5 +31,4 @@
     public void setContentType(String contentType) {
         response.setContentType(contentType);
     }
-
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutTransportInfo.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutTransportInfo.java?rev=357187&r1=357186&r2=357187&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutTransportInfo.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/SimpleHTTPOutTransportInfo.java Fri Dec 16 09:13:57 2005
@@ -1,41 +1,43 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 
 package org.apache.axis2.transport.http;
 
-import org.apache.axis2.transport.http.server.SimpleResponse;
 import org.apache.axis2.transport.OutTransportInfo;
+import org.apache.axis2.transport.http.server.SimpleResponse;
 import org.apache.commons.httpclient.Header;
 
 public class SimpleHTTPOutTransportInfo implements OutTransportInfo {
-    private SimpleResponse outInfo;
     private String encoding;
+    private SimpleResponse outInfo;
 
     public SimpleHTTPOutTransportInfo(SimpleResponse outInfo) {
         this.outInfo = outInfo;
     }
 
+    public void setCharacterEncoding(String encoding) {
+        this.encoding = encoding;
+    }
+
     public void setContentType(String contentType) {
-        if(encoding != null){
+        if (encoding != null) {
             contentType = contentType + ";charset=" + encoding;
         }
-        outInfo.setHeader(new Header(HTTPConstants.HEADER_CONTENT_TYPE,contentType));
-    }
 
-    public void setCharacterEncoding(String encoding) {
-        this.encoding = encoding;
+        outInfo.setHeader(new Header(HTTPConstants.HEADER_CONTENT_TYPE, contentType));
     }
 }