@Override @Transactional public void addNewAlias(Application application, String alias) throws ServiceException, CheckException { logger.info("ALIAS VALUE IN addNewAlias : " + alias); if (checkAliasIfExists(alias)) { throw new CheckException( "This alias is already used by another application on this CloudUnit instance"); } alias = alias.toLowerCase(); if (alias.startsWith("https://") || alias.startsWith("http://") || alias.startsWith("ftp://")) { alias = alias.substring(alias.lastIndexOf("//") + 2, alias.length()); } if (!StringUtils.isAlphanumeric(alias)) { throw new CheckException( "This alias must be alphanumeric. Please remove all other characters"); } try { Server server = application.getServers().get(0); application.getAliases().add(alias); hipacheRedisUtils.writeNewAlias(alias, application, server.getServerAction().getServerPort()); applicationDAO.save(application); } catch (DataAccessException e) { throw new ServiceException(e.getLocalizedMessage(), e); } }