cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/master to 29f711e
Date Fri, 01 Aug 2014 23:56:21 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master b5db68e2d -> 29f711e0a


remove unused servlet


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/29f711e0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/29f711e0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/29f711e0

Branch: refs/heads/master
Commit: 29f711e0a9275001b3891a796f3a5bf033f52ca7
Parents: b5db68e
Author: Edison Su <sudison@gmail.com>
Authored: Fri Aug 1 16:55:35 2014 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Fri Aug 1 16:55:35 2014 -0700

----------------------------------------------------------------------
 client/WEB-INF/web.xml                          |  12 +-
 .../cloud/servlet/RegisterCompleteServlet.java  | 134 -------------------
 2 files changed, 2 insertions(+), 144 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29f711e0/client/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml
index 6509a97..7ccfc31 100644
--- a/client/WEB-INF/web.xml
+++ b/client/WEB-INF/web.xml
@@ -54,11 +54,7 @@
         <load-on-startup>6</load-on-startup>
     </servlet>
 	
-	<servlet>
-        <servlet-name>registerCompleteServlet</servlet-name>
-        <servlet-class>com.cloud.servlet.RegisterCompleteServlet</servlet-class>
-    </servlet>
- 
+
     <servlet>
         <servlet-name>staticResources</servlet-name>
         <servlet-class>com.cloud.servlet.StaticResourceServlet</servlet-class>
@@ -74,11 +70,7 @@
          <url-pattern>/console</url-pattern> 
     </servlet-mapping>
 	
-	<servlet-mapping>   
-         <servlet-name>registerCompleteServlet</servlet-name>   
-         <url-pattern>/mycloud/complete</url-pattern> 
-    </servlet-mapping>
-    
+
     <servlet-mapping>
         <servlet-name>staticResources</servlet-name>
         <url-pattern>*.css</url-pattern>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29f711e0/server/src/com/cloud/servlet/RegisterCompleteServlet.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/servlet/RegisterCompleteServlet.java b/server/src/com/cloud/servlet/RegisterCompleteServlet.java
deleted file mode 100644
index 0a8bd1d..0000000
--- a/server/src/com/cloud/servlet/RegisterCompleteServlet.java
+++ /dev/null
@@ -1,134 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you 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 com.cloud.servlet;
-
-import java.net.URLEncoder;
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.support.SpringBeanAutowiringSupport;
-
-import org.apache.cloudstack.config.Configuration;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-
-import com.cloud.user.Account;
-import com.cloud.user.AccountService;
-import com.cloud.user.User;
-import com.cloud.user.UserVO;
-import com.cloud.user.dao.UserDao;
-import com.cloud.utils.SerialVersionUID;
-
-@Component("registerCompleteServlet")
-public class RegisterCompleteServlet extends HttpServlet {
-    public static final Logger s_logger = Logger.getLogger(RegisterCompleteServlet.class.getName());
-
-    static final long serialVersionUID = SerialVersionUID.CloudStartupServlet;
-
-    @Inject
-    AccountService _accountSvc;
-    @Inject
-    ConfigurationDao _configDao;
-    @Inject
-    UserDao _userDao;
-
-    public RegisterCompleteServlet() {
-    }
-
-    @Override
-    public void init(ServletConfig config) throws ServletException {
-        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
-    }
-
-    @Override
-    protected void doPost(HttpServletRequest req, HttpServletResponse resp) {
-        doGet(req, resp);
-    }
-
-    @Override
-    protected void doGet(HttpServletRequest req, HttpServletResponse resp) {
-        String registrationToken = req.getParameter("token");
-        String expires = req.getParameter("expires");
-        int statusCode = HttpServletResponse.SC_OK;
-        String responseMessage = null;
-
-        if (registrationToken == null || registrationToken.trim().length() == 0) {
-            statusCode = 503;
-            responseMessage = "{ \"registration_info\" : { \"errorcode\" : \"503\", \"errortext\"
: \"Missing token\" } }";
-        } else {
-            s_logger.info("Attempting to register user account with token = " + registrationToken);
-            User resourceAdminUser = _accountSvc.getActiveUserByRegistrationToken(registrationToken);
-            if (resourceAdminUser != null) {
-                if (resourceAdminUser.isRegistered()) {
-                    statusCode = 503;
-                    responseMessage = "{ \"registration_info\" : { \"errorcode\" : \"503\",
\"errortext\" : \"Expired token = " + registrationToken + "\" } }";
-                } else {
-                    if (expires != null && expires.toLowerCase().equals("true"))
{
-                        _accountSvc.markUserRegistered(resourceAdminUser.getId());
-                    }
-
-                    Account resourceAdminAccount = _accountSvc.getActiveAccountById(resourceAdminUser.getAccountId());
-                    Account rsUserAccount = _accountSvc.getActiveAccountByName(resourceAdminAccount.getAccountName()
+ "-user", resourceAdminAccount.getDomainId());
-
-                    List<UserVO> users = _userDao.listByAccount(rsUserAccount.getId());
-                    User rsUser = users.get(0);
-
-                    Configuration config = _configDao.findByName("endpointe.url");
-
-                    StringBuffer sb = new StringBuffer();
-                    sb.append("{ \"registration_info\" : { \"endpoint_url\" : \"" + encodeParam(config.getValue())
+ "\", ");
-                    sb.append("\"domain_id\" : \"" + resourceAdminAccount.getDomainId() +
"\", ");
-                    sb.append("\"admin_account\" : \"" + encodeParam(resourceAdminUser.getUsername())
+ "\", ");
-                    sb.append("\"admin_account_api_key\" : \"" + resourceAdminUser.getApiKey()
+ "\", ");
-                    sb.append("\"admin_account_secret_key\" : \"" + resourceAdminUser.getSecretKey()
+ "\", ");
-                    sb.append("\"user_account\" : \"" + encodeParam(rsUser.getUsername())
+ "\", ");
-                    sb.append("\"user_account_api_key\" : \"" + rsUser.getApiKey() + "\",
");
-                    sb.append("\"user_account_secret_key\" : \"" + rsUser.getSecretKey()
+ "\" ");
-                    sb.append("} }");
-                    responseMessage = sb.toString();
-                }
-            } else {
-                statusCode = 503;
-                responseMessage = "{ \"registration_info\" : { \"errorcode\" : \"503\", \"errortext\"
: \"Invalid token = " + registrationToken + "\" } }";
-            }
-        }
-
-        try {
-            resp.setContentType("text/javascript; charset=UTF-8");
-            resp.setStatus(statusCode);
-            resp.getWriter().print(responseMessage);
-        } catch (Exception ex) {
-            s_logger.error("unknown exception writing register complete response", ex);
-        }
-    }
-
-    private String encodeParam(String value) {
-        try {
-            return URLEncoder.encode(value, "UTF-8").replaceAll("\\+", "%20");
-        } catch (Exception e) {
-            s_logger.warn("Unable to encode: " + value);
-        }
-        return value;
-    }
-}


Mime
View raw message