diff --git a/framework/src/main/java/org/tron/core/services/annotation/FullServlet.java b/framework/src/main/java/org/tron/core/services/annotation/FullServlet.java new file mode 100644 index 00000000000..fa811b2d495 --- /dev/null +++ b/framework/src/main/java/org/tron/core/services/annotation/FullServlet.java @@ -0,0 +1,22 @@ +package org.tron.core.services.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.tron.core.services.http.FullNodeHttpApiService; + +/** + * Annotation for {@link FullNodeHttpApiService} servlet. + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface FullServlet { + + /** + * servlet pathSpec. + */ + String[] value(); +} diff --git a/framework/src/main/java/org/tron/core/services/annotation/PbftServlet.java b/framework/src/main/java/org/tron/core/services/annotation/PbftServlet.java new file mode 100644 index 00000000000..bccb5abc5cd --- /dev/null +++ b/framework/src/main/java/org/tron/core/services/annotation/PbftServlet.java @@ -0,0 +1,22 @@ +package org.tron.core.services.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.tron.core.services.interfaceOnPBFT.http.PBFT.HttpApiOnPBFTService; + +/** + * Annotation for {@link HttpApiOnPBFTService} servlet. + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface PbftServlet { + + /** + * servlet pathSpec. + */ + String[] value(); +} diff --git a/framework/src/main/java/org/tron/core/services/annotation/SolidityNodeServlet.java b/framework/src/main/java/org/tron/core/services/annotation/SolidityNodeServlet.java new file mode 100644 index 00000000000..591043b64ee --- /dev/null +++ b/framework/src/main/java/org/tron/core/services/annotation/SolidityNodeServlet.java @@ -0,0 +1,22 @@ +package org.tron.core.services.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.tron.core.services.http.solidity.SolidityNodeHttpApiService; + +/** + * Annotation for {@link SolidityNodeHttpApiService} servlet. + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface SolidityNodeServlet { + + /** + * servlet pathSpec. + */ + String[] value(); +} diff --git a/framework/src/main/java/org/tron/core/services/annotation/SolidityServlet.java b/framework/src/main/java/org/tron/core/services/annotation/SolidityServlet.java new file mode 100644 index 00000000000..3cddea81acb --- /dev/null +++ b/framework/src/main/java/org/tron/core/services/annotation/SolidityServlet.java @@ -0,0 +1,23 @@ +package org.tron.core.services.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.tron.core.services.interfaceOnSolidity.http.solidity.HttpApiOnSolidityService; + +/** + * Annotation for {@link HttpApiOnSolidityService} + * servlet. + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface SolidityServlet { + + /** + * servlet pathSpec. + */ + String[] value(); +} diff --git a/framework/src/main/java/org/tron/core/services/http/AccountPermissionUpdateServlet.java b/framework/src/main/java/org/tron/core/services/http/AccountPermissionUpdateServlet.java index c8ddd93f103..48cabc2f316 100644 --- a/framework/src/main/java/org/tron/core/services/http/AccountPermissionUpdateServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/AccountPermissionUpdateServlet.java @@ -7,11 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AccountContract.AccountPermissionUpdateContract; - +@FullServlet("/wallet/accountpermissionupdate") @Component @Slf4j(topic = "API") public class AccountPermissionUpdateServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/BroadcastHexServlet.java b/framework/src/main/java/org/tron/core/services/http/BroadcastHexServlet.java index ec115b20a15..f003f60fecc 100644 --- a/framework/src/main/java/org/tron/core/services/http/BroadcastHexServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/BroadcastHexServlet.java @@ -11,8 +11,10 @@ import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; import org.tron.core.capsule.TransactionCapsule; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; +@FullServlet("/wallet/broadcasthex") @Component @Slf4j(topic = "API") public class BroadcastHexServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/BroadcastServlet.java b/framework/src/main/java/org/tron/core/services/http/BroadcastServlet.java index 6b265c35e02..8abce1a528b 100644 --- a/framework/src/main/java/org/tron/core/services/http/BroadcastServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/BroadcastServlet.java @@ -10,9 +10,10 @@ import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; import org.tron.core.capsule.TransactionCapsule; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; - +@FullServlet("/wallet/broadcasttransaction") @Component @Slf4j(topic = "API") public class BroadcastServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CancelAllUnfreezeV2Servlet.java b/framework/src/main/java/org/tron/core/services/http/CancelAllUnfreezeV2Servlet.java index 894126e50da..57d65b5dc39 100644 --- a/framework/src/main/java/org/tron/core/services/http/CancelAllUnfreezeV2Servlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CancelAllUnfreezeV2Servlet.java @@ -8,10 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.CancelAllUnfreezeV2Contract; +@FullServlet("/wallet/cancelallunfreezev2") @Component @Slf4j(topic = "API") public class CancelAllUnfreezeV2Servlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ClearABIServlet.java b/framework/src/main/java/org/tron/core/services/http/ClearABIServlet.java index c897b895c58..e95d4bdfe65 100644 --- a/framework/src/main/java/org/tron/core/services/http/ClearABIServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ClearABIServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.ClearABIContract; +@FullServlet("/wallet/clearabi") @Component @Slf4j(topic = "API") public class ClearABIServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateAccountServlet.java index 102d9ca80ce..9b1dd7b234e 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateAccountServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AccountContract.AccountCreateContract; +@FullServlet("/wallet/createaccount") @Component @Slf4j(topic = "API") public class CreateAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateAssetIssueServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateAssetIssueServlet.java index 9d537ab641b..2cea9ff2f1a 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateAssetIssueServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateAssetIssueServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AssetIssueContractOuterClass.AssetIssueContract; +@FullServlet("/wallet/createassetissue") @Component @Slf4j(topic = "API") public class CreateAssetIssueServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateCommonTransactionServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateCommonTransactionServlet.java index c3a515f84a5..2ec2ba46a8d 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateCommonTransactionServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateCommonTransactionServlet.java @@ -13,10 +13,12 @@ import org.tron.core.Wallet; import org.tron.core.actuator.TransactionFactory; import org.tron.core.exception.ContractValidateException; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; +@FullServlet("/wallet/createCommonTransaction") @Component @Slf4j(topic = "API") public class CreateCommonTransactionServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersServlet.java index 2b5afbbd8e2..e55f15a3107 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersServlet.java @@ -9,7 +9,9 @@ import org.tron.api.GrpcAPI.PrivateShieldedTRC20Parameters; import org.tron.api.GrpcAPI.ShieldedTRC20Parameters; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/createshieldedcontractparameters") @Component @Slf4j(topic = "API") public class CreateShieldedContractParametersServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersWithoutAskServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersWithoutAskServlet.java index 80a8ba53bbc..bcd7431aef8 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersWithoutAskServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateShieldedContractParametersWithoutAskServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -9,7 +8,9 @@ import org.tron.api.GrpcAPI.PrivateShieldedTRC20ParametersWithoutAsk; import org.tron.api.GrpcAPI.ShieldedTRC20Parameters; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/createshieldedcontractparameterswithoutask") @Component @Slf4j(topic = "API") public class CreateShieldedContractParametersWithoutAskServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateSpendAuthSigServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateSpendAuthSigServlet.java index b2b57c9cb9d..c182246be9e 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateSpendAuthSigServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateSpendAuthSigServlet.java @@ -8,8 +8,10 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.api.GrpcAPI.SpendAuthSigParameters; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/createspendauthsig") @Component @Slf4j(topic = "API") public class CreateSpendAuthSigServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/CreateWitnessServlet.java b/framework/src/main/java/org/tron/core/services/http/CreateWitnessServlet.java index 55e1b25ce3d..eb6ff413c77 100644 --- a/framework/src/main/java/org/tron/core/services/http/CreateWitnessServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/CreateWitnessServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.WitnessContract.WitnessCreateContract; +@FullServlet("/wallet/createwitness") @Component @Slf4j(topic = "API") public class CreateWitnessServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/DelegateResourceServlet.java b/framework/src/main/java/org/tron/core/services/http/DelegateResourceServlet.java index 00994238988..014cbd2ed9e 100644 --- a/framework/src/main/java/org/tron/core/services/http/DelegateResourceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/DelegateResourceServlet.java @@ -8,10 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.DelegateResourceContract; +@FullServlet("/wallet/delegateresource") @Component @Slf4j(topic = "API") public class DelegateResourceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/DeployContractServlet.java b/framework/src/main/java/org/tron/core/services/http/DeployContractServlet.java index 1209c6fb385..0ce7739a112 100644 --- a/framework/src/main/java/org/tron/core/services/http/DeployContractServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/DeployContractServlet.java @@ -14,6 +14,7 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.CreateSmartContract; @@ -21,6 +22,7 @@ import org.tron.protos.contract.SmartContractOuterClass.SmartContract.ABI; +@FullServlet("/wallet/deploycontract") @Component @Slf4j(topic = "API") public class DeployContractServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/EstimateEnergyServlet.java b/framework/src/main/java/org/tron/core/services/http/EstimateEnergyServlet.java index d88f7dd1af1..782b72c0237 100644 --- a/framework/src/main/java/org/tron/core/services/http/EstimateEnergyServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/EstimateEnergyServlet.java @@ -17,9 +17,13 @@ import org.tron.core.Wallet; import org.tron.core.capsule.TransactionCapsule; import org.tron.core.exception.ContractValidateException; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol; import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract; +@FullServlet("/wallet/estimateenergy") +@SolidityNodeServlet("/walletsolidity/estimateenergy") @Component @Slf4j(topic = "API") public class EstimateEnergyServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ExchangeCreateServlet.java b/framework/src/main/java/org/tron/core/services/http/ExchangeCreateServlet.java index b7e2d7beb50..8cff0cfc3f2 100644 --- a/framework/src/main/java/org/tron/core/services/http/ExchangeCreateServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ExchangeCreateServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ExchangeContract.ExchangeCreateContract; +@FullServlet("/wallet/exchangecreate") @Component @Slf4j(topic = "API") public class ExchangeCreateServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ExchangeInjectServlet.java b/framework/src/main/java/org/tron/core/services/http/ExchangeInjectServlet.java index a6c8ebc2132..add78dd5130 100644 --- a/framework/src/main/java/org/tron/core/services/http/ExchangeInjectServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ExchangeInjectServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ExchangeContract.ExchangeInjectContract; +@FullServlet("/wallet/exchangeinject") @Component @Slf4j(topic = "API") public class ExchangeInjectServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ExchangeTransactionServlet.java b/framework/src/main/java/org/tron/core/services/http/ExchangeTransactionServlet.java index b788e6bba9f..42dde03d7ad 100644 --- a/framework/src/main/java/org/tron/core/services/http/ExchangeTransactionServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ExchangeTransactionServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ExchangeContract.ExchangeTransactionContract; +@FullServlet("/wallet/exchangetransaction") @Component @Slf4j(topic = "API") public class ExchangeTransactionServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ExchangeWithdrawServlet.java b/framework/src/main/java/org/tron/core/services/http/ExchangeWithdrawServlet.java index f454e08df9c..b701f9324d9 100644 --- a/framework/src/main/java/org/tron/core/services/http/ExchangeWithdrawServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ExchangeWithdrawServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ExchangeContract.ExchangeWithdrawContract; +@FullServlet("/wallet/exchangewithdraw") @Component @Slf4j(topic = "API") public class ExchangeWithdrawServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/FreezeBalanceServlet.java b/framework/src/main/java/org/tron/core/services/http/FreezeBalanceServlet.java index e73c294e023..813c16f3864 100644 --- a/framework/src/main/java/org/tron/core/services/http/FreezeBalanceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/FreezeBalanceServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.FreezeBalanceContract; +@FullServlet("/wallet/freezebalance") @Component @Slf4j(topic = "API") public class FreezeBalanceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/FreezeBalanceV2Servlet.java b/framework/src/main/java/org/tron/core/services/http/FreezeBalanceV2Servlet.java index f1687a5bbb1..8129f7fff04 100644 --- a/framework/src/main/java/org/tron/core/services/http/FreezeBalanceV2Servlet.java +++ b/framework/src/main/java/org/tron/core/services/http/FreezeBalanceV2Servlet.java @@ -7,10 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.FreezeBalanceV2Contract; +@FullServlet("/wallet/freezebalancev2") @Component @Slf4j(topic = "API") public class FreezeBalanceV2Servlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/FullNodeHttpApiService.java b/framework/src/main/java/org/tron/core/services/http/FullNodeHttpApiService.java index 76785218096..27b9a71fb86 100644 --- a/framework/src/main/java/org/tron/core/services/http/FullNodeHttpApiService.java +++ b/framework/src/main/java/org/tron/core/services/http/FullNodeHttpApiService.java @@ -1,17 +1,23 @@ package org.tron.core.services.http; +import java.util.Arrays; import java.util.EnumSet; import javax.servlet.DispatcherType; import javax.servlet.Filter; +import javax.servlet.Servlet; import lombok.extern.slf4j.Slf4j; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.StringUtil; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import org.tron.common.application.HttpService; import org.tron.core.config.args.Args; +import org.tron.core.services.annotation.FullServlet; import org.tron.core.services.filter.HttpApiAccessFilter; import org.tron.core.services.filter.HttpInterceptor; import org.tron.core.services.filter.LiteFnQueryHttpFilter; @@ -22,274 +28,11 @@ public class FullNodeHttpApiService extends HttpService { @Autowired - private GetAccountServlet getAccountServlet; - @Autowired - private TransferServlet transferServlet; - @Autowired - private BroadcastServlet broadcastServlet; - @Autowired - private UpdateAccountServlet updateAccountServlet; - @Autowired - private VoteWitnessAccountServlet voteWitnessAccountServlet; - @Autowired - private CreateAssetIssueServlet createAssetIssueServlet; - @Autowired - private UpdateWitnessServlet updateWitnessServlet; - @Autowired - private CreateAccountServlet createAccountServlet; - @Autowired - private CreateWitnessServlet createWitnessServlet; - @Autowired - private TransferAssetServlet transferAssetServlet; - @Autowired - private ParticipateAssetIssueServlet participateAssetIssueServlet; - @Autowired - private FreezeBalanceServlet freezeBalanceServlet; - @Autowired - private UnFreezeBalanceServlet unFreezeBalanceServlet; - @Autowired - private UnFreezeAssetServlet unFreezeAssetServlet; - @Autowired - private WithdrawBalanceServlet withdrawBalanceServlet; - @Autowired - private UpdateAssetServlet updateAssetServlet; - @Autowired - private ListNodesServlet listNodesServlet; - @Autowired - private GetAssetIssueByAccountServlet getAssetIssueByAccountServlet; - @Autowired - private GetAccountNetServlet getAccountNetServlet; - @Autowired - private GetAssetIssueByNameServlet getAssetIssueByNameServlet; - @Autowired - private GetAssetIssueListByNameServlet getAssetIssueListByNameServlet; - @Autowired - private GetAssetIssueByIdServlet getAssetIssueByIdServlet; - @Autowired - private GetNowBlockServlet getNowBlockServlet; - @Autowired - private GetBlockByNumServlet getBlockByNumServlet; - @Autowired - private GetBlockByIdServlet getBlockByIdServlet; - @Autowired - private GetBlockByLimitNextServlet getBlockByLimitNextServlet; - @Autowired - private GetBlockByLatestNumServlet getBlockByLatestNumServlet; - @Autowired - private GetTransactionByIdServlet getTransactionByIdServlet; - @Autowired - private GetTransactionInfoByIdServlet getTransactionInfoByIdServlet; - @Autowired - private GetTransactionReceiptByIdServlet getTransactionReceiptByIdServlet; - @Autowired - private GetTransactionCountByBlockNumServlet getTransactionCountByBlockNumServlet; - @Autowired - private ListWitnessesServlet listWitnessesServlet; - @Autowired - private GetAssetIssueListServlet getAssetIssueListServlet; - @Autowired - private GetPaginatedAssetIssueListServlet getPaginatedAssetIssueListServlet; - @Autowired - private GetPaginatedProposalListServlet getPaginatedProposalListServlet; - @Autowired - private GetPaginatedExchangeListServlet getPaginatedExchangeListServlet; - @Autowired - private TotalTransactionServlet totalTransactionServlet; - @Autowired - private GetNextMaintenanceTimeServlet getNextMaintenanceTimeServlet; - @Autowired - private ValidateAddressServlet validateAddressServlet; - @Autowired - private DeployContractServlet deployContractServlet; - @Autowired - private TriggerSmartContractServlet triggerSmartContractServlet; - @Autowired - private TriggerConstantContractServlet triggerConstantContractServlet; - @Autowired - private EstimateEnergyServlet estimateEnergyServlet; - @Autowired - private GetContractServlet getContractServlet; - @Autowired - private GetContractInfoServlet getContractInfoServlet; - @Autowired - private ClearABIServlet clearABIServlet; - @Autowired - private ProposalCreateServlet proposalCreateServlet; - @Autowired - private ProposalApproveServlet proposalApproveServlet; - @Autowired - private ProposalDeleteServlet proposalDeleteServlet; - @Autowired - private ListProposalsServlet listProposalsServlet; - @Autowired - private GetProposalByIdServlet getProposalByIdServlet; - @Autowired - private ExchangeCreateServlet exchangeCreateServlet; - @Autowired - private ExchangeInjectServlet exchangeInjectServlet; - @Autowired - private ExchangeTransactionServlet exchangeTransactionServlet; - @Autowired - private ExchangeWithdrawServlet exchangeWithdrawServlet; - @Autowired - private GetExchangeByIdServlet getExchangeByIdServlet; - @Autowired - private ListExchangesServlet listExchangesServlet; - @Autowired - private GetChainParametersServlet getChainParametersServlet; - @Autowired - private GetAccountResourceServlet getAccountResourceServlet; - @Autowired - private GetNodeInfoServlet getNodeInfoServlet; - @Autowired - private GetTransactionSignWeightServlet getTransactionSignWeightServlet; - @Autowired - private GetTransactionApprovedListServlet getTransactionApprovedListServlet; - @Autowired - private AccountPermissionUpdateServlet accountPermissionUpdateServlet; - @Autowired - private UpdateSettingServlet updateSettingServlet; - @Autowired - private UpdateEnergyLimitServlet updateEnergyLimitServlet; - @Autowired - private GetDelegatedResourceAccountIndexServlet getDelegatedResourceAccountIndexServlet; - @Autowired - private GetDelegatedResourceAccountIndexV2Servlet getDelegatedResourceAccountIndexV2Servlet; - @Autowired - private GetDelegatedResourceServlet getDelegatedResourceServlet; - @Autowired - private GetDelegatedResourceV2Servlet getDelegatedResourceV2Servlet; - @Autowired - private GetCanDelegatedMaxSizeServlet getCanDelegatedMaxSizeServlet; - @Autowired - private GetAvailableUnfreezeCountServlet getAvailableUnfreezeCountServlet; - @Autowired - private GetCanWithdrawUnfreezeAmountServlet getCanWithdrawUnfreezeAmountServlet; - @Autowired - private SetAccountIdServlet setAccountServlet; - @Autowired - private GetAccountByIdServlet getAccountByIdServlet; - @Autowired - private GetExpandedSpendingKeyServlet getExpandedSpendingKeyServlet; - @Autowired - private GetAkFromAskServlet getAkFromAskServlet; - @Autowired - private GetNkFromNskServlet getNkFromNskServlet; - @Autowired - private GetSpendingKeyServlet getSpendingKeyServlet; - @Autowired - private GetNewShieldedAddressServlet getNewShieldedAddressServlet; - @Autowired - private GetDiversifierServlet getDiversifierServlet; - @Autowired - private GetIncomingViewingKeyServlet getIncomingViewingKeyServlet; - @Autowired - private GetZenPaymentAddressServlet getZenPaymentAddressServlet; - @Autowired - private CreateShieldedTransactionServlet createShieldedTransactionServlet; - @Autowired - private ScanNoteByIvkServlet scanNoteByIvkServlet; - @Autowired - private ScanAndMarkNoteByIvkServlet scanAndMarkNoteByIvkServlet; - @Autowired - private ScanNoteByOvkServlet scanNoteByOvkServlet; - @Autowired - private GetRcmServlet getRcmServlet; - @Autowired - private CreateSpendAuthSigServlet createSpendAuthSigServlet; - @Autowired - private CreateShieldNullifierServlet createShieldNullifierServlet; - @Autowired - private GetShieldTransactionHashServlet getShieldTransactionHashServlet; - @Autowired - private GetMerkleTreeVoucherInfoServlet getMerkleTreeVoucherInfoServlet; - @Autowired - private IsSpendServlet isSpendServlet; - @Autowired - private CreateShieldedTransactionWithoutSpendAuthSigServlet - createShieldedTransactionWithoutSpendAuthSigServlet; - @Autowired - private BroadcastHexServlet broadcastHexServlet; - @Autowired - private GetBurnTrxServlet getBurnTrxServlet; - @Autowired - private GetBrokerageServlet getBrokerageServlet; - @Autowired - private GetRewardServlet getRewardServlet; - @Autowired - private UpdateBrokerageServlet updateBrokerageServlet; - @Autowired - private CreateCommonTransactionServlet createCommonTransactionServlet; - @Autowired - private GetTransactionInfoByBlockNumServlet getTransactionInfoByBlockNumServlet; - @Autowired - private IsShieldedTRC20ContractNoteSpentServlet isShieldedTRC20ContractNoteSpentServlet; - @Autowired - private CreateShieldedContractParametersServlet createShieldedContractParametersServlet; - @Autowired - private CreateShieldedContractParametersWithoutAskServlet - createShieldedContractParametersWithoutAskServlet; - @Autowired - private ScanShieldedTRC20NotesByIvkServlet scanShieldedTRC20NotesByIvkServlet; - @Autowired - private ScanShieldedTRC20NotesByOvkServlet scanShieldedTRC20NotesByOvkServlet; - @Autowired - private GetTriggerInputForShieldedTRC20ContractServlet - getTriggerInputForShieldedTRC20ContractServlet; - @Autowired - private MetricsServlet metricsServlet; - @Autowired - private MarketSellAssetServlet marketSellAssetServlet; - @Autowired - private MarketCancelOrderServlet marketCancelOrderServlet; - @Autowired - private GetMarketOrderByAccountServlet getMarketOrderByAccountServlet; - @Autowired - private GetMarketOrderByIdServlet getMarketOrderByIdServlet; - @Autowired - private GetMarketPriceByPairServlet getMarketPriceByPairServlet; - @Autowired - private GetMarketOrderListByPairServlet getMarketOrderListByPairServlet; - @Autowired - private GetMarketPairListServlet getMarketPairListServlet; - - @Autowired - private GetAccountBalanceServlet getAccountBalanceServlet; - - @Autowired - private GetBlockBalanceServlet getBlockBalanceServlet; - + private ApplicationContext applicationContext; @Autowired private LiteFnQueryHttpFilter liteFnQueryHttpFilter; @Autowired private HttpApiAccessFilter httpApiAccessFilter; - @Autowired - private GetTransactionFromPendingServlet getTransactionFromPendingServlet; - @Autowired - private GetTransactionListFromPendingServlet getTransactionListFromPendingServlet; - @Autowired - private GetPendingSizeServlet getPendingSizeServlet; - @Autowired - private GetEnergyPricesServlet getEnergyPricesServlet; - @Autowired - private GetBandwidthPricesServlet getBandwidthPricesServlet; - @Autowired - private GetBlockServlet getBlockServlet; - @Autowired - private GetMemoFeePricesServlet getMemoFeePricesServlet; - - @Autowired - private FreezeBalanceV2Servlet freezeBalanceV2Servlet; - @Autowired - private UnFreezeBalanceV2Servlet unFreezeBalanceV2Servlet; - @Autowired - private WithdrawExpireUnfreezeServlet withdrawExpireUnfreezeServlet; - @Autowired - private DelegateResourceServlet delegateResourceServlet; - @Autowired - private UnDelegateResourceServlet unDelegateResourceServlet; - @Autowired - private CancelAllUnfreezeV2Servlet cancelAllUnfreezeV2Servlet; public FullNodeHttpApiService() { port = Args.getInstance().getFullNodeHttpPort(); @@ -299,215 +42,15 @@ public FullNodeHttpApiService() { @Override protected void addServlet(ServletContextHandler context) { - context.addServlet(new ServletHolder(getAccountServlet), "/wallet/getaccount"); - context.addServlet(new ServletHolder(transferServlet), "/wallet/createtransaction"); - context.addServlet(new ServletHolder(broadcastServlet), "/wallet/broadcasttransaction"); - context.addServlet(new ServletHolder(updateAccountServlet), "/wallet/updateaccount"); - context.addServlet(new ServletHolder(voteWitnessAccountServlet), - "/wallet/votewitnessaccount"); - context.addServlet(new ServletHolder(createAssetIssueServlet), "/wallet/createassetissue"); - context.addServlet(new ServletHolder(updateWitnessServlet), "/wallet/updatewitness"); - context.addServlet(new ServletHolder(createAccountServlet), "/wallet/createaccount"); - context.addServlet(new ServletHolder(createWitnessServlet), "/wallet/createwitness"); - context.addServlet(new ServletHolder(transferAssetServlet), "/wallet/transferasset"); - context.addServlet(new ServletHolder(participateAssetIssueServlet), - "/wallet/participateassetissue"); - context.addServlet(new ServletHolder(freezeBalanceServlet), "/wallet/freezebalance"); - context.addServlet(new ServletHolder(unFreezeBalanceServlet), "/wallet/unfreezebalance"); - context.addServlet(new ServletHolder(unFreezeAssetServlet), "/wallet/unfreezeasset"); - context.addServlet(new ServletHolder(withdrawBalanceServlet), "/wallet/withdrawbalance"); - context.addServlet(new ServletHolder(updateAssetServlet), "/wallet/updateasset"); - context.addServlet(new ServletHolder(listNodesServlet), "/wallet/listnodes"); - context.addServlet( - new ServletHolder(getAssetIssueByAccountServlet), "/wallet/getassetissuebyaccount"); - context.addServlet(new ServletHolder(getAccountNetServlet), "/wallet/getaccountnet"); - context.addServlet(new ServletHolder(getAssetIssueByNameServlet), - "/wallet/getassetissuebyname"); - context.addServlet(new ServletHolder(getAssetIssueListByNameServlet), - "/wallet/getassetissuelistbyname"); - context.addServlet(new ServletHolder(getAssetIssueByIdServlet), "/wallet/getassetissuebyid"); - context.addServlet(new ServletHolder(getNowBlockServlet), "/wallet/getnowblock"); - context.addServlet(new ServletHolder(getBlockByNumServlet), "/wallet/getblockbynum"); - context.addServlet(new ServletHolder(getBlockByIdServlet), "/wallet/getblockbyid"); - context.addServlet(new ServletHolder(getBlockByLimitNextServlet), - "/wallet/getblockbylimitnext"); - context.addServlet(new ServletHolder(getBlockByLatestNumServlet), - "/wallet/getblockbylatestnum"); - context.addServlet(new ServletHolder(getTransactionByIdServlet), - "/wallet/gettransactionbyid"); - context.addServlet( - new ServletHolder(getTransactionInfoByIdServlet), "/wallet/gettransactioninfobyid"); - context.addServlet( - new ServletHolder(getTransactionReceiptByIdServlet), "/wallet/gettransactionreceiptbyid"); - context.addServlet( - new ServletHolder(getTransactionCountByBlockNumServlet), - "/wallet/gettransactioncountbyblocknum"); - context.addServlet(new ServletHolder(listWitnessesServlet), "/wallet/listwitnesses"); - context.addServlet(new ServletHolder(getAssetIssueListServlet), "/wallet/getassetissuelist"); - context.addServlet( - new ServletHolder(getPaginatedAssetIssueListServlet), - "/wallet/getpaginatedassetissuelist"); - context.addServlet( - new ServletHolder(getPaginatedProposalListServlet), "/wallet/getpaginatedproposallist"); - context.addServlet( - new ServletHolder(getPaginatedExchangeListServlet), "/wallet/getpaginatedexchangelist"); - context.addServlet(new ServletHolder(totalTransactionServlet), "/wallet/totaltransaction"); - context.addServlet( - new ServletHolder(getNextMaintenanceTimeServlet), "/wallet/getnextmaintenancetime"); - context.addServlet(new ServletHolder(validateAddressServlet), "/wallet/validateaddress"); - context.addServlet(new ServletHolder(deployContractServlet), "/wallet/deploycontract"); - context.addServlet(new ServletHolder(triggerSmartContractServlet), - "/wallet/triggersmartcontract"); - context.addServlet(new ServletHolder(triggerConstantContractServlet), - "/wallet/triggerconstantcontract"); - context.addServlet(new ServletHolder(estimateEnergyServlet), "/wallet/estimateenergy"); - context.addServlet(new ServletHolder(getContractServlet), "/wallet/getcontract"); - context.addServlet(new ServletHolder(getContractInfoServlet), "/wallet/getcontractinfo"); - context.addServlet(new ServletHolder(clearABIServlet), "/wallet/clearabi"); - context.addServlet(new ServletHolder(proposalCreateServlet), "/wallet/proposalcreate"); - context.addServlet(new ServletHolder(proposalApproveServlet), "/wallet/proposalapprove"); - context.addServlet(new ServletHolder(proposalDeleteServlet), "/wallet/proposaldelete"); - context.addServlet(new ServletHolder(listProposalsServlet), "/wallet/listproposals"); - context.addServlet(new ServletHolder(getProposalByIdServlet), "/wallet/getproposalbyid"); - context.addServlet(new ServletHolder(exchangeCreateServlet), "/wallet/exchangecreate"); - context.addServlet(new ServletHolder(exchangeInjectServlet), "/wallet/exchangeinject"); - context.addServlet(new ServletHolder(exchangeTransactionServlet), - "/wallet/exchangetransaction"); - context.addServlet(new ServletHolder(exchangeWithdrawServlet), "/wallet/exchangewithdraw"); - context.addServlet(new ServletHolder(getExchangeByIdServlet), "/wallet/getexchangebyid"); - context.addServlet(new ServletHolder(listExchangesServlet), "/wallet/listexchanges"); - context.addServlet(new ServletHolder(getChainParametersServlet), - "/wallet/getchainparameters"); - context.addServlet(new ServletHolder(getAccountResourceServlet), - "/wallet/getaccountresource"); - context.addServlet(new ServletHolder(getTransactionSignWeightServlet), - "/wallet/getsignweight"); - context.addServlet(new ServletHolder(getTransactionApprovedListServlet), - "/wallet/getapprovedlist"); - context.addServlet(new ServletHolder(accountPermissionUpdateServlet), - "/wallet/accountpermissionupdate"); - context.addServlet(new ServletHolder(getNodeInfoServlet), "/wallet/getnodeinfo"); - context.addServlet(new ServletHolder(updateSettingServlet), "/wallet/updatesetting"); - context.addServlet(new ServletHolder(updateEnergyLimitServlet), "/wallet/updateenergylimit"); - context.addServlet(new ServletHolder(getDelegatedResourceServlet), - "/wallet/getdelegatedresource"); - context.addServlet(new ServletHolder(getDelegatedResourceV2Servlet), - "/wallet/getdelegatedresourcev2"); - context.addServlet(new ServletHolder(getCanDelegatedMaxSizeServlet), - "/wallet/getcandelegatedmaxsize"); - context.addServlet(new ServletHolder(getAvailableUnfreezeCountServlet), - "/wallet/getavailableunfreezecount"); - context.addServlet(new ServletHolder(getCanWithdrawUnfreezeAmountServlet), - "/wallet/getcanwithdrawunfreezeamount"); - context.addServlet( - new ServletHolder(getDelegatedResourceAccountIndexServlet), - "/wallet/getdelegatedresourceaccountindex"); - context.addServlet( - new ServletHolder(getDelegatedResourceAccountIndexV2Servlet), - "/wallet/getdelegatedresourceaccountindexv2"); - context.addServlet(new ServletHolder(setAccountServlet), "/wallet/setaccountid"); - context.addServlet(new ServletHolder(getAccountByIdServlet), "/wallet/getaccountbyid"); - context - .addServlet(new ServletHolder(getExpandedSpendingKeyServlet), - "/wallet/getexpandedspendingkey"); - context.addServlet(new ServletHolder(getAkFromAskServlet), "/wallet/getakfromask"); - context.addServlet(new ServletHolder(getNkFromNskServlet), "/wallet/getnkfromnsk"); - context.addServlet(new ServletHolder(getSpendingKeyServlet), "/wallet/getspendingkey"); - context - .addServlet(new ServletHolder(getNewShieldedAddressServlet), - "/wallet/getnewshieldedaddress"); - context.addServlet(new ServletHolder(getDiversifierServlet), "/wallet/getdiversifier"); - context.addServlet(new ServletHolder(getIncomingViewingKeyServlet), - "/wallet/getincomingviewingkey"); - context.addServlet(new ServletHolder(getZenPaymentAddressServlet), - "/wallet/getzenpaymentaddress"); - // context.addServlet(new ServletHolder(createShieldedTransactionServlet), - // "/wallet/createshieldedtransaction"); - // context.addServlet(new ServletHolder(createShieldedTransactionWithoutSpendAuthSigServlet), - // "/wallet/createshieldedtransactionwithoutspendauthsig"); - // context.addServlet(new ServletHolder(scanNoteByIvkServlet), "/wallet/scannotebyivk"); - // context.addServlet(new ServletHolder(scanAndMarkNoteByIvkServlet), - // "/wallet/scanandmarknotebyivk"); - // context.addServlet(new ServletHolder(scanNoteByOvkServlet), "/wallet/scannotebyovk"); - context.addServlet(new ServletHolder(getRcmServlet), "/wallet/getrcm"); - // context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoServlet), - // "/wallet/getmerkletreevoucherinfo"); - // context.addServlet(new ServletHolder(isSpendServlet), "/wallet/isspend"); - context.addServlet(new ServletHolder(createSpendAuthSigServlet), - "/wallet/createspendauthsig"); - // context.addServlet(new ServletHolder(createShieldNullifierServlet), - // "/wallet/createshieldnullifier"); - // context.addServlet(new ServletHolder(getShieldTransactionHashServlet), - // "/wallet/getshieldtransactionhash"); - - context - .addServlet(new ServletHolder(isShieldedTRC20ContractNoteSpentServlet), - "/wallet/isshieldedtrc20contractnotespent"); - context.addServlet(new ServletHolder(createShieldedContractParametersServlet), - "/wallet/createshieldedcontractparameters"); - context.addServlet(new ServletHolder(createShieldedContractParametersWithoutAskServlet), - "/wallet/createshieldedcontractparameterswithoutask"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByIvkServlet), - "/wallet/scanshieldedtrc20notesbyivk"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByOvkServlet), - "/wallet/scanshieldedtrc20notesbyovk"); - context.addServlet(new ServletHolder(getTriggerInputForShieldedTRC20ContractServlet), - "/wallet/gettriggerinputforshieldedtrc20contract"); - - context.addServlet(new ServletHolder(broadcastHexServlet), "/wallet/broadcasthex"); - context.addServlet(new ServletHolder(getBrokerageServlet), "/wallet/getBrokerage"); - context.addServlet(new ServletHolder(getRewardServlet), "/wallet/getReward"); - context.addServlet(new ServletHolder(updateBrokerageServlet), "/wallet/updateBrokerage"); - context.addServlet(new ServletHolder(createCommonTransactionServlet), - "/wallet/createCommonTransaction"); - context.addServlet(new ServletHolder(getTransactionInfoByBlockNumServlet), - "/wallet/gettransactioninfobyblocknum"); - context.addServlet(new ServletHolder(listNodesServlet), "/net/listnodes"); - - context.addServlet(new ServletHolder(metricsServlet), "/monitor/getstatsinfo"); - context.addServlet(new ServletHolder(getNodeInfoServlet), "/monitor/getnodeinfo"); - context.addServlet(new ServletHolder(marketSellAssetServlet), "/wallet/marketsellasset"); - context.addServlet(new ServletHolder(marketCancelOrderServlet), "/wallet/marketcancelorder"); - context.addServlet(new ServletHolder(getMarketOrderByAccountServlet), - "/wallet/getmarketorderbyaccount"); - context.addServlet(new ServletHolder(getMarketOrderByIdServlet), - "/wallet/getmarketorderbyid"); - context.addServlet(new ServletHolder(getMarketPriceByPairServlet), - "/wallet/getmarketpricebypair"); - context.addServlet(new ServletHolder(getMarketOrderListByPairServlet), - "/wallet/getmarketorderlistbypair"); - context.addServlet(new ServletHolder(getMarketPairListServlet), - "/wallet/getmarketpairlist"); - - context.addServlet(new ServletHolder(getAccountBalanceServlet), - "/wallet/getaccountbalance"); - context.addServlet(new ServletHolder(getBlockBalanceServlet), - "/wallet/getblockbalance"); - context.addServlet(new ServletHolder(getBurnTrxServlet), "/wallet/getburntrx"); - context.addServlet(new ServletHolder(getTransactionFromPendingServlet), - "/wallet/gettransactionfrompending"); - context.addServlet(new ServletHolder(getTransactionListFromPendingServlet), - "/wallet/gettransactionlistfrompending"); - context.addServlet(new ServletHolder(getPendingSizeServlet), "/wallet/getpendingsize"); - context.addServlet(new ServletHolder(getEnergyPricesServlet), "/wallet/getenergyprices"); - context.addServlet(new ServletHolder(getBandwidthPricesServlet), - "/wallet/getbandwidthprices"); - context.addServlet(new ServletHolder(getBlockServlet), "/wallet/getblock"); - context.addServlet(new ServletHolder(getMemoFeePricesServlet), "/wallet/getmemofee"); - - context.addServlet(new ServletHolder(freezeBalanceV2Servlet), - "/wallet/freezebalancev2"); - context.addServlet(new ServletHolder(unFreezeBalanceV2Servlet), - "/wallet/unfreezebalancev2"); - context.addServlet(new ServletHolder(withdrawExpireUnfreezeServlet), - "/wallet/withdrawexpireunfreeze"); - context.addServlet(new ServletHolder(delegateResourceServlet), - "/wallet/delegateresource"); - context.addServlet(new ServletHolder(unDelegateResourceServlet), - "/wallet/undelegateresource"); - context.addServlet(new ServletHolder(cancelAllUnfreezeV2Servlet), - "/wallet/cancelallunfreezev2"); - + applicationContext.getBeansWithAnnotation(FullServlet.class).values() + .stream().filter(o -> o instanceof Servlet) + .map(o -> (Servlet) o) + .filter(o -> AopUtils.getTargetClass(o).isAnnotationPresent(FullServlet.class)) + .forEach(o -> { + FullServlet path = AopUtils.getTargetClass(o).getAnnotation(FullServlet.class); + Arrays.stream(path.value()).filter(StringUtil::isNotBlank).forEach(p -> + context.addServlet(new ServletHolder(o), p)); + }); } @Override diff --git a/framework/src/main/java/org/tron/core/services/http/GetAccountBalanceServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAccountBalanceServlet.java index 159c3899666..9bef9b0906d 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAccountBalanceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAccountBalanceServlet.java @@ -1,16 +1,16 @@ package org.tron.core.services.http; -import com.alibaba.fastjson.JSONObject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; -import org.tron.protos.Protocol.Account; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.contract.BalanceContract; +@FullServlet("/wallet/getaccountbalance") @Component @Slf4j(topic = "API") public class GetAccountBalanceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAccountByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAccountByIdServlet.java index 7387b801168..e5417927dd7 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAccountByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAccountByIdServlet.java @@ -8,9 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Account; +@FullServlet("/wallet/getaccountbyid") +@SolidityNodeServlet("/walletsolidity/getaccountbyid") @Component @Slf4j(topic = "API") public class GetAccountByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAccountNetServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAccountNetServlet.java index 121a23c61ab..b4e6386fdcd 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAccountNetServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAccountNetServlet.java @@ -9,9 +9,11 @@ import org.tron.api.GrpcAPI.AccountNetMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Account; +@FullServlet("/wallet/getaccountnet") @Component @Slf4j(topic = "API") public class GetAccountNetServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAccountResourceServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAccountResourceServlet.java index 98224334e1a..64ed45cc2f9 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAccountResourceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAccountResourceServlet.java @@ -10,7 +10,9 @@ import org.tron.api.GrpcAPI.AccountResourceMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getaccountresource") @Component @Slf4j(topic = "API") public class GetAccountResourceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAccountServlet.java index 7de95dab541..492c0283f95 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAccountServlet.java @@ -7,9 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Account; +@FullServlet("/wallet/getaccount") +@SolidityNodeServlet("/walletsolidity/getaccount") @Component @Slf4j(topic = "API") public class GetAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAkFromAskServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAkFromAskServlet.java index c31692413a9..92763ad0206 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAkFromAskServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAkFromAskServlet.java @@ -9,7 +9,9 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getakfromask") @Component @Slf4j(topic = "API") public class GetAkFromAskServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByAccountServlet.java index e9e85af2e81..f85177a1343 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByAccountServlet.java @@ -9,9 +9,11 @@ import org.tron.api.GrpcAPI.AssetIssueList; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Account; +@FullServlet("/wallet/getassetissuebyaccount") @Component @Slf4j(topic = "API") public class GetAssetIssueByAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByIdServlet.java index 08f8227deee..b907c4427d6 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByIdServlet.java @@ -7,9 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.contract.AssetIssueContractOuterClass.AssetIssueContract; +@FullServlet("/wallet/getassetissuebyid") +@SolidityNodeServlet("/walletsolidity/getassetissuebyid") @Component @Slf4j(topic = "API") public class GetAssetIssueByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByNameServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByNameServlet.java index a1cc0525514..473c65806fe 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByNameServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueByNameServlet.java @@ -10,9 +10,13 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.contract.AssetIssueContractOuterClass.AssetIssueContract; +@FullServlet("/wallet/getassetissuebyname") +@SolidityNodeServlet("/walletsolidity/getassetissuebyname") @Component @Slf4j(topic = "API") public class GetAssetIssueByNameServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListByNameServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListByNameServlet.java index d9b7426011d..8e38c25a630 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListByNameServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListByNameServlet.java @@ -12,8 +12,12 @@ import org.tron.api.GrpcAPI.AssetIssueList; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getassetissuelistbyname") +@SolidityNodeServlet("/walletsolidity/getassetissuelistbyname") @Component @Slf4j(topic = "API") public class GetAssetIssueListByNameServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListServlet.java index 3968554a671..024a7fdb5c5 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAssetIssueListServlet.java @@ -7,7 +7,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.AssetIssueList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getassetissuelist") +@SolidityNodeServlet("/walletsolidity/getassetissuelist") @Component @Slf4j(topic = "API") public class GetAssetIssueListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetAvailableUnfreezeCountServlet.java b/framework/src/main/java/org/tron/core/services/http/GetAvailableUnfreezeCountServlet.java index 51f78fc4390..f6a85302c79 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetAvailableUnfreezeCountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetAvailableUnfreezeCountServlet.java @@ -10,7 +10,11 @@ import org.tron.api.GrpcAPI; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getavailableunfreezecount") +@SolidityNodeServlet("/walletsolidity/getavailableunfreezecount") @Component @Slf4j(topic = "API") public class GetAvailableUnfreezeCountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBandwidthPricesServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBandwidthPricesServlet.java index 09d51cc8635..480c8909ae1 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBandwidthPricesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBandwidthPricesServlet.java @@ -7,7 +7,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.PricesResponseMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getbandwidthprices") +@SolidityNodeServlet("/walletsolidity/getbandwidthprices") @Component @Slf4j(topic = "API") public class GetBandwidthPricesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockBalanceServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockBalanceServlet.java index 0fc3256899c..09462696177 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockBalanceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockBalanceServlet.java @@ -1,16 +1,16 @@ package org.tron.core.services.http; -import com.alibaba.fastjson.JSONObject; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; -import org.tron.protos.Protocol.Account; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.contract.BalanceContract.BlockBalanceTrace; +@FullServlet("/wallet/getblockbalance") @Component @Slf4j(topic = "API") public class GetBlockBalanceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockByIdServlet.java index f7e6ac0ff7d..71fd7f03486 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockByIdServlet.java @@ -10,9 +10,13 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Block; +@FullServlet("/wallet/getblockbyid") +@SolidityNodeServlet("/walletsolidity/getblockbyid") @Component @Slf4j(topic = "API") public class GetBlockByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockByLatestNumServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockByLatestNumServlet.java index 1f2eabdd8dc..078080948c3 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockByLatestNumServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockByLatestNumServlet.java @@ -9,8 +9,12 @@ import org.tron.api.GrpcAPI.BlockList; import org.tron.api.GrpcAPI.NumberMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getblockbylatestnum") +@SolidityNodeServlet("/walletsolidity/getblockbylatestnum") @Component @Slf4j(topic = "API") public class GetBlockByLatestNumServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockByLimitNextServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockByLimitNextServlet.java index 3e6700a1fae..4b43f49f391 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockByLimitNextServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockByLimitNextServlet.java @@ -9,8 +9,12 @@ import org.tron.api.GrpcAPI.BlockLimit; import org.tron.api.GrpcAPI.BlockList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getblockbylimitnext") +@SolidityNodeServlet("/walletsolidity/getblockbylimitnext") @Component @Slf4j(topic = "API") public class GetBlockByLimitNextServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockByNumServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockByNumServlet.java index 800b421ace0..708a0af28d5 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockByNumServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockByNumServlet.java @@ -8,9 +8,13 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.NumberMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Block; +@FullServlet("/wallet/getblockbynum") +@SolidityNodeServlet("/walletsolidity/getblockbynum") @Component @Slf4j(topic = "API") public class GetBlockByNumServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBlockServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBlockServlet.java index 0e0104e8014..9319e76234e 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBlockServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBlockServlet.java @@ -12,9 +12,13 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.BlockReq; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Block; +@FullServlet("/wallet/getblock") +@SolidityNodeServlet("/walletsolidity/getblock") @Component @Slf4j(topic = "API") public class GetBlockServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBrokerageServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBrokerageServlet.java index 1fbd94fe690..801fdccd1cd 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBrokerageServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBrokerageServlet.java @@ -8,8 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getBrokerage") +@SolidityNodeServlet("/walletsolidity/getBrokerage") @Component @Slf4j(topic = "API") public class GetBrokerageServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetBurnTrxServlet.java b/framework/src/main/java/org/tron/core/services/http/GetBurnTrxServlet.java index e574affff6b..8a4097a2704 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetBurnTrxServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetBurnTrxServlet.java @@ -7,8 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getburntrx") +@SolidityNodeServlet("/walletsolidity/getburntrx") @Component @Slf4j(topic = "API") public class GetBurnTrxServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetCanDelegatedMaxSizeServlet.java b/framework/src/main/java/org/tron/core/services/http/GetCanDelegatedMaxSizeServlet.java index 924306a6a3f..999975f8f28 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetCanDelegatedMaxSizeServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetCanDelegatedMaxSizeServlet.java @@ -10,7 +10,11 @@ import org.tron.api.GrpcAPI; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getcandelegatedmaxsize") +@SolidityNodeServlet("/walletsolidity/getcandelegatedmaxsize") @Component @Slf4j(topic = "API") public class GetCanDelegatedMaxSizeServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetCanWithdrawUnfreezeAmountServlet.java b/framework/src/main/java/org/tron/core/services/http/GetCanWithdrawUnfreezeAmountServlet.java index 435cca9e5fb..1288ac6c380 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetCanWithdrawUnfreezeAmountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetCanWithdrawUnfreezeAmountServlet.java @@ -10,7 +10,11 @@ import org.tron.api.GrpcAPI; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getcanwithdrawunfreezeamount") +@SolidityNodeServlet("/walletsolidity/getcanwithdrawunfreezeamount") @Component @Slf4j(topic = "API") public class GetCanWithdrawUnfreezeAmountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetChainParametersServlet.java b/framework/src/main/java/org/tron/core/services/http/GetChainParametersServlet.java index 18c96f4d64e..fd9e3b849b6 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetChainParametersServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetChainParametersServlet.java @@ -6,8 +6,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getchainparameters") @Component @Slf4j(topic = "API") public class GetChainParametersServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetContractInfoServlet.java b/framework/src/main/java/org/tron/core/services/http/GetContractInfoServlet.java index 86ed7f6d9b6..ee4875be6f2 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetContractInfoServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetContractInfoServlet.java @@ -1,7 +1,6 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -9,10 +8,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.BytesMessage; import org.tron.core.Wallet; -import org.tron.protos.contract.SmartContractOuterClass.SmartContract; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.contract.SmartContractOuterClass.SmartContractDataWrapper; +@FullServlet("/wallet/getcontractinfo") @Component @Slf4j(topic = "API") public class GetContractInfoServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetContractServlet.java b/framework/src/main/java/org/tron/core/services/http/GetContractServlet.java index b9efd6c1520..ff0c9aacfe4 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetContractServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetContractServlet.java @@ -10,9 +10,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.BytesMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.contract.SmartContractOuterClass.SmartContract; +@FullServlet("/wallet/getcontract") @Component @Slf4j(topic = "API") public class GetContractServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexServlet.java b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexServlet.java index 035e20cb873..e8f84839b94 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexServlet.java @@ -11,9 +11,13 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.DelegatedResourceAccountIndex; +@FullServlet("/wallet/getdelegatedresourceaccountindex") +@SolidityNodeServlet("/walletsolidity/getdelegatedresourceaccountindex") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexV2Servlet.java b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexV2Servlet.java index 3d5bff80941..592e26286e7 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexV2Servlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceAccountIndexV2Servlet.java @@ -11,9 +11,13 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.DelegatedResourceAccountIndex; +@FullServlet("/wallet/getdelegatedresourceaccountindexv2") +@SolidityNodeServlet("/walletsolidity/getdelegatedresourceaccountindexv2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexV2Servlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceServlet.java b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceServlet.java index 5787aba3c93..bc2e33f6006 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceServlet.java @@ -2,7 +2,6 @@ import com.google.protobuf.ByteString; import java.io.IOException; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -12,8 +11,12 @@ import org.tron.api.GrpcAPI.DelegatedResourceMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getdelegatedresource") +@SolidityNodeServlet("/walletsolidity/getdelegatedresource") @Component @Slf4j(topic = "API") public class GetDelegatedResourceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceV2Servlet.java b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceV2Servlet.java index 632bb4f8033..1b5cc5181d4 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceV2Servlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetDelegatedResourceV2Servlet.java @@ -2,7 +2,6 @@ import com.google.protobuf.ByteString; import java.io.IOException; - import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -12,9 +11,12 @@ import org.tron.api.GrpcAPI.DelegatedResourceMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; - +@FullServlet("/wallet/getdelegatedresourcev2") +@SolidityNodeServlet("/walletsolidity/getdelegatedresourcev2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceV2Servlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetDiversifierServlet.java b/framework/src/main/java/org/tron/core/services/http/GetDiversifierServlet.java index e37a1d6a785..2b1ee1ceaba 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetDiversifierServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetDiversifierServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -8,8 +7,10 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getdiversifier") @Component @Slf4j(topic = "API") public class GetDiversifierServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetEnergyPricesServlet.java b/framework/src/main/java/org/tron/core/services/http/GetEnergyPricesServlet.java index b9b6ba0d893..caea1b75d1f 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetEnergyPricesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetEnergyPricesServlet.java @@ -7,7 +7,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.PricesResponseMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getenergyprices") +@SolidityNodeServlet("/walletsolidity/getenergyprices") @Component @Slf4j(topic = "API") public class GetEnergyPricesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetExchangeByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetExchangeByIdServlet.java index 7a84c0ea8a4..327a44945c9 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetExchangeByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetExchangeByIdServlet.java @@ -3,7 +3,6 @@ import com.alibaba.fastjson.JSONObject; import com.google.protobuf.ByteString; import java.io.IOException; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -11,8 +10,12 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getexchangebyid") +@SolidityNodeServlet("/walletsolidity/getexchangebyid") @Component @Slf4j(topic = "API") public class GetExchangeByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetExpandedSpendingKeyServlet.java b/framework/src/main/java/org/tron/core/services/http/GetExpandedSpendingKeyServlet.java index a71f5db56e1..80c3b2bf47d 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetExpandedSpendingKeyServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetExpandedSpendingKeyServlet.java @@ -1,7 +1,6 @@ package org.tron.core.services.http; import com.google.protobuf.ByteString; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -11,7 +10,9 @@ import org.tron.api.GrpcAPI.ExpandedSpendingKeyMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getexpandedspendingkey") @Component @Slf4j(topic = "API") public class GetExpandedSpendingKeyServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetIncomingViewingKeyServlet.java b/framework/src/main/java/org/tron/core/services/http/GetIncomingViewingKeyServlet.java index b572cf348e5..2b7435c2278 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetIncomingViewingKeyServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetIncomingViewingKeyServlet.java @@ -9,8 +9,10 @@ import org.tron.api.GrpcAPI; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getincomingviewingkey") @Component @Slf4j(topic = "API") public class GetIncomingViewingKeyServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByAccountServlet.java index 1c3190b62ea..47e0825a580 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByAccountServlet.java @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; import com.google.protobuf.ByteString; import java.io.IOException; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -12,9 +11,13 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.MarketOrderList; +@FullServlet("/wallet/getmarketorderbyaccount") +@SolidityNodeServlet("/walletsolidity/getmarketorderbyaccount") @Component @Slf4j(topic = "API") public class GetMarketOrderByAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByIdServlet.java index bdb8a4b6d3c..a216d41b749 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderByIdServlet.java @@ -10,9 +10,13 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.MarketOrder; +@FullServlet("/wallet/getmarketorderbyid") +@SolidityNodeServlet("/walletsolidity/getmarketorderbyid") @Component @Slf4j(topic = "API") public class GetMarketOrderByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderListByPairServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderListByPairServlet.java index 963ea880033..2c4b05698f3 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMarketOrderListByPairServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMarketOrderListByPairServlet.java @@ -8,10 +8,14 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.MarketOrderList; import org.tron.protos.Protocol.MarketOrderPair; +@FullServlet("/wallet/getmarketorderlistbypair") +@SolidityNodeServlet("/walletsolidity/getmarketorderlistbypair") @Component @Slf4j(topic = "API") public class GetMarketOrderListByPairServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMarketPairListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMarketPairListServlet.java index 6cb9c5d868f..d416ad88ca0 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMarketPairListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMarketPairListServlet.java @@ -7,9 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.MarketOrderPairList; +@FullServlet("/wallet/getmarketpairlist") +@SolidityNodeServlet("/walletsolidity/getmarketpairlist") @Component @Slf4j(topic = "API") public class GetMarketPairListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMarketPriceByPairServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMarketPriceByPairServlet.java index b6d31e10936..95f32c7cf06 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMarketPriceByPairServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMarketPriceByPairServlet.java @@ -8,10 +8,14 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.MarketOrderPair; import org.tron.protos.Protocol.MarketPriceList; +@FullServlet("/wallet/getmarketpricebypair") +@SolidityNodeServlet("/walletsolidity/getmarketpricebypair") @Component @Slf4j(topic = "API") public class GetMarketPriceByPairServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetMemoFeePricesServlet.java b/framework/src/main/java/org/tron/core/services/http/GetMemoFeePricesServlet.java index 0da52bf9d35..912df4e7f9e 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetMemoFeePricesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetMemoFeePricesServlet.java @@ -7,7 +7,9 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.PricesResponseMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getmemofee") @Component @Slf4j(topic = "API") public class GetMemoFeePricesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetNewShieldedAddressServlet.java b/framework/src/main/java/org/tron/core/services/http/GetNewShieldedAddressServlet.java index 853268b7c8c..e78bc677b3e 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetNewShieldedAddressServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetNewShieldedAddressServlet.java @@ -7,7 +7,9 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.ShieldedAddressInfo; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getnewshieldedaddress") @Component @Slf4j(topic = "API") public class GetNewShieldedAddressServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetNextMaintenanceTimeServlet.java b/framework/src/main/java/org/tron/core/services/http/GetNextMaintenanceTimeServlet.java index c93244f5782..d39cf9a4bf2 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetNextMaintenanceTimeServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetNextMaintenanceTimeServlet.java @@ -7,8 +7,10 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.NumberMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getnextmaintenancetime") @Component @Slf4j(topic = "API") public class GetNextMaintenanceTimeServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetNkFromNskServlet.java b/framework/src/main/java/org/tron/core/services/http/GetNkFromNskServlet.java index 6ec2f525e1b..36d70953069 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetNkFromNskServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetNkFromNskServlet.java @@ -9,7 +9,9 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getnkfromnsk") @Component @Slf4j(topic = "API") public class GetNkFromNskServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetNodeInfoServlet.java b/framework/src/main/java/org/tron/core/services/http/GetNodeInfoServlet.java index 8516d1c51bb..c4ec816ca62 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetNodeInfoServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetNodeInfoServlet.java @@ -9,8 +9,12 @@ import org.springframework.stereotype.Component; import org.tron.common.entity.NodeInfo; import org.tron.core.services.NodeInfoService; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet({"/wallet/getnodeinfo", "/monitor/getnodeinfo"}) +@SolidityNodeServlet({"/wallet/getnodeinfo", "/walletsolidity/getnodeinfo"}) @Component @Slf4j(topic = "API") public class GetNodeInfoServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetNowBlockServlet.java b/framework/src/main/java/org/tron/core/services/http/GetNowBlockServlet.java index 56e01d557f5..44b87926374 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetNowBlockServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetNowBlockServlet.java @@ -6,8 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Block; +@FullServlet("/wallet/getnowblock") +@SolidityNodeServlet("/walletsolidity/getnowblock") @Component @Slf4j(topic = "API") public class GetNowBlockServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetPaginatedAssetIssueListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetPaginatedAssetIssueListServlet.java index 0246979e279..eb2f196e8c7 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetPaginatedAssetIssueListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetPaginatedAssetIssueListServlet.java @@ -9,7 +9,11 @@ import org.tron.api.GrpcAPI.AssetIssueList; import org.tron.api.GrpcAPI.PaginatedMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getpaginatedassetissuelist") +@SolidityNodeServlet("/walletsolidity/getpaginatedassetissuelist") @Component @Slf4j(topic = "API") public class GetPaginatedAssetIssueListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetPaginatedExchangeListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetPaginatedExchangeListServlet.java index 28018497952..e513c9dfc28 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetPaginatedExchangeListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetPaginatedExchangeListServlet.java @@ -9,7 +9,9 @@ import org.tron.api.GrpcAPI.ExchangeList; import org.tron.api.GrpcAPI.PaginatedMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getpaginatedexchangelist") @Component @Slf4j(topic = "API") public class GetPaginatedExchangeListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetPaginatedProposalListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetPaginatedProposalListServlet.java index 11b2c57ff48..21d56b125ed 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetPaginatedProposalListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetPaginatedProposalListServlet.java @@ -10,7 +10,9 @@ import org.tron.api.GrpcAPI.PaginatedMessage; import org.tron.api.GrpcAPI.ProposalList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getpaginatedproposallist") @Component @Slf4j(topic = "API") public class GetPaginatedProposalListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetPendingSizeServlet.java b/framework/src/main/java/org/tron/core/services/http/GetPendingSizeServlet.java index 7e1a5f71841..87970da83f6 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetPendingSizeServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetPendingSizeServlet.java @@ -7,8 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getpendingsize") @Component @Slf4j(topic = "API") public class GetPendingSizeServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetProposalByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetProposalByIdServlet.java index 9d7805d4f98..eac688fbddf 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetProposalByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetProposalByIdServlet.java @@ -3,8 +3,6 @@ import com.alibaba.fastjson.JSONObject; import com.google.protobuf.ByteString; import java.io.IOException; -import java.util.HashMap; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -12,9 +10,11 @@ import org.springframework.stereotype.Component; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Proposal; +@FullServlet("/wallet/getproposalbyid") @Component @Slf4j(topic = "API") public class GetProposalByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetRcmServlet.java b/framework/src/main/java/org/tron/core/services/http/GetRcmServlet.java index 091867455f5..8ab3a97889c 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetRcmServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetRcmServlet.java @@ -7,8 +7,10 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.BytesMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getrcm") @Component @Slf4j(topic = "API") public class GetRcmServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetRewardServlet.java b/framework/src/main/java/org/tron/core/services/http/GetRewardServlet.java index c4d97f46c57..6ef5f8ccc44 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetRewardServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetRewardServlet.java @@ -8,8 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/getReward") +@SolidityNodeServlet("/walletsolidity/getReward") @Component @Slf4j(topic = "API") public class GetRewardServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetSpendingKeyServlet.java b/framework/src/main/java/org/tron/core/services/http/GetSpendingKeyServlet.java index 23c274566ca..13ca0b79494 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetSpendingKeyServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetSpendingKeyServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -8,7 +7,9 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.BytesMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/getspendingkey") @Component @Slf4j(topic = "API") public class GetSpendingKeyServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionApprovedListServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionApprovedListServlet.java index d4d123b7efe..dc081d3f6a5 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionApprovedListServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionApprovedListServlet.java @@ -7,9 +7,11 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.TransactionApprovedList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; +@FullServlet("/wallet/getapprovedlist") @Component @Slf4j(topic = "API") public class GetTransactionApprovedListServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionByIdServlet.java index 49343da9070..eaf512a37e9 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionByIdServlet.java @@ -2,7 +2,6 @@ import com.google.protobuf.ByteString; import java.io.IOException; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -11,9 +10,13 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Transaction; +@FullServlet("/wallet/gettransactionbyid") +@SolidityNodeServlet("/walletsolidity/gettransactionbyid") @Component @Slf4j(topic = "API") public class GetTransactionByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionCountByBlockNumServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionCountByBlockNumServlet.java index e096df507d7..14c83c6c7d7 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionCountByBlockNumServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionCountByBlockNumServlet.java @@ -1,7 +1,6 @@ package org.tron.core.services.http; import java.io.IOException; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -9,8 +8,12 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.NumberMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/gettransactioncountbyblocknum") +@SolidityNodeServlet("/walletsolidity/gettransactioncountbyblocknum") @Component @Slf4j(topic = "API") public class GetTransactionCountByBlockNumServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionFromPendingServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionFromPendingServlet.java index 276eff62af8..f7d866a6cb2 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionFromPendingServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionFromPendingServlet.java @@ -9,8 +9,10 @@ import org.tron.common.utils.ByteArray; import org.tron.core.capsule.TransactionCapsule; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/gettransactionfrompending") @Component @Slf4j(topic = "API") public class GetTransactionFromPendingServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByBlockNumServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByBlockNumServlet.java index 587dd2d6613..ad0b196e6df 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByBlockNumServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByBlockNumServlet.java @@ -12,9 +12,13 @@ import org.tron.api.GrpcAPI.NumberMessage; import org.tron.api.GrpcAPI.TransactionInfoList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.TransactionInfo; import org.tron.protos.Protocol.TransactionInfo.Log; +@FullServlet("/wallet/gettransactioninfobyblocknum") +@SolidityNodeServlet("/walletsolidity/gettransactioninfobyblocknum") @Component @Slf4j(topic = "API") public class GetTransactionInfoByBlockNumServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByIdServlet.java index 580cb4a5b66..82e40828a22 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionInfoByIdServlet.java @@ -2,7 +2,6 @@ import com.google.protobuf.ByteString; import java.util.List; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -11,10 +10,14 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.TransactionInfo; import org.tron.protos.Protocol.TransactionInfo.Log; +@FullServlet("/wallet/gettransactioninfobyid") +@SolidityNodeServlet("/walletsolidity/gettransactioninfobyid") @Component @Slf4j(topic = "API") public class GetTransactionInfoByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionListFromPendingServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionListFromPendingServlet.java index 0a70b22eebf..f6b3bb70bf5 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionListFromPendingServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionListFromPendingServlet.java @@ -8,8 +8,10 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.TransactionIdList; import org.tron.core.db.Manager; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/gettransactionlistfrompending") @Component @Slf4j(topic = "API") public class GetTransactionListFromPendingServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionReceiptByIdServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionReceiptByIdServlet.java index bdd46d85a88..963f6d5cb8b 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionReceiptByIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionReceiptByIdServlet.java @@ -9,9 +9,11 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.TransactionInfo; +@FullServlet("/wallet/gettransactionreceiptbyid") @Component @Slf4j(topic = "API") public class GetTransactionReceiptByIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTransactionSignWeightServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTransactionSignWeightServlet.java index bbd819d4e6d..b9985c36cfd 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTransactionSignWeightServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTransactionSignWeightServlet.java @@ -6,10 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.TransactionSignWeight; +import org.tron.core.services.annotation.FullServlet; import org.tron.core.utils.TransactionUtil; import org.tron.protos.Protocol.Transaction; +@FullServlet("/wallet/getsignweight") @Component @Slf4j(topic = "API") public class GetTransactionSignWeightServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetTriggerInputForShieldedTRC20ContractServlet.java b/framework/src/main/java/org/tron/core/services/http/GetTriggerInputForShieldedTRC20ContractServlet.java index 3a0bc4ed282..b873f1d05f7 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetTriggerInputForShieldedTRC20ContractServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetTriggerInputForShieldedTRC20ContractServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -9,7 +8,9 @@ import org.tron.api.GrpcAPI.BytesMessage; import org.tron.api.GrpcAPI.ShieldedTRC20TriggerContractParameters; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/gettriggerinputforshieldedtrc20contract") @Component @Slf4j(topic = "API") public class GetTriggerInputForShieldedTRC20ContractServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/GetZenPaymentAddressServlet.java b/framework/src/main/java/org/tron/core/services/http/GetZenPaymentAddressServlet.java index c78b663eec2..3f7ace66043 100644 --- a/framework/src/main/java/org/tron/core/services/http/GetZenPaymentAddressServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/GetZenPaymentAddressServlet.java @@ -10,10 +10,12 @@ import org.tron.api.GrpcAPI; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.core.zen.address.DiversifierT; import org.tron.core.zen.address.IncomingViewingKey; +@FullServlet("/wallet/getzenpaymentaddress") @Component @Slf4j(topic = "API") public class GetZenPaymentAddressServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/IsShieldedTRC20ContractNoteSpentServlet.java b/framework/src/main/java/org/tron/core/services/http/IsShieldedTRC20ContractNoteSpentServlet.java index 9e01ec8fda1..85fb7a08dc7 100644 --- a/framework/src/main/java/org/tron/core/services/http/IsShieldedTRC20ContractNoteSpentServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/IsShieldedTRC20ContractNoteSpentServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -9,7 +8,11 @@ import org.tron.api.GrpcAPI; import org.tron.api.GrpcAPI.NfTRC20Parameters; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/isshieldedtrc20contractnotespent") +@SolidityNodeServlet("/walletsolidity/isshieldedtrc20contractnotespent") @Component @Slf4j(topic = "API") public class IsShieldedTRC20ContractNoteSpentServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ListExchangesServlet.java b/framework/src/main/java/org/tron/core/services/http/ListExchangesServlet.java index ff349ecefab..70e81a7948a 100644 --- a/framework/src/main/java/org/tron/core/services/http/ListExchangesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ListExchangesServlet.java @@ -6,8 +6,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/listexchanges") +@SolidityNodeServlet("/walletsolidity/listexchanges") @Component @Slf4j(topic = "API") public class ListExchangesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ListNodesServlet.java b/framework/src/main/java/org/tron/core/services/http/ListNodesServlet.java index 6b7b2b251a8..247120987d4 100644 --- a/framework/src/main/java/org/tron/core/services/http/ListNodesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ListNodesServlet.java @@ -7,7 +7,9 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.NodeList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet({"/wallet/listnodes", "/net/listnodes"}) @Component @Slf4j(topic = "API") public class ListNodesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ListProposalsServlet.java b/framework/src/main/java/org/tron/core/services/http/ListProposalsServlet.java index a3b26d4afc6..d251e82f12a 100644 --- a/framework/src/main/java/org/tron/core/services/http/ListProposalsServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ListProposalsServlet.java @@ -7,7 +7,9 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.ProposalList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/listproposals") @Component @Slf4j(topic = "API") public class ListProposalsServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ListWitnessesServlet.java b/framework/src/main/java/org/tron/core/services/http/ListWitnessesServlet.java index 5274d07992b..fa6e7659add 100644 --- a/framework/src/main/java/org/tron/core/services/http/ListWitnessesServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ListWitnessesServlet.java @@ -7,8 +7,12 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.WitnessList; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/listwitnesses") +@SolidityNodeServlet("/walletsolidity/listwitnesses") @Component @Slf4j(topic = "API") public class ListWitnessesServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/MarketCancelOrderServlet.java b/framework/src/main/java/org/tron/core/services/http/MarketCancelOrderServlet.java index 8d19d60ce5c..7e8604d4df8 100644 --- a/framework/src/main/java/org/tron/core/services/http/MarketCancelOrderServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/MarketCancelOrderServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.MarketContract.MarketCancelOrderContract; +@FullServlet("/wallet/marketcancelorder") @Component @Slf4j(topic = "API") public class MarketCancelOrderServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/MarketSellAssetServlet.java b/framework/src/main/java/org/tron/core/services/http/MarketSellAssetServlet.java index 258dd270811..2dd5f8b2b0f 100644 --- a/framework/src/main/java/org/tron/core/services/http/MarketSellAssetServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/MarketSellAssetServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.MarketContract.MarketSellAssetContract; +@FullServlet("/wallet/marketsellasset") @Component @Slf4j(topic = "API") public class MarketSellAssetServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/MetricsServlet.java b/framework/src/main/java/org/tron/core/services/http/MetricsServlet.java index bb4bf18e58e..a40b1d3bd4f 100644 --- a/framework/src/main/java/org/tron/core/services/http/MetricsServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/MetricsServlet.java @@ -8,7 +8,9 @@ import org.springframework.stereotype.Component; import org.tron.core.metrics.MetricsApiService; import org.tron.core.metrics.MetricsInfo; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/monitor/getstatsinfo") @Component @Slf4j(topic = "API") public class MetricsServlet extends RateLimiterServlet { @@ -29,4 +31,8 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) { Util.processError(e, response); } } + + protected void doPost(HttpServletRequest request, HttpServletResponse response) { + doGet(request, response); + } } diff --git a/framework/src/main/java/org/tron/core/services/http/ParticipateAssetIssueServlet.java b/framework/src/main/java/org/tron/core/services/http/ParticipateAssetIssueServlet.java index 1e864250bff..4bf74fe3ca2 100644 --- a/framework/src/main/java/org/tron/core/services/http/ParticipateAssetIssueServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ParticipateAssetIssueServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AssetIssueContractOuterClass.ParticipateAssetIssueContract; +@FullServlet("/wallet/participateassetissue") @Component @Slf4j(topic = "API") public class ParticipateAssetIssueServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ProposalApproveServlet.java b/framework/src/main/java/org/tron/core/services/http/ProposalApproveServlet.java index 3fc60016780..36542407fb1 100644 --- a/framework/src/main/java/org/tron/core/services/http/ProposalApproveServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ProposalApproveServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ProposalContract.ProposalApproveContract; +@FullServlet("/wallet/proposalapprove") @Component @Slf4j(topic = "API") public class ProposalApproveServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ProposalCreateServlet.java b/framework/src/main/java/org/tron/core/services/http/ProposalCreateServlet.java index 9660ee7f863..aec7707c45c 100644 --- a/framework/src/main/java/org/tron/core/services/http/ProposalCreateServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ProposalCreateServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ProposalContract.ProposalCreateContract; +@FullServlet("/wallet/proposalcreate") @Component @Slf4j(topic = "API") public class ProposalCreateServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ProposalDeleteServlet.java b/framework/src/main/java/org/tron/core/services/http/ProposalDeleteServlet.java index 09c4c78a37a..c5360eb8c79 100644 --- a/framework/src/main/java/org/tron/core/services/http/ProposalDeleteServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ProposalDeleteServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.ProposalContract.ProposalDeleteContract; +@FullServlet("/wallet/proposaldelete") @Component @Slf4j(topic = "API") public class ProposalDeleteServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByIvkServlet.java b/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByIvkServlet.java index 2b52883f490..d688121ad8a 100644 --- a/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByIvkServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByIvkServlet.java @@ -2,7 +2,6 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -12,7 +11,11 @@ import org.tron.api.GrpcAPI.IvkDecryptTRC20Parameters; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/scanshieldedtrc20notesbyivk") +@SolidityNodeServlet("/walletsolidity/scanshieldedtrc20notesbyivk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByIvkServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByOvkServlet.java b/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByOvkServlet.java index b5fbbab1625..350e6d54619 100644 --- a/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByOvkServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ScanShieldedTRC20NotesByOvkServlet.java @@ -1,6 +1,5 @@ package org.tron.core.services.http; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; @@ -10,7 +9,11 @@ import org.tron.api.GrpcAPI.OvkDecryptTRC20Parameters; import org.tron.common.utils.ByteArray; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; +@FullServlet("/wallet/scanshieldedtrc20notesbyovk") +@SolidityNodeServlet("/walletsolidity/scanshieldedtrc20notesbyovk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByOvkServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/SetAccountIdServlet.java b/framework/src/main/java/org/tron/core/services/http/SetAccountIdServlet.java index 36203749e0b..2bd65868bad 100644 --- a/framework/src/main/java/org/tron/core/services/http/SetAccountIdServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/SetAccountIdServlet.java @@ -8,10 +8,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol; import org.tron.protos.contract.AccountContract.SetAccountIdContract; +@FullServlet("/wallet/setaccountid") @Component @Slf4j(topic = "API") public class SetAccountIdServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/TotalTransactionServlet.java b/framework/src/main/java/org/tron/core/services/http/TotalTransactionServlet.java index 6af40232e8f..fd46385fe7b 100644 --- a/framework/src/main/java/org/tron/core/services/http/TotalTransactionServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/TotalTransactionServlet.java @@ -7,8 +7,10 @@ import org.springframework.stereotype.Component; import org.tron.api.GrpcAPI.NumberMessage; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/totaltransaction") @Component @Slf4j(topic = "API") public class TotalTransactionServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/TransferAssetServlet.java b/framework/src/main/java/org/tron/core/services/http/TransferAssetServlet.java index af2699c4bf4..574e70167f7 100644 --- a/framework/src/main/java/org/tron/core/services/http/TransferAssetServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/TransferAssetServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AssetIssueContractOuterClass.TransferAssetContract; +@FullServlet("/wallet/transferasset") @Component @Slf4j(topic = "API") public class TransferAssetServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/TransferServlet.java b/framework/src/main/java/org/tron/core/services/http/TransferServlet.java index 6f575e4fe3f..3bcf0b786c8 100644 --- a/framework/src/main/java/org/tron/core/services/http/TransferServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/TransferServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.TransferContract; +@FullServlet("/wallet/createtransaction") @Component @Slf4j(topic = "API") public class TransferServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/TriggerConstantContractServlet.java b/framework/src/main/java/org/tron/core/services/http/TriggerConstantContractServlet.java index 8a46ee1ed74..9667b00b156 100644 --- a/framework/src/main/java/org/tron/core/services/http/TriggerConstantContractServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/TriggerConstantContractServlet.java @@ -17,11 +17,15 @@ import org.tron.core.Wallet; import org.tron.core.capsule.TransactionCapsule; import org.tron.core.exception.ContractValidateException; +import org.tron.core.services.annotation.FullServlet; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract; +@FullServlet("/wallet/triggerconstantcontract") +@SolidityNodeServlet("/walletsolidity/triggerconstantcontract") @Component @Slf4j(topic = "API") public class TriggerConstantContractServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/TriggerSmartContractServlet.java b/framework/src/main/java/org/tron/core/services/http/TriggerSmartContractServlet.java index 6577a9e5f24..99ecaffa3c0 100644 --- a/framework/src/main/java/org/tron/core/services/http/TriggerSmartContractServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/TriggerSmartContractServlet.java @@ -18,11 +18,13 @@ import org.tron.core.Wallet; import org.tron.core.capsule.TransactionCapsule; import org.tron.core.exception.ContractValidateException; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.TriggerSmartContract; +@FullServlet("/wallet/triggersmartcontract") @Component @Slf4j(topic = "API") public class TriggerSmartContractServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UnDelegateResourceServlet.java b/framework/src/main/java/org/tron/core/services/http/UnDelegateResourceServlet.java index cf9c2c95dcd..84a96a0e271 100644 --- a/framework/src/main/java/org/tron/core/services/http/UnDelegateResourceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UnDelegateResourceServlet.java @@ -7,10 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.UnDelegateResourceContract; +@FullServlet("/wallet/undelegateresource") @Component @Slf4j(topic = "API") public class UnDelegateResourceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UnFreezeAssetServlet.java b/framework/src/main/java/org/tron/core/services/http/UnFreezeAssetServlet.java index 6118b39f2cd..21895da12ff 100644 --- a/framework/src/main/java/org/tron/core/services/http/UnFreezeAssetServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UnFreezeAssetServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AssetIssueContractOuterClass.UnfreezeAssetContract; +@FullServlet("/wallet/unfreezeasset") @Component @Slf4j(topic = "API") public class UnFreezeAssetServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceServlet.java b/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceServlet.java index eb075b7139d..5691ea5248b 100644 --- a/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.UnfreezeBalanceContract; +@FullServlet("/wallet/unfreezebalance") @Component @Slf4j(topic = "API") public class UnFreezeBalanceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceV2Servlet.java b/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceV2Servlet.java index 614a7ca6b7a..5cbfa1f0c67 100644 --- a/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceV2Servlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UnFreezeBalanceV2Servlet.java @@ -7,10 +7,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.UnfreezeBalanceV2Contract; +@FullServlet("/wallet/unfreezebalancev2") @Component @Slf4j(topic = "API") public class UnFreezeBalanceV2Servlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateAccountServlet.java index 0251a46ec64..0acec95a0bf 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateAccountServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AccountContract.AccountUpdateContract; +@FullServlet("/wallet/updateaccount") @Component @Slf4j(topic = "API") public class UpdateAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateAssetServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateAssetServlet.java index d3f467ff7a8..08c8d173724 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateAssetServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateAssetServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.AssetIssueContractOuterClass.UpdateAssetContract; +@FullServlet("/wallet/updateasset") @Component @Slf4j(topic = "API") public class UpdateAssetServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateBrokerageServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateBrokerageServlet.java index 23daaef6072..e7ed9069575 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateBrokerageServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateBrokerageServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.StorageContract.UpdateBrokerageContract; +@FullServlet("/wallet/updateBrokerage") @Component @Slf4j(topic = "API") public class UpdateBrokerageServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateEnergyLimitServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateEnergyLimitServlet.java index aac6e8ff50e..56d1f83b0c6 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateEnergyLimitServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateEnergyLimitServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.UpdateEnergyLimitContract; +@FullServlet("/wallet/updateenergylimit") @Component @Slf4j(topic = "API") public class UpdateEnergyLimitServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateSettingServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateSettingServlet.java index 821054c7b4e..66cdbe53f6e 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateSettingServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateSettingServlet.java @@ -7,11 +7,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.SmartContractOuterClass.UpdateSettingContract; +@FullServlet("/wallet/updatesetting") @Component @Slf4j(topic = "API") public class UpdateSettingServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/UpdateWitnessServlet.java b/framework/src/main/java/org/tron/core/services/http/UpdateWitnessServlet.java index 3584557d3b6..9c4fc1ca81a 100644 --- a/framework/src/main/java/org/tron/core/services/http/UpdateWitnessServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/UpdateWitnessServlet.java @@ -1,18 +1,19 @@ package org.tron.core.services.http; import com.alibaba.fastjson.JSONObject; -import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.WitnessContract.WitnessUpdateContract; +@FullServlet("/wallet/updatewitness") @Component @Slf4j(topic = "API") public class UpdateWitnessServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/Util.java b/framework/src/main/java/org/tron/core/services/http/Util.java index 2b6b929d8a0..4c2b839b68a 100644 --- a/framework/src/main/java/org/tron/core/services/http/Util.java +++ b/framework/src/main/java/org/tron/core/services/http/Util.java @@ -12,7 +12,6 @@ import com.google.protobuf.GeneratedMessageV3; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; - import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/framework/src/main/java/org/tron/core/services/http/ValidateAddressServlet.java b/framework/src/main/java/org/tron/core/services/http/ValidateAddressServlet.java index a65e2ce2ee0..932133c33db 100644 --- a/framework/src/main/java/org/tron/core/services/http/ValidateAddressServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/ValidateAddressServlet.java @@ -12,8 +12,10 @@ import org.tron.common.utils.ByteArray; import org.tron.common.utils.Commons; import org.tron.common.utils.DecodeUtil; +import org.tron.core.services.annotation.FullServlet; +@FullServlet("/wallet/validateaddress") @Component @Slf4j(topic = "API") public class ValidateAddressServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/VoteWitnessAccountServlet.java b/framework/src/main/java/org/tron/core/services/http/VoteWitnessAccountServlet.java index 0a77a0e6fc1..7720830e86f 100644 --- a/framework/src/main/java/org/tron/core/services/http/VoteWitnessAccountServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/VoteWitnessAccountServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.WitnessContract.VoteWitnessContract; +@FullServlet("/wallet/votewitnessaccount") @Component @Slf4j(topic = "API") public class VoteWitnessAccountServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/WithdrawBalanceServlet.java b/framework/src/main/java/org/tron/core/services/http/WithdrawBalanceServlet.java index 27ea54d8ee2..8560268a4a3 100644 --- a/framework/src/main/java/org/tron/core/services/http/WithdrawBalanceServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/WithdrawBalanceServlet.java @@ -8,11 +8,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.WithdrawBalanceContract; +@FullServlet("/wallet/withdrawbalance") @Component @Slf4j(topic = "API") public class WithdrawBalanceServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/WithdrawExpireUnfreezeServlet.java b/framework/src/main/java/org/tron/core/services/http/WithdrawExpireUnfreezeServlet.java index 4888ee42de4..5d1a1e423f9 100644 --- a/framework/src/main/java/org/tron/core/services/http/WithdrawExpireUnfreezeServlet.java +++ b/framework/src/main/java/org/tron/core/services/http/WithdrawExpireUnfreezeServlet.java @@ -9,11 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.FullServlet; import org.tron.protos.Protocol.Transaction; import org.tron.protos.Protocol.Transaction.Contract.ContractType; import org.tron.protos.contract.BalanceContract.WithdrawExpireUnfreezeContract; +@FullServlet("/wallet/withdrawexpireunfreeze") @Component @Slf4j(topic = "API") public class WithdrawExpireUnfreezeServlet extends RateLimiterServlet { diff --git a/framework/src/main/java/org/tron/core/services/http/solidity/SolidityNodeHttpApiService.java b/framework/src/main/java/org/tron/core/services/http/solidity/SolidityNodeHttpApiService.java index ea08d2d42cf..f18f822fedc 100644 --- a/framework/src/main/java/org/tron/core/services/http/solidity/SolidityNodeHttpApiService.java +++ b/framework/src/main/java/org/tron/core/services/http/solidity/SolidityNodeHttpApiService.java @@ -1,62 +1,22 @@ package org.tron.core.services.http.solidity; +import java.util.Arrays; import java.util.EnumSet; import javax.servlet.DispatcherType; +import javax.servlet.Servlet; import lombok.extern.slf4j.Slf4j; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.StringUtil; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import org.tron.common.application.HttpService; import org.tron.core.config.args.Args; +import org.tron.core.services.annotation.SolidityNodeServlet; import org.tron.core.services.filter.HttpApiAccessFilter; -import org.tron.core.services.http.EstimateEnergyServlet; -import org.tron.core.services.http.GetAccountByIdServlet; -import org.tron.core.services.http.GetAccountServlet; -import org.tron.core.services.http.GetAssetIssueByIdServlet; -import org.tron.core.services.http.GetAssetIssueByNameServlet; -import org.tron.core.services.http.GetAssetIssueListByNameServlet; -import org.tron.core.services.http.GetAssetIssueListServlet; -import org.tron.core.services.http.GetAvailableUnfreezeCountServlet; -import org.tron.core.services.http.GetBandwidthPricesServlet; -import org.tron.core.services.http.GetBlockByIdServlet; -import org.tron.core.services.http.GetBlockByLatestNumServlet; -import org.tron.core.services.http.GetBlockByLimitNextServlet; -import org.tron.core.services.http.GetBlockByNumServlet; -import org.tron.core.services.http.GetBlockServlet; -import org.tron.core.services.http.GetBrokerageServlet; -import org.tron.core.services.http.GetBurnTrxServlet; -import org.tron.core.services.http.GetCanDelegatedMaxSizeServlet; -import org.tron.core.services.http.GetCanWithdrawUnfreezeAmountServlet; -import org.tron.core.services.http.GetDelegatedResourceAccountIndexServlet; -import org.tron.core.services.http.GetDelegatedResourceAccountIndexV2Servlet; -import org.tron.core.services.http.GetDelegatedResourceServlet; -import org.tron.core.services.http.GetDelegatedResourceV2Servlet; -import org.tron.core.services.http.GetEnergyPricesServlet; -import org.tron.core.services.http.GetExchangeByIdServlet; -import org.tron.core.services.http.GetMarketOrderByAccountServlet; -import org.tron.core.services.http.GetMarketOrderByIdServlet; -import org.tron.core.services.http.GetMarketOrderListByPairServlet; -import org.tron.core.services.http.GetMarketPairListServlet; -import org.tron.core.services.http.GetMarketPriceByPairServlet; -import org.tron.core.services.http.GetMerkleTreeVoucherInfoServlet; -import org.tron.core.services.http.GetNodeInfoServlet; -import org.tron.core.services.http.GetNowBlockServlet; -import org.tron.core.services.http.GetPaginatedAssetIssueListServlet; -import org.tron.core.services.http.GetRewardServlet; -import org.tron.core.services.http.GetTransactionCountByBlockNumServlet; -import org.tron.core.services.http.GetTransactionInfoByBlockNumServlet; -import org.tron.core.services.http.IsShieldedTRC20ContractNoteSpentServlet; -import org.tron.core.services.http.IsSpendServlet; -import org.tron.core.services.http.ListExchangesServlet; -import org.tron.core.services.http.ListWitnessesServlet; -import org.tron.core.services.http.ScanAndMarkNoteByIvkServlet; -import org.tron.core.services.http.ScanNoteByIvkServlet; -import org.tron.core.services.http.ScanNoteByOvkServlet; -import org.tron.core.services.http.ScanShieldedTRC20NotesByIvkServlet; -import org.tron.core.services.http.ScanShieldedTRC20NotesByOvkServlet; -import org.tron.core.services.http.TriggerConstantContractServlet; @Component @@ -64,103 +24,9 @@ public class SolidityNodeHttpApiService extends HttpService { @Autowired - private GetAccountServlet getAccountServlet; - @Autowired - private GetTransactionByIdSolidityServlet getTransactionByIdServlet; - @Autowired - private GetTransactionInfoByIdSolidityServlet getTransactionInfoByIdServlet; - @Autowired - private GetTransactionCountByBlockNumServlet getTransactionCountByBlockNumServlet; - @Autowired - private GetDelegatedResourceServlet getDelegatedResourceServlet; - @Autowired - private GetDelegatedResourceV2Servlet getDelegatedResourceV2Servlet; - @Autowired - private GetCanDelegatedMaxSizeServlet getCanDelegatedMaxSizeServlet; - @Autowired - private GetAvailableUnfreezeCountServlet getAvailableUnfreezeCountServlet; - @Autowired - private GetCanWithdrawUnfreezeAmountServlet getCanWithdrawUnfreezeAmountServlet; - @Autowired - private GetDelegatedResourceAccountIndexServlet getDelegatedResourceAccountIndexServlet; - @Autowired - private GetDelegatedResourceAccountIndexV2Servlet getDelegatedResourceAccountIndexV2Servlet; - @Autowired - private GetExchangeByIdServlet getExchangeByIdServlet; - @Autowired - private ListExchangesServlet listExchangesServlet; - @Autowired - private ListWitnessesServlet listWitnessesServlet; - @Autowired - private GetAssetIssueListServlet getAssetIssueListServlet; - @Autowired - private GetPaginatedAssetIssueListServlet getPaginatedAssetIssueListServlet; - @Autowired - private GetAssetIssueByNameServlet getAssetIssueByNameServlet; - @Autowired - private GetAssetIssueByIdServlet getAssetIssueByIdServlet; - @Autowired - private GetAssetIssueListByNameServlet getAssetIssueListByNameServlet; - @Autowired - private GetNowBlockServlet getNowBlockServlet; - @Autowired - private GetBlockByNumServlet getBlockByNumServlet; - @Autowired - private GetNodeInfoServlet getNodeInfoServlet; - @Autowired - private GetAccountByIdServlet getAccountByIdServlet; - @Autowired - private GetBlockByIdServlet getBlockByIdServlet; - @Autowired - private GetBlockByLimitNextServlet getBlockByLimitNextServlet; - @Autowired - private GetBlockByLatestNumServlet getBlockByLatestNumServlet; - @Autowired - private ScanAndMarkNoteByIvkServlet scanAndMarkNoteByIvkServlet; - @Autowired - private ScanNoteByIvkServlet scanNoteByIvkServlet; - @Autowired - private ScanNoteByOvkServlet scanNoteByOvkServlet; - @Autowired - private GetMerkleTreeVoucherInfoServlet getMerkleTreeVoucherInfoServlet; - @Autowired - private IsSpendServlet isSpendServlet; - @Autowired - private ScanShieldedTRC20NotesByIvkServlet scanShieldedTRC20NotesByIvkServlet; - @Autowired - private ScanShieldedTRC20NotesByOvkServlet scanShieldedTRC20NotesByOvkServlet; - @Autowired - private IsShieldedTRC20ContractNoteSpentServlet isShieldedTRC20ContractNoteSpentServlet; - @Autowired - private GetMarketOrderByAccountServlet getMarketOrderByAccountServlet; - @Autowired - private GetMarketOrderByIdServlet getMarketOrderByIdServlet; - @Autowired - private GetMarketPriceByPairServlet getMarketPriceByPairServlet; - @Autowired - private GetMarketOrderListByPairServlet getMarketOrderListByPairServlet; - @Autowired - private GetMarketPairListServlet getMarketPairListServlet; - @Autowired - private GetBurnTrxServlet getBurnTrxServlet; - @Autowired - private GetBrokerageServlet getBrokerageServlet; - @Autowired - private GetRewardServlet getRewardServlet; - @Autowired - private TriggerConstantContractServlet triggerConstantContractServlet; - @Autowired - private EstimateEnergyServlet estimateEnergyServlet; - @Autowired - private GetTransactionInfoByBlockNumServlet getTransactionInfoByBlockNumServlet; + private ApplicationContext applicationContext; @Autowired private HttpApiAccessFilter httpApiAccessFilter; - @Autowired - private GetBlockServlet getBlockServlet; - @Autowired - private GetBandwidthPricesServlet getBandwidthPricesServlet; - @Autowired - private GetEnergyPricesServlet getEnergyPricesServlet; public SolidityNodeHttpApiService() { @@ -171,106 +37,16 @@ public SolidityNodeHttpApiService() { @Override protected void addServlet(ServletContextHandler context) { - // same as FullNode - context.addServlet(new ServletHolder(getAccountServlet), "/walletsolidity/getaccount"); - context.addServlet(new ServletHolder(listWitnessesServlet), "/walletsolidity/listwitnesses"); - context.addServlet(new ServletHolder(getAssetIssueListServlet), - "/walletsolidity/getassetissuelist"); - context.addServlet(new ServletHolder(getPaginatedAssetIssueListServlet), - "/walletsolidity/getpaginatedassetissuelist"); - context.addServlet(new ServletHolder(getAssetIssueByNameServlet), - "/walletsolidity/getassetissuebyname"); - context.addServlet(new ServletHolder(getAssetIssueByIdServlet), - "/walletsolidity/getassetissuebyid"); - context.addServlet(new ServletHolder(getAssetIssueListByNameServlet), - "/walletsolidity/getassetissuelistbyname"); - context.addServlet(new ServletHolder(getNowBlockServlet), "/walletsolidity/getnowblock"); - context.addServlet(new ServletHolder(getBlockByNumServlet), "/walletsolidity/getblockbynum"); - context.addServlet(new ServletHolder(getDelegatedResourceServlet), - "/walletsolidity/getdelegatedresource"); - context.addServlet(new ServletHolder(getDelegatedResourceV2Servlet), - "/walletsolidity/getdelegatedresourcev2"); - context.addServlet(new ServletHolder(getCanDelegatedMaxSizeServlet), - "/walletsolidity/getcandelegatedmaxsize"); - context.addServlet(new ServletHolder(getAvailableUnfreezeCountServlet), - "/walletsolidity/getavailableunfreezecount"); - context.addServlet(new ServletHolder(getCanWithdrawUnfreezeAmountServlet), - "/walletsolidity/getcanwithdrawunfreezeamount"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexServlet), - "/walletsolidity/getdelegatedresourceaccountindex"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexV2Servlet), - "/walletsolidity/getdelegatedresourceaccountindexv2"); - context - .addServlet(new ServletHolder(getExchangeByIdServlet), - "/walletsolidity/getexchangebyid"); - context.addServlet(new ServletHolder(listExchangesServlet), - "/walletsolidity/listexchanges"); - - context.addServlet(new ServletHolder(getAccountByIdServlet), - "/walletsolidity/getaccountbyid"); - context.addServlet(new ServletHolder(getBlockByIdServlet), - "/walletsolidity/getblockbyid"); - context.addServlet(new ServletHolder(getBlockByLimitNextServlet), - "/walletsolidity/getblockbylimitnext"); - context.addServlet(new ServletHolder(getBlockByLatestNumServlet), - "/walletsolidity/getblockbylatestnum"); - - // context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoServlet), - // "/walletsolidity/getmerkletreevoucherinfo"); - // context.addServlet(new ServletHolder(scanAndMarkNoteByIvkServlet), - // "/walletsolidity/scanandmarknotebyivk"); - // context.addServlet(new ServletHolder(scanNoteByIvkServlet), - // "/walletsolidity/scannotebyivk"); - // context.addServlet(new ServletHolder(scanNoteByOvkServlet), - // "/walletsolidity/scannotebyovk"); - // context.addServlet(new ServletHolder(isSpendServlet), - // "/walletsolidity/isspend"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByIvkServlet), - "/walletsolidity/scanshieldedtrc20notesbyivk"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByOvkServlet), - "/walletsolidity/scanshieldedtrc20notesbyovk"); - context.addServlet(new ServletHolder(isShieldedTRC20ContractNoteSpentServlet), - "/walletsolidity/isshieldedtrc20contractnotespent"); - - context.addServlet(new ServletHolder(getTransactionInfoByBlockNumServlet), - "/walletsolidity/gettransactioninfobyblocknum"); - - context.addServlet(new ServletHolder(getMarketOrderByAccountServlet), - "/walletsolidity/getmarketorderbyaccount"); - context.addServlet(new ServletHolder(getMarketOrderByIdServlet), - "/walletsolidity/getmarketorderbyid"); - context.addServlet(new ServletHolder(getMarketPriceByPairServlet), - "/walletsolidity/getmarketpricebypair"); - context.addServlet(new ServletHolder(getMarketOrderListByPairServlet), - "/walletsolidity/getmarketorderlistbypair"); - context.addServlet(new ServletHolder(getMarketPairListServlet), - "/walletsolidity/getmarketpairlist"); - - // only for SolidityNode - context.addServlet(new ServletHolder(getTransactionByIdServlet), - "/walletsolidity/gettransactionbyid"); - - context - .addServlet(new ServletHolder(getTransactionInfoByIdServlet), - "/walletsolidity/gettransactioninfobyid"); - context - .addServlet(new ServletHolder(getTransactionCountByBlockNumServlet), - "/walletsolidity/gettransactioncountbyblocknum"); - context.addServlet(new ServletHolder(triggerConstantContractServlet), - "/walletsolidity/triggerconstantcontract"); - context.addServlet(new ServletHolder(estimateEnergyServlet), - "/walletsolidity/estimateenergy"); - - context.addServlet(new ServletHolder(getNodeInfoServlet), "/wallet/getnodeinfo"); - context.addServlet(new ServletHolder(getNodeInfoServlet), "/walletsolidity/getnodeinfo"); - context.addServlet(new ServletHolder(getBrokerageServlet), "/walletsolidity/getBrokerage"); - context.addServlet(new ServletHolder(getRewardServlet), "/walletsolidity/getReward"); - context.addServlet(new ServletHolder(getBurnTrxServlet), "/walletsolidity/getburntrx"); - context.addServlet(new ServletHolder(getBlockServlet), "/walletsolidity/getblock"); - context.addServlet(new ServletHolder(getBandwidthPricesServlet), - "/walletsolidity/getbandwidthprices"); - context.addServlet(new ServletHolder(getEnergyPricesServlet), - "/walletsolidity/getenergyprices"); + applicationContext.getBeansWithAnnotation(SolidityNodeServlet.class).values() + .stream().filter(o -> o instanceof Servlet) + .map(o -> (Servlet) o) + .filter(o -> AopUtils.getTargetClass(o).isAnnotationPresent(SolidityNodeServlet.class)) + .forEach(o -> { + SolidityNodeServlet path = AopUtils.getTargetClass(o) + .getAnnotation(SolidityNodeServlet.class); + Arrays.stream(path.value()).filter(StringUtil::isNotBlank).forEach(p -> + context.addServlet(new ServletHolder(o), p)); + }); } @Override diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/EstimateEnergyOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/EstimateEnergyOnPBFTServlet.java index 825e2bf79e8..711899c39b1 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/EstimateEnergyOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/EstimateEnergyOnPBFTServlet.java @@ -3,13 +3,14 @@ import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; - import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.EstimateEnergyServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/estimateenergy") @Component @Slf4j(topic = "API") public class EstimateEnergyOnPBFTServlet extends EstimateEnergyServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountByIdOnPBFTServlet.java index 1506b98ee96..a9079a20d10 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountByIdOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAccountByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getaccountbyid") @Component @Slf4j(topic = "API") public class GetAccountByIdOnPBFTServlet extends GetAccountByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountOnPBFTServlet.java index 1db7d2fbd02..4dbb358e537 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAccountOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAccountServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getaccount") @Component @Slf4j(topic = "API") public class GetAccountOnPBFTServlet extends GetAccountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByIdOnPBFTServlet.java index 497ac775731..30eb9490afc 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByIdOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAssetIssueByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getassetissuebyid") @Component @Slf4j(topic = "API") public class GetAssetIssueByIdOnPBFTServlet extends GetAssetIssueByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByNameOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByNameOnPBFTServlet.java index 9da748921ab..100bb2c28ed 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByNameOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueByNameOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAssetIssueByNameServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getassetissuebyname") @Component @Slf4j(topic = "API") public class GetAssetIssueByNameOnPBFTServlet extends GetAssetIssueByNameServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListByNameOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListByNameOnPBFTServlet.java index 4f781051cc1..a8e9ce2b234 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListByNameOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListByNameOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAssetIssueListByNameServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getassetissuelistbyname") @Component @Slf4j(topic = "API") public class GetAssetIssueListByNameOnPBFTServlet extends GetAssetIssueListByNameServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListOnPBFTServlet.java index 18f414c04b1..22b9010af1c 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAssetIssueListOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAssetIssueListServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getassetissuelist") @Component @Slf4j(topic = "API") public class GetAssetIssueListOnPBFTServlet extends GetAssetIssueListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAvailableUnfreezeCountOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAvailableUnfreezeCountOnPBFTServlet.java index bb393f92efc..5e83fa930c5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAvailableUnfreezeCountOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetAvailableUnfreezeCountOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetAvailableUnfreezeCountServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getavailableunfreezecount") @Component @Slf4j(topic = "API") public class GetAvailableUnfreezeCountOnPBFTServlet extends GetAvailableUnfreezeCountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBandwidthPricesOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBandwidthPricesOnPBFTServlet.java index c89bc5f9646..ede1c8f72e5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBandwidthPricesOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBandwidthPricesOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBandwidthPricesServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getbandwidthprices") @Component @Slf4j(topic = "API") public class GetBandwidthPricesOnPBFTServlet extends GetBandwidthPricesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByIdOnPBFTServlet.java index 59e186ab4e0..713902c80cb 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByIdOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBlockByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getblockbyid") @Component @Slf4j(topic = "API") public class GetBlockByIdOnPBFTServlet extends GetBlockByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLatestNumOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLatestNumOnPBFTServlet.java index 536d6c7bcce..026fac47e54 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLatestNumOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLatestNumOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBlockByLatestNumServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getblockbylatestnum") @Component @Slf4j(topic = "API") public class GetBlockByLatestNumOnPBFTServlet extends GetBlockByLatestNumServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLimitNextOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLimitNextOnPBFTServlet.java index f04d8820cbf..c57edb994d4 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLimitNextOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByLimitNextOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBlockByLimitNextServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getblockbylimitnext") @Component @Slf4j(topic = "API") public class GetBlockByLimitNextOnPBFTServlet extends GetBlockByLimitNextServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByNumOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByNumOnPBFTServlet.java index bc19befc9c0..556f190aa5b 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByNumOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBlockByNumOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBlockByNumServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getblockbynum") @Component @Slf4j(topic = "API") public class GetBlockByNumOnPBFTServlet extends GetBlockByNumServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBrokerageOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBrokerageOnPBFTServlet.java index c0bcc8de6b5..5486e3b4fa3 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBrokerageOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBrokerageOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBrokerageServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getBrokerage") @Component @Slf4j(topic = "API") public class GetBrokerageOnPBFTServlet extends GetBrokerageServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBurnTrxOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBurnTrxOnPBFTServlet.java index fb1654062c8..1066463b2d7 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBurnTrxOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetBurnTrxOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBurnTrxServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getburntrx") @Component @Slf4j(topic = "API") public class GetBurnTrxOnPBFTServlet extends GetBurnTrxServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanDelegatedMaxSizeOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanDelegatedMaxSizeOnPBFTServlet.java index 8b3b47462e8..2a0a81b6590 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanDelegatedMaxSizeOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanDelegatedMaxSizeOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetCanDelegatedMaxSizeServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getcandelegatedmaxsize") @Component @Slf4j(topic = "API") public class GetCanDelegatedMaxSizeOnPBFTServlet extends GetCanDelegatedMaxSizeServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanWithdrawUnfreezeAmountOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanWithdrawUnfreezeAmountOnPBFTServlet.java index c8b20c4eef7..82692ad3824 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanWithdrawUnfreezeAmountOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetCanWithdrawUnfreezeAmountOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetCanWithdrawUnfreezeAmountServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getcanwithdrawunfreezeamount") @Component @Slf4j(topic = "API") public class GetCanWithdrawUnfreezeAmountOnPBFTServlet diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexOnPBFTServlet.java index febee663796..14a94f68876 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetDelegatedResourceAccountIndexServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getdelegatedresourceaccountindex") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexOnPBFTServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexV2OnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexV2OnPBFTServlet.java index 07541905300..c0dac4e2db1 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexV2OnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceAccountIndexV2OnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetDelegatedResourceAccountIndexV2Servlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getdelegatedresourceaccountindexv2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexV2OnPBFTServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceOnPBFTServlet.java index 04b4a0436aa..818c4a3b7ec 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetDelegatedResourceServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getdelegatedresource") @Component @Slf4j(topic = "API") public class GetDelegatedResourceOnPBFTServlet extends GetDelegatedResourceServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceV2OnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceV2OnPBFTServlet.java index 6429c90eec5..86a2c509386 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceV2OnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetDelegatedResourceV2OnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetDelegatedResourceV2Servlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getdelegatedresourcev2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceV2OnPBFTServlet extends GetDelegatedResourceV2Servlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetEnergyPricesOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetEnergyPricesOnPBFTServlet.java index 11c1dcaa0e8..f653d190c7f 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetEnergyPricesOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetEnergyPricesOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetEnergyPricesServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getenergyprices") @Component @Slf4j(topic = "API") public class GetEnergyPricesOnPBFTServlet extends GetEnergyPricesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetExchangeByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetExchangeByIdOnPBFTServlet.java index ecdbd5228d2..f0ba2f33461 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetExchangeByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetExchangeByIdOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetExchangeByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getexchangebyid") @Component @Slf4j(topic = "API") public class GetExchangeByIdOnPBFTServlet extends GetExchangeByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByAccountOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByAccountOnPBFTServlet.java index 7fa308c3abc..9ccba4943d3 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByAccountOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByAccountOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMarketOrderByAccountServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmarketorderbyaccount") @Component @Slf4j(topic = "API") public class GetMarketOrderByAccountOnPBFTServlet extends GetMarketOrderByAccountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByIdOnPBFTServlet.java index 63809fd032c..aa35d8c48ae 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderByIdOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMarketOrderByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmarketorderbyid") @Component @Slf4j(topic = "API") public class GetMarketOrderByIdOnPBFTServlet extends GetMarketOrderByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderListByPairOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderListByPairOnPBFTServlet.java index b18dde73651..2143c86ac68 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderListByPairOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketOrderListByPairOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMarketOrderListByPairServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmarketorderlistbypair") @Component @Slf4j(topic = "API") public class GetMarketOrderListByPairOnPBFTServlet extends GetMarketOrderListByPairServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPairListOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPairListOnPBFTServlet.java index 4d3f69c9132..59fc7db9ab8 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPairListOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPairListOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMarketPairListServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmarketpairlist") @Component @Slf4j(topic = "API") public class GetMarketPairListOnPBFTServlet extends GetMarketPairListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPriceByPairOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPriceByPairOnPBFTServlet.java index 330cf2c2552..41926b9f530 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPriceByPairOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMarketPriceByPairOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMarketPriceByPairServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmarketpricebypair") @Component @Slf4j(topic = "API") public class GetMarketPriceByPairOnPBFTServlet extends GetMarketPriceByPairServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMerkleTreeVoucherInfoOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMerkleTreeVoucherInfoOnPBFTServlet.java index 0e92ccf2d92..0bb7ad4854d 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMerkleTreeVoucherInfoOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetMerkleTreeVoucherInfoOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetMerkleTreeVoucherInfoServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getmerkletreevoucherinfo") @Component @Slf4j(topic = "API") public class GetMerkleTreeVoucherInfoOnPBFTServlet extends GetMerkleTreeVoucherInfoServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNodeInfoOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNodeInfoOnPBFTServlet.java index 0149d29326d..891964b9df5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNodeInfoOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNodeInfoOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetNodeInfoServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getnodeinfo") @Component @Slf4j(topic = "API") public class GetNodeInfoOnPBFTServlet extends GetNodeInfoServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNowBlockOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNowBlockOnPBFTServlet.java index e37ff729433..8a0d825414b 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNowBlockOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetNowBlockOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetNowBlockServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getnowblock") @Component @Slf4j(topic = "API") public class GetNowBlockOnPBFTServlet extends GetNowBlockServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetPaginatedAssetIssueListOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetPaginatedAssetIssueListOnPBFTServlet.java index 900c75d34af..3f6b06294d1 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetPaginatedAssetIssueListOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetPaginatedAssetIssueListOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetPaginatedAssetIssueListServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getpaginatedassetissuelist") @Component @Slf4j(topic = "API") public class GetPaginatedAssetIssueListOnPBFTServlet extends GetPaginatedAssetIssueListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetRewardOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetRewardOnPBFTServlet.java index 98c20c7d5eb..df9db180b63 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetRewardOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetRewardOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetRewardServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getReward") @Component @Slf4j(topic = "API") public class GetRewardOnPBFTServlet extends GetRewardServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetTransactionCountByBlockNumOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetTransactionCountByBlockNumOnPBFTServlet.java index b79f6001d27..2b5525d78f0 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetTransactionCountByBlockNumOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/GetTransactionCountByBlockNumOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetTransactionCountByBlockNumServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/gettransactioncountbyblocknum") @Component @Slf4j(topic = "API") public class GetTransactionCountByBlockNumOnPBFTServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsShieldedTRC20ContractNoteSpentOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsShieldedTRC20ContractNoteSpentOnPBFTServlet.java index afdb6dfc71e..ae604894889 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsShieldedTRC20ContractNoteSpentOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsShieldedTRC20ContractNoteSpentOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.IsShieldedTRC20ContractNoteSpentServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/isshieldedtrc20contractnotespent") @Component @Slf4j(topic = "API") public class IsShieldedTRC20ContractNoteSpentOnPBFTServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsSpendOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsSpendOnPBFTServlet.java index 82fb6fb72a7..da5e2c4be8c 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsSpendOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/IsSpendOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.IsSpendServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/isspend") @Component @Slf4j(topic = "API") public class IsSpendOnPBFTServlet extends IsSpendServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListExchangesOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListExchangesOnPBFTServlet.java index 234db10b7ac..9dfe0995255 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListExchangesOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListExchangesOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ListExchangesServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/listexchanges") @Component @Slf4j(topic = "API") public class ListExchangesOnPBFTServlet extends ListExchangesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListWitnessesOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListWitnessesOnPBFTServlet.java index 940f072a709..765774e7242 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListWitnessesOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ListWitnessesOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ListWitnessesServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/listwitnesses") @Component @Slf4j(topic = "API") public class ListWitnessesOnPBFTServlet extends ListWitnessesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetBlockOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetBlockOnPBFTServlet.java index 3207ebcf161..1f02d458c41 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetBlockOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetBlockOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetBlockServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/getblock") @Component @Slf4j(topic = "API") public class GetBlockOnPBFTServlet extends GetBlockServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionByIdOnPBFTServlet.java index fc7a8a47257..38db2c7a144 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionByIdOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetTransactionByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/gettransactionbyid") @Component @Slf4j(topic = "API") public class GetTransactionByIdOnPBFTServlet extends GetTransactionByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionInfoByIdOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionInfoByIdOnPBFTServlet.java index f96720123fd..206920cf3f7 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionInfoByIdOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/GetTransactionInfoByIdOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.GetTransactionInfoByIdServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/gettransactioninfobyid") @Component @Slf4j(topic = "API") public class GetTransactionInfoByIdOnPBFTServlet extends GetTransactionInfoByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/HttpApiOnPBFTService.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/HttpApiOnPBFTService.java index 828d36e664f..643c6723ce2 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/HttpApiOnPBFTService.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/PBFT/HttpApiOnPBFTService.java @@ -1,173 +1,35 @@ package org.tron.core.services.interfaceOnPBFT.http.PBFT; +import java.util.Arrays; import java.util.EnumSet; import javax.servlet.DispatcherType; +import javax.servlet.Servlet; import lombok.extern.slf4j.Slf4j; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.StringUtil; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.tron.common.application.HttpService; import org.tron.core.config.args.Args; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.filter.HttpApiAccessFilter; import org.tron.core.services.filter.LiteFnQueryHttpFilter; -import org.tron.core.services.interfaceOnPBFT.http.EstimateEnergyOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAccountByIdOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAccountOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAssetIssueByIdOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAssetIssueByNameOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAssetIssueListByNameOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAssetIssueListOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetAvailableUnfreezeCountOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBandwidthPricesOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBlockByIdOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBlockByLatestNumOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBlockByLimitNextOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBlockByNumOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBrokerageOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetBurnTrxOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetCanDelegatedMaxSizeOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetCanWithdrawUnfreezeAmountOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetDelegatedResourceAccountIndexOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetDelegatedResourceAccountIndexV2OnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetDelegatedResourceOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetDelegatedResourceV2OnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetEnergyPricesOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetExchangeByIdOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMarketOrderByAccountOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMarketOrderByIdOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMarketOrderListByPairOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMarketPairListOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMarketPriceByPairOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetMerkleTreeVoucherInfoOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetNodeInfoOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetNowBlockOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetPaginatedAssetIssueListOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetRewardOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.GetTransactionCountByBlockNumOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.IsShieldedTRC20ContractNoteSpentOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.IsSpendOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ListExchangesOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ListWitnessesOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ScanAndMarkNoteByIvkOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ScanNoteByIvkOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ScanNoteByOvkOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ScanShieldedTRC20NotesByIvkOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.ScanShieldedTRC20NotesByOvkOnPBFTServlet; -import org.tron.core.services.interfaceOnPBFT.http.TriggerConstantContractOnPBFTServlet; @Slf4j(topic = "API") public class HttpApiOnPBFTService extends HttpService { @Autowired - private GetAccountOnPBFTServlet accountOnPBFTServlet; + private ApplicationContext applicationContext; - @Autowired - private GetTransactionByIdOnPBFTServlet getTransactionByIdOnPBFTServlet; - @Autowired - private GetTransactionInfoByIdOnPBFTServlet getTransactionInfoByIdOnPBFTServlet; - @Autowired - private ListWitnessesOnPBFTServlet listWitnessesOnPBFTServlet; - @Autowired - private GetAssetIssueListOnPBFTServlet getAssetIssueListOnPBFTServlet; - @Autowired - private GetPaginatedAssetIssueListOnPBFTServlet getPaginatedAssetIssueListOnPBFTServlet; - @Autowired - private GetNowBlockOnPBFTServlet getNowBlockOnPBFTServlet; - @Autowired - private GetBlockByNumOnPBFTServlet getBlockByNumOnPBFTServlet; - - @Autowired - private GetNodeInfoOnPBFTServlet getNodeInfoOnPBFTServlet; - - @Autowired - private GetDelegatedResourceOnPBFTServlet getDelegatedResourceOnPBFTServlet; - @Autowired - private GetDelegatedResourceAccountIndexOnPBFTServlet - getDelegatedResourceAccountIndexOnPBFTServlet; - @Autowired - private GetExchangeByIdOnPBFTServlet getExchangeByIdOnPBFTServlet; - @Autowired - private ListExchangesOnPBFTServlet listExchangesOnPBFTServlet; - @Autowired - private GetTransactionCountByBlockNumOnPBFTServlet - getTransactionCountByBlockNumOnPBFTServlet; - @Autowired - private GetAssetIssueByNameOnPBFTServlet getAssetIssueByNameOnPBFTServlet; - @Autowired - private GetAssetIssueByIdOnPBFTServlet getAssetIssueByIdOnPBFTServlet; - @Autowired - private GetAssetIssueListByNameOnPBFTServlet getAssetIssueListByNameOnPBFTServlet; - @Autowired - private GetAccountByIdOnPBFTServlet getAccountByIdOnPBFTServlet; - @Autowired - private GetBlockByIdOnPBFTServlet getBlockByIdOnPBFTServlet; - @Autowired - private GetBlockByLimitNextOnPBFTServlet getBlockByLimitNextOnPBFTServlet; - @Autowired - private GetBlockByLatestNumOnPBFTServlet getBlockByLatestNumOnPBFTServlet; - @Autowired - private GetMerkleTreeVoucherInfoOnPBFTServlet getMerkleTreeVoucherInfoOnPBFTServlet; - @Autowired - private ScanNoteByIvkOnPBFTServlet scanNoteByIvkOnPBFTServlet; - @Autowired - private ScanAndMarkNoteByIvkOnPBFTServlet scanAndMarkNoteByIvkOnPBFTServlet; - @Autowired - private ScanNoteByOvkOnPBFTServlet scanNoteByOvkOnPBFTServlet; - @Autowired - private IsSpendOnPBFTServlet isSpendOnPBFTServlet; - @Autowired - private GetBrokerageOnPBFTServlet getBrokerageServlet; - @Autowired - private GetRewardOnPBFTServlet getRewardServlet; - @Autowired - private TriggerConstantContractOnPBFTServlet triggerConstantContractOnPBFTServlet; - @Autowired - private EstimateEnergyOnPBFTServlet estimateEnergyOnPBFTServlet; @Autowired private LiteFnQueryHttpFilter liteFnQueryHttpFilter; @Autowired private HttpApiAccessFilter httpApiAccessFilter; - @Autowired - private GetMarketOrderByAccountOnPBFTServlet getMarketOrderByAccountOnPBFTServlet; - @Autowired - private GetMarketOrderByIdOnPBFTServlet getMarketOrderByIdOnPBFTServlet; - @Autowired - private GetMarketPriceByPairOnPBFTServlet getMarketPriceByPairOnPBFTServlet; - @Autowired - private GetMarketOrderListByPairOnPBFTServlet getMarketOrderListByPairOnPBFTServlet; - @Autowired - private GetMarketPairListOnPBFTServlet getMarketPairListOnPBFTServlet; - - @Autowired - private ScanShieldedTRC20NotesByIvkOnPBFTServlet scanShieldedTRC20NotesByIvkOnPBFTServlet; - @Autowired - private ScanShieldedTRC20NotesByOvkOnPBFTServlet scanShieldedTRC20NotesByOvkOnPBFTServlet; - @Autowired - private IsShieldedTRC20ContractNoteSpentOnPBFTServlet - isShieldedTRC20ContractNoteSpentOnPBFTServlet; - @Autowired - private GetBurnTrxOnPBFTServlet getBurnTrxOnPBFTServlet; - @Autowired - private GetBandwidthPricesOnPBFTServlet getBandwidthPricesOnPBFTServlet; - @Autowired - private GetEnergyPricesOnPBFTServlet getEnergyPricesOnPBFTServlet; - - @Autowired - private GetBlockOnPBFTServlet getBlockOnPBFTServlet; - @Autowired - private GetAvailableUnfreezeCountOnPBFTServlet getAvailableUnfreezeCountOnPBFTServlet; - @Autowired - private GetCanDelegatedMaxSizeOnPBFTServlet getCanDelegatedMaxSizeOnPBFTServlet; - @Autowired - private GetCanWithdrawUnfreezeAmountOnPBFTServlet getCanWithdrawUnfreezeAmountOnPBFTServlet; - @Autowired - private GetDelegatedResourceAccountIndexV2OnPBFTServlet - getDelegatedResourceAccountIndexV2OnPBFTServlet; - @Autowired - private GetDelegatedResourceV2OnPBFTServlet getDelegatedResourceV2OnPBFTServlet; public HttpApiOnPBFTService() { port = Args.getInstance().getPBFTHttpPort(); @@ -177,90 +39,15 @@ public HttpApiOnPBFTService() { @Override protected void addServlet(ServletContextHandler context) { - // same as FullNode - context.addServlet(new ServletHolder(accountOnPBFTServlet), "/getaccount"); - context.addServlet(new ServletHolder(listWitnessesOnPBFTServlet), "/listwitnesses"); - context.addServlet(new ServletHolder(getAssetIssueListOnPBFTServlet), "/getassetissuelist"); - context.addServlet(new ServletHolder(getPaginatedAssetIssueListOnPBFTServlet), - "/getpaginatedassetissuelist"); - context - .addServlet(new ServletHolder(getAssetIssueByNameOnPBFTServlet), "/getassetissuebyname"); - context.addServlet(new ServletHolder(getAssetIssueByIdOnPBFTServlet), "/getassetissuebyid"); - context.addServlet(new ServletHolder(getAssetIssueListByNameOnPBFTServlet), - "/getassetissuelistbyname"); - context.addServlet(new ServletHolder(getNowBlockOnPBFTServlet), "/getnowblock"); - context.addServlet(new ServletHolder(getBlockByNumOnPBFTServlet), "/getblockbynum"); - context.addServlet(new ServletHolder(getDelegatedResourceOnPBFTServlet), - "/getdelegatedresource"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexOnPBFTServlet), - "/getdelegatedresourceaccountindex"); - context.addServlet(new ServletHolder(getExchangeByIdOnPBFTServlet), "/getexchangebyid"); - context.addServlet(new ServletHolder(listExchangesOnPBFTServlet), "/listexchanges"); - context.addServlet(new ServletHolder(getAccountByIdOnPBFTServlet), "/getaccountbyid"); - context.addServlet(new ServletHolder(getBlockByIdOnPBFTServlet), "/getblockbyid"); - context - .addServlet(new ServletHolder(getBlockByLimitNextOnPBFTServlet), "/getblockbylimitnext"); - context - .addServlet(new ServletHolder(getBlockByLatestNumOnPBFTServlet), "/getblockbylatestnum"); - context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoOnPBFTServlet), - "/getmerkletreevoucherinfo"); - context.addServlet(new ServletHolder(scanAndMarkNoteByIvkOnPBFTServlet), - "/scanandmarknotebyivk"); - context.addServlet(new ServletHolder(scanNoteByIvkOnPBFTServlet), "/scannotebyivk"); - context.addServlet(new ServletHolder(scanNoteByOvkOnPBFTServlet), "/scannotebyovk"); - context.addServlet(new ServletHolder(isSpendOnPBFTServlet), "/isspend"); - context.addServlet(new ServletHolder(triggerConstantContractOnPBFTServlet), - "/triggerconstantcontract"); - context.addServlet(new ServletHolder(estimateEnergyOnPBFTServlet), "/estimateenergy"); - - // only for PBFTNode - context.addServlet(new ServletHolder(getTransactionByIdOnPBFTServlet), "/gettransactionbyid"); - context.addServlet(new ServletHolder(getTransactionInfoByIdOnPBFTServlet), - "/gettransactioninfobyid"); - - context.addServlet(new ServletHolder(getTransactionCountByBlockNumOnPBFTServlet), - "/gettransactioncountbyblocknum"); - - context.addServlet(new ServletHolder(getNodeInfoOnPBFTServlet), "/getnodeinfo"); - context.addServlet(new ServletHolder(getBrokerageServlet), "/getBrokerage"); - context.addServlet(new ServletHolder(getRewardServlet), "/getReward"); - - context.addServlet(new ServletHolder(getMarketOrderByAccountOnPBFTServlet), - "/getmarketorderbyaccount"); - context.addServlet(new ServletHolder(getMarketOrderByIdOnPBFTServlet), - "/getmarketorderbyid"); - context.addServlet(new ServletHolder(getMarketPriceByPairOnPBFTServlet), - "/getmarketpricebypair"); - context.addServlet(new ServletHolder(getMarketOrderListByPairOnPBFTServlet), - "/getmarketorderlistbypair"); - context.addServlet(new ServletHolder(getMarketPairListOnPBFTServlet), - "/getmarketpairlist"); - - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByIvkOnPBFTServlet), - "/scanshieldedtrc20notesbyivk"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByOvkOnPBFTServlet), - "/scanshieldedtrc20notesbyovk"); - context.addServlet(new ServletHolder(isShieldedTRC20ContractNoteSpentOnPBFTServlet), - "/isshieldedtrc20contractnotespent"); - context.addServlet(new ServletHolder(getBurnTrxOnPBFTServlet), - "/getburntrx"); - context.addServlet(new ServletHolder(getBandwidthPricesOnPBFTServlet), - "/getbandwidthprices"); - context.addServlet(new ServletHolder(getEnergyPricesOnPBFTServlet), - "/getenergyprices"); - context.addServlet(new ServletHolder(getBlockOnPBFTServlet), - "/getblock"); - - context.addServlet(new ServletHolder(getAvailableUnfreezeCountOnPBFTServlet), - "/getavailableunfreezecount"); - context.addServlet(new ServletHolder(getCanDelegatedMaxSizeOnPBFTServlet), - "/getcandelegatedmaxsize"); - context.addServlet(new ServletHolder(getCanWithdrawUnfreezeAmountOnPBFTServlet), - "/getcanwithdrawunfreezeamount"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexV2OnPBFTServlet), - "/getdelegatedresourceaccountindexv2"); - context.addServlet(new ServletHolder(getDelegatedResourceV2OnPBFTServlet), - "/getdelegatedresourcev2"); + applicationContext.getBeansWithAnnotation(PbftServlet.class).values() + .stream().filter(o -> o instanceof Servlet) + .map(o -> (Servlet) o) + .filter(o -> AopUtils.getTargetClass(o).isAnnotationPresent(PbftServlet.class)) + .forEach(o -> { + PbftServlet path = AopUtils.getTargetClass(o).getAnnotation(PbftServlet.class); + Arrays.stream(path.value()).filter(StringUtil::isNotBlank).forEach(p -> + context.addServlet(new ServletHolder(o), p)); + }); } @Override diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanAndMarkNoteByIvkOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanAndMarkNoteByIvkOnPBFTServlet.java index aa0d94796a0..393c9bfcb71 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanAndMarkNoteByIvkOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanAndMarkNoteByIvkOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ScanAndMarkNoteByIvkServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/scanandmarknotebyivk") @Component @Slf4j(topic = "API") public class ScanAndMarkNoteByIvkOnPBFTServlet extends ScanAndMarkNoteByIvkServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByIvkOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByIvkOnPBFTServlet.java index 6382c0f4cf6..cd765036b58 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByIvkOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByIvkOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ScanNoteByIvkServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/scannotebyivk") @Component @Slf4j(topic = "API") public class ScanNoteByIvkOnPBFTServlet extends ScanNoteByIvkServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByOvkOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByOvkOnPBFTServlet.java index e05445c0c66..5c80c8aa98d 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByOvkOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanNoteByOvkOnPBFTServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ScanNoteByOvkServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/scannotebyovk") @Component @Slf4j(topic = "API") public class ScanNoteByOvkOnPBFTServlet extends ScanNoteByOvkServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByIvkOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByIvkOnPBFTServlet.java index bf0b70a3a9b..6202be2a0f1 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByIvkOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByIvkOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ScanShieldedTRC20NotesByIvkServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/scanshieldedtrc20notesbyivk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByIvkOnPBFTServlet extends ScanShieldedTRC20NotesByIvkServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByOvkOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByOvkOnPBFTServlet.java index 2bc65ef27c4..2e5c7cc7b10 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByOvkOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/ScanShieldedTRC20NotesByOvkOnPBFTServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.ScanShieldedTRC20NotesByOvkServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/scanshieldedtrc20notesbyovk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByOvkOnPBFTServlet extends ScanShieldedTRC20NotesByOvkServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/TriggerConstantContractOnPBFTServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/TriggerConstantContractOnPBFTServlet.java index 2859326464d..53c690b75a4 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/TriggerConstantContractOnPBFTServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnPBFT/http/TriggerConstantContractOnPBFTServlet.java @@ -6,10 +6,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.PbftServlet; import org.tron.core.services.http.TriggerConstantContractServlet; import org.tron.core.services.interfaceOnPBFT.WalletOnPBFT; +@PbftServlet("/triggerconstantcontract") @Component @Slf4j(topic = "API") public class TriggerConstantContractOnPBFTServlet extends TriggerConstantContractServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/EstimateEnergyOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/EstimateEnergyOnSolidityServlet.java index e9e403c776b..db7601868a5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/EstimateEnergyOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/EstimateEnergyOnSolidityServlet.java @@ -6,10 +6,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.EstimateEnergyServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/estimateenergy") @Component @Slf4j(topic = "API") public class EstimateEnergyOnSolidityServlet extends EstimateEnergyServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountByIdOnSolidityServlet.java index ce47e679d0a..b33c46544c0 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountByIdOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAccountByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getaccountbyid") @Component @Slf4j(topic = "API") public class GetAccountByIdOnSolidityServlet extends GetAccountByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountOnSolidityServlet.java index 1cb02b77336..64e5a4351b5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAccountOnSolidityServlet.java @@ -5,10 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAccountServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; - +@SolidityServlet("/walletsolidity/getaccount") @Component @Slf4j(topic = "API") public class GetAccountOnSolidityServlet extends GetAccountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByIdOnSolidityServlet.java index f3173972407..251f67f48ce 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByIdOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAssetIssueByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getassetissuebyid") @Component @Slf4j(topic = "API") public class GetAssetIssueByIdOnSolidityServlet extends GetAssetIssueByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByNameOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByNameOnSolidityServlet.java index 101e0f1e4ae..fd3bb34d3d0 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByNameOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueByNameOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAssetIssueByNameServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getassetissuebyname") @Component @Slf4j(topic = "API") public class GetAssetIssueByNameOnSolidityServlet extends GetAssetIssueByNameServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListByNameOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListByNameOnSolidityServlet.java index d21cc9c940d..6bf815cb084 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListByNameOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListByNameOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAssetIssueListByNameServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getassetissuelistbyname") @Component @Slf4j(topic = "API") public class GetAssetIssueListByNameOnSolidityServlet extends GetAssetIssueListByNameServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListOnSolidityServlet.java index 76a2e70d70c..e9071103758 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAssetIssueListOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAssetIssueListServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getassetissuelist") @Component @Slf4j(topic = "API") public class GetAssetIssueListOnSolidityServlet extends GetAssetIssueListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAvailableUnfreezeCountOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAvailableUnfreezeCountOnSolidityServlet.java index 218164fffb0..66a7a5cab71 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAvailableUnfreezeCountOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetAvailableUnfreezeCountOnSolidityServlet.java @@ -6,9 +6,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetAvailableUnfreezeCountServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getavailableunfreezecount") @Component @Slf4j(topic = "API") public class GetAvailableUnfreezeCountOnSolidityServlet extends GetAvailableUnfreezeCountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBandwidthPricesOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBandwidthPricesOnSolidityServlet.java index bb2fca37a97..c6c469f7782 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBandwidthPricesOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBandwidthPricesOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBandwidthPricesServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getbandwidthprices") @Component @Slf4j(topic = "API") public class GetBandwidthPricesOnSolidityServlet extends GetBandwidthPricesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByIdOnSolidityServlet.java index 16192e2f484..94ea8898e51 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByIdOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBlockByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getblockbyid") @Component @Slf4j(topic = "API") public class GetBlockByIdOnSolidityServlet extends GetBlockByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLatestNumOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLatestNumOnSolidityServlet.java index 34b5f37dcf5..b5bbec3ff65 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLatestNumOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLatestNumOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBlockByLatestNumServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getblockbylatestnum") @Component @Slf4j(topic = "API") public class GetBlockByLatestNumOnSolidityServlet extends GetBlockByLatestNumServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLimitNextOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLimitNextOnSolidityServlet.java index 36de59a9e7e..153ae6a212f 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLimitNextOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByLimitNextOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBlockByLimitNextServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getblockbylimitnext") @Component @Slf4j(topic = "API") public class GetBlockByLimitNextOnSolidityServlet extends GetBlockByLimitNextServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByNumOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByNumOnSolidityServlet.java index e79da51ee7b..50abc9c38d5 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByNumOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockByNumOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBlockByNumServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getblockbynum") @Component @Slf4j(topic = "API") public class GetBlockByNumOnSolidityServlet extends GetBlockByNumServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockOnSolidityServlet.java index e00f8e91e62..a06dcfd2a65 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBlockOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBlockServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getblock") @Component @Slf4j(topic = "API") public class GetBlockOnSolidityServlet extends GetBlockServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBrokerageOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBrokerageOnSolidityServlet.java index b6b6a9ca993..abb00938143 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBrokerageOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBrokerageOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBrokerageServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getBrokerage") @Component @Slf4j(topic = "API") public class GetBrokerageOnSolidityServlet extends GetBrokerageServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBurnTrxOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBurnTrxOnSolidityServlet.java index 46435a92668..2fe31b954e0 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBurnTrxOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetBurnTrxOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetBurnTrxServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getburntrx") @Component @Slf4j(topic = "API") public class GetBurnTrxOnSolidityServlet extends GetBurnTrxServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanDelegatedMaxSizeOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanDelegatedMaxSizeOnSolidityServlet.java index f2a2fb394e4..372cb1111d8 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanDelegatedMaxSizeOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanDelegatedMaxSizeOnSolidityServlet.java @@ -6,9 +6,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetCanDelegatedMaxSizeServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getcandelegatedmaxsize") @Component @Slf4j(topic = "API") public class GetCanDelegatedMaxSizeOnSolidityServlet extends GetCanDelegatedMaxSizeServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanWithdrawUnfreezeAmountOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanWithdrawUnfreezeAmountOnSolidityServlet.java index 3f0b487fbe6..a9fffbbcc09 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanWithdrawUnfreezeAmountOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetCanWithdrawUnfreezeAmountOnSolidityServlet.java @@ -6,9 +6,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetCanWithdrawUnfreezeAmountServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getcanwithdrawunfreezeamount") @Component @Slf4j(topic = "API") public class GetCanWithdrawUnfreezeAmountOnSolidityServlet diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexOnSolidityServlet.java index 1ad23e35a2a..a79bd04d4e2 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetDelegatedResourceAccountIndexServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getdelegatedresourceaccountindex") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexV2OnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexV2OnSolidityServlet.java index edfaaf56c8b..cc4bbf505cd 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexV2OnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceAccountIndexV2OnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetDelegatedResourceAccountIndexV2Servlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getdelegatedresourceaccountindexv2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceAccountIndexV2OnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceOnSolidityServlet.java index c5a5cc9cb64..9c8aaf667a3 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceOnSolidityServlet.java @@ -6,9 +6,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetDelegatedResourceServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getdelegatedresource") @Component @Slf4j(topic = "API") public class GetDelegatedResourceOnSolidityServlet extends GetDelegatedResourceServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceV2OnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceV2OnSolidityServlet.java index f481def86ea..283b7a120e4 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceV2OnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetDelegatedResourceV2OnSolidityServlet.java @@ -6,9 +6,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.tron.core.Wallet; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetDelegatedResourceV2Servlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getdelegatedresourcev2") @Component @Slf4j(topic = "API") public class GetDelegatedResourceV2OnSolidityServlet extends GetDelegatedResourceV2Servlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetEnergyPricesOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetEnergyPricesOnSolidityServlet.java index a867fc3596a..98701a6e891 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetEnergyPricesOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetEnergyPricesOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetEnergyPricesServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getenergyprices") @Component @Slf4j(topic = "API") public class GetEnergyPricesOnSolidityServlet extends GetEnergyPricesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetExchangeByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetExchangeByIdOnSolidityServlet.java index 1da31a0674b..8b0f84a38d8 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetExchangeByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetExchangeByIdOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetExchangeByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getexchangebyid") @Component @Slf4j(topic = "API") public class GetExchangeByIdOnSolidityServlet extends GetExchangeByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByAccountOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByAccountOnSolidityServlet.java index 0f77006c867..b4be1fe0b5d 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByAccountOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByAccountOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetMarketOrderByAccountServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getmarketorderbyaccount") @Component @Slf4j(topic = "API") public class GetMarketOrderByAccountOnSolidityServlet extends GetMarketOrderByAccountServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByIdOnSolidityServlet.java index 5956a638573..9ac9215de50 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderByIdOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetMarketOrderByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getmarketorderbyid") @Component @Slf4j(topic = "API") public class GetMarketOrderByIdOnSolidityServlet extends GetMarketOrderByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderListByPairOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderListByPairOnSolidityServlet.java index 8452accc3d3..f45387305db 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderListByPairOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketOrderListByPairOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetMarketOrderListByPairServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getmarketorderlistbypair") @Component @Slf4j(topic = "API") public class GetMarketOrderListByPairOnSolidityServlet extends GetMarketOrderListByPairServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPairListOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPairListOnSolidityServlet.java index b0ee51fec1e..871ab5e80ec 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPairListOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPairListOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetMarketPairListServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getmarketpairlist") @Component @Slf4j(topic = "API") public class GetMarketPairListOnSolidityServlet extends GetMarketPairListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPriceByPairOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPriceByPairOnSolidityServlet.java index ceccf215b19..bcb404d3cee 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPriceByPairOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetMarketPriceByPairOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetMarketPriceByPairServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getmarketpricebypair") @Component @Slf4j(topic = "API") public class GetMarketPriceByPairOnSolidityServlet extends GetMarketPriceByPairServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNodeInfoOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNodeInfoOnSolidityServlet.java index ec16a010632..e8a4ad4f1ab 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNodeInfoOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNodeInfoOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetNodeInfoServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet({"/walletsolidity/getnodeinfo", "/wallet/getnodeinfo"}) @Component @Slf4j(topic = "API") public class GetNodeInfoOnSolidityServlet extends GetNodeInfoServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNowBlockOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNowBlockOnSolidityServlet.java index e888e8a5101..3bbc727f662 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNowBlockOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetNowBlockOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetNowBlockServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getnowblock") @Component @Slf4j(topic = "API") public class GetNowBlockOnSolidityServlet extends GetNowBlockServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetPaginatedAssetIssueListOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetPaginatedAssetIssueListOnSolidityServlet.java index fcb5ff90842..98a5fbbcf1f 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetPaginatedAssetIssueListOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetPaginatedAssetIssueListOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetPaginatedAssetIssueListServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getpaginatedassetissuelist") @Component @Slf4j(topic = "API") public class GetPaginatedAssetIssueListOnSolidityServlet extends GetPaginatedAssetIssueListServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetRewardOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetRewardOnSolidityServlet.java index f125557d1bf..351d77d271c 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetRewardOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetRewardOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetRewardServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/getReward") @Component @Slf4j(topic = "API") public class GetRewardOnSolidityServlet extends GetRewardServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionCountByBlockNumOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionCountByBlockNumOnSolidityServlet.java index 10e5d5a9b29..5c58197c62d 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionCountByBlockNumOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionCountByBlockNumOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetTransactionCountByBlockNumServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/gettransactioncountbyblocknum") @Component @Slf4j(topic = "API") public class GetTransactionCountByBlockNumOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionInfoByBlockNumOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionInfoByBlockNumOnSolidityServlet.java index 40e88afa1e0..a5470e45a8c 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionInfoByBlockNumOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/GetTransactionInfoByBlockNumOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetTransactionInfoByBlockNumServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/gettransactioninfobyblocknum") @Component @Slf4j(topic = "API") public class GetTransactionInfoByBlockNumOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/IsShieldedTRC20ContractNoteSpentOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/IsShieldedTRC20ContractNoteSpentOnSolidityServlet.java index 12055c2db8b..c0302ee087b 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/IsShieldedTRC20ContractNoteSpentOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/IsShieldedTRC20ContractNoteSpentOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.IsShieldedTRC20ContractNoteSpentServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/isshieldedtrc20contractnotespent") @Component @Slf4j(topic = "API") public class IsShieldedTRC20ContractNoteSpentOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListExchangesOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListExchangesOnSolidityServlet.java index 87fc546913d..6eb4a1f7b2d 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListExchangesOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListExchangesOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.ListExchangesServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/listexchanges") @Component @Slf4j(topic = "API") public class ListExchangesOnSolidityServlet extends ListExchangesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListWitnessesOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListWitnessesOnSolidityServlet.java index 9025b360d0d..817313e27fa 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListWitnessesOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ListWitnessesOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.ListWitnessesServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/listwitnesses") @Component @Slf4j(topic = "API") public class ListWitnessesOnSolidityServlet extends ListWitnessesServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByIvkOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByIvkOnSolidityServlet.java index 19a8d545502..4b40e8b5c42 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByIvkOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByIvkOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.ScanShieldedTRC20NotesByIvkServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/scanshieldedtrc20notesbyivk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByIvkOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByOvkOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByOvkOnSolidityServlet.java index 30055b41a90..bf36ce0ede4 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByOvkOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/ScanShieldedTRC20NotesByOvkOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.ScanShieldedTRC20NotesByOvkServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/scanshieldedtrc20notesbyovk") @Component @Slf4j(topic = "API") public class ScanShieldedTRC20NotesByOvkOnSolidityServlet extends diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/TriggerConstantContractOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/TriggerConstantContractOnSolidityServlet.java index 75f602272b4..7a0ac33729e 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/TriggerConstantContractOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/TriggerConstantContractOnSolidityServlet.java @@ -6,10 +6,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.TriggerConstantContractServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/triggerconstantcontract") @Component @Slf4j(topic = "API") public class TriggerConstantContractOnSolidityServlet extends TriggerConstantContractServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionByIdOnSolidityServlet.java index db56a4cc1f1..7f4eafc3902 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionByIdOnSolidityServlet.java @@ -5,9 +5,11 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetTransactionByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/gettransactionbyid") @Component @Slf4j(topic = "API") public class GetTransactionByIdOnSolidityServlet extends GetTransactionByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionInfoByIdOnSolidityServlet.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionInfoByIdOnSolidityServlet.java index 96422e1b60f..bbb79648144 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionInfoByIdOnSolidityServlet.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/GetTransactionInfoByIdOnSolidityServlet.java @@ -5,10 +5,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.http.GetTransactionInfoByIdServlet; import org.tron.core.services.interfaceOnSolidity.WalletOnSolidity; +@SolidityServlet("/walletsolidity/gettransactioninfobyid") @Component @Slf4j(topic = "API") public class GetTransactionInfoByIdOnSolidityServlet extends GetTransactionInfoByIdServlet { diff --git a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/HttpApiOnSolidityService.java b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/HttpApiOnSolidityService.java index b1d940ce2cd..4e3e5cd1013 100644 --- a/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/HttpApiOnSolidityService.java +++ b/framework/src/main/java/org/tron/core/services/interfaceOnSolidity/http/solidity/HttpApiOnSolidityService.java @@ -1,172 +1,28 @@ package org.tron.core.services.interfaceOnSolidity.http.solidity; +import java.util.Arrays; import java.util.EnumSet; import javax.servlet.DispatcherType; +import javax.servlet.Servlet; import lombok.extern.slf4j.Slf4j; -import org.eclipse.jetty.server.ConnectionLimit; -import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.FilterHolder; import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.StringUtil; +import org.springframework.aop.support.AopUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; import org.tron.common.application.HttpService; import org.tron.core.config.args.Args; +import org.tron.core.services.annotation.SolidityServlet; import org.tron.core.services.filter.HttpApiAccessFilter; import org.tron.core.services.filter.LiteFnQueryHttpFilter; -import org.tron.core.services.interfaceOnSolidity.http.EstimateEnergyOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAccountByIdOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAccountOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByIdOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueByNameOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListByNameOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAssetIssueListOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetAvailableUnfreezeCountOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBandwidthPricesOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBlockByIdOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLatestNumOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBlockByLimitNextOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBlockByNumOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBlockOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBrokerageOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetBurnTrxOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetCanDelegatedMaxSizeOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetCanWithdrawUnfreezeAmountOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceAccountIndexV2OnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetDelegatedResourceV2OnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetEnergyPricesOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetExchangeByIdOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMarketOrderByAccountOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMarketOrderByIdOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMarketOrderListByPairOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMarketPairListOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMarketPriceByPairOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetMerkleTreeVoucherInfoOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetNodeInfoOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetNowBlockOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetPaginatedAssetIssueListOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetRewardOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetTransactionCountByBlockNumOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.GetTransactionInfoByBlockNumOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.IsShieldedTRC20ContractNoteSpentOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.IsSpendOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ListExchangesOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ListWitnessesOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ScanAndMarkNoteByIvkOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByIvkOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ScanNoteByOvkOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ScanShieldedTRC20NotesByIvkOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.ScanShieldedTRC20NotesByOvkOnSolidityServlet; -import org.tron.core.services.interfaceOnSolidity.http.TriggerConstantContractOnSolidityServlet; - @Slf4j(topic = "API") public class HttpApiOnSolidityService extends HttpService { @Autowired - private GetAccountOnSolidityServlet accountOnSolidityServlet; - - @Autowired - private GetTransactionByIdOnSolidityServlet getTransactionByIdOnSolidityServlet; - @Autowired - private GetTransactionInfoByIdOnSolidityServlet getTransactionInfoByIdOnSolidityServlet; - @Autowired - private ListWitnessesOnSolidityServlet listWitnessesOnSolidityServlet; - @Autowired - private GetAssetIssueListOnSolidityServlet getAssetIssueListOnSolidityServlet; - @Autowired - private GetPaginatedAssetIssueListOnSolidityServlet getPaginatedAssetIssueListOnSolidityServlet; - @Autowired - private GetNowBlockOnSolidityServlet getNowBlockOnSolidityServlet; - @Autowired - private GetBlockByNumOnSolidityServlet getBlockByNumOnSolidityServlet; - - @Autowired - private GetNodeInfoOnSolidityServlet getNodeInfoOnSolidityServlet; - - @Autowired - private GetDelegatedResourceOnSolidityServlet getDelegatedResourceOnSolidityServlet; - @Autowired - private GetDelegatedResourceV2OnSolidityServlet getDelegatedResourceV2OnSolidityServlet; - @Autowired - private GetCanDelegatedMaxSizeOnSolidityServlet getCanDelegatedMaxSizeOnSolidityServlet; - @Autowired - private GetAvailableUnfreezeCountOnSolidityServlet getAvailableUnfreezeCountOnSolidityServlet; - @Autowired - private GetCanWithdrawUnfreezeAmountOnSolidityServlet - getCanWithdrawUnfreezeAmountOnSolidityServlet; - @Autowired - private GetDelegatedResourceAccountIndexOnSolidityServlet - getDelegatedResourceAccountIndexOnSolidityServlet; - @Autowired - private GetDelegatedResourceAccountIndexV2OnSolidityServlet - getDelegatedResourceAccountIndexV2OnSolidityServlet; - @Autowired - private GetExchangeByIdOnSolidityServlet getExchangeByIdOnSolidityServlet; - @Autowired - private ListExchangesOnSolidityServlet listExchangesOnSolidityServlet; - @Autowired - private GetTransactionCountByBlockNumOnSolidityServlet - getTransactionCountByBlockNumOnSolidityServlet; - @Autowired - private GetAssetIssueByNameOnSolidityServlet getAssetIssueByNameOnSolidityServlet; - @Autowired - private GetAssetIssueByIdOnSolidityServlet getAssetIssueByIdOnSolidityServlet; - @Autowired - private GetAssetIssueListByNameOnSolidityServlet getAssetIssueListByNameOnSolidityServlet; - @Autowired - private GetAccountByIdOnSolidityServlet getAccountByIdOnSolidityServlet; - @Autowired - private GetBlockByIdOnSolidityServlet getBlockByIdOnSolidityServlet; - @Autowired - private GetBlockByLimitNextOnSolidityServlet getBlockByLimitNextOnSolidityServlet; - @Autowired - private GetBlockByLatestNumOnSolidityServlet getBlockByLatestNumOnSolidityServlet; - @Autowired - private GetMerkleTreeVoucherInfoOnSolidityServlet getMerkleTreeVoucherInfoOnSolidityServlet; - @Autowired - private ScanNoteByIvkOnSolidityServlet scanNoteByIvkOnSolidityServlet; - @Autowired - private ScanAndMarkNoteByIvkOnSolidityServlet scanAndMarkNoteByIvkOnSolidityServlet; - @Autowired - private ScanNoteByOvkOnSolidityServlet scanNoteByOvkOnSolidityServlet; - @Autowired - private IsSpendOnSolidityServlet isSpendOnSolidityServlet; - @Autowired - private ScanShieldedTRC20NotesByIvkOnSolidityServlet scanShieldedTRC20NotesByIvkOnSolidityServlet; - @Autowired - private ScanShieldedTRC20NotesByOvkOnSolidityServlet scanShieldedTRC20NotesByOvkOnSolidityServlet; - @Autowired - private IsShieldedTRC20ContractNoteSpentOnSolidityServlet - isShieldedTRC20ContractNoteSpentOnSolidityServlet; - @Autowired - private GetBrokerageOnSolidityServlet getBrokerageServlet; - @Autowired - private GetRewardOnSolidityServlet getRewardServlet; - @Autowired - private GetBurnTrxOnSolidityServlet getBurnTrxOnSolidityServlet; - @Autowired - private TriggerConstantContractOnSolidityServlet triggerConstantContractOnSolidityServlet; - @Autowired - private EstimateEnergyOnSolidityServlet estimateEnergyOnSolidityServlet; - @Autowired - private GetTransactionInfoByBlockNumOnSolidityServlet - getTransactionInfoByBlockNumOnSolidityServlet; - @Autowired - private GetMarketOrderByAccountOnSolidityServlet getMarketOrderByAccountOnSolidityServlet; - @Autowired - private GetMarketOrderByIdOnSolidityServlet getMarketOrderByIdOnSolidityServlet; - @Autowired - private GetMarketPriceByPairOnSolidityServlet getMarketPriceByPairOnSolidityServlet; - @Autowired - private GetMarketOrderListByPairOnSolidityServlet getMarketOrderListByPairOnSolidityServlet; - @Autowired - private GetMarketPairListOnSolidityServlet getMarketPairListOnSolidityServlet; - @Autowired - private GetBandwidthPricesOnSolidityServlet getBandwidthPricesOnSolidityServlet; - @Autowired - private GetEnergyPricesOnSolidityServlet getEnergyPricesOnSolidityServlet; + private ApplicationContext applicationContext; @Autowired private LiteFnQueryHttpFilter liteFnQueryHttpFilter; @@ -174,9 +30,6 @@ public class HttpApiOnSolidityService extends HttpService { @Autowired private HttpApiAccessFilter httpApiAccessFilter; - @Autowired - private GetBlockOnSolidityServlet getBlockOnSolidityServlet; - public HttpApiOnSolidityService() { port = Args.getInstance().getSolidityHttpPort(); enable = isFullNode() && Args.getInstance().isSolidityNodeHttpEnable(); @@ -185,106 +38,16 @@ public HttpApiOnSolidityService() { @Override protected void addServlet(ServletContextHandler context) { - // same as FullNode - context.addServlet(new ServletHolder(accountOnSolidityServlet), "/walletsolidity/getaccount"); - context.addServlet(new ServletHolder(listWitnessesOnSolidityServlet), - "/walletsolidity/listwitnesses"); - context.addServlet(new ServletHolder(getAssetIssueListOnSolidityServlet), - "/walletsolidity/getassetissuelist"); - context.addServlet(new ServletHolder(getPaginatedAssetIssueListOnSolidityServlet), - "/walletsolidity/getpaginatedassetissuelist"); - context.addServlet(new ServletHolder(getAssetIssueByNameOnSolidityServlet), - "/walletsolidity/getassetissuebyname"); - context.addServlet(new ServletHolder(getAssetIssueByIdOnSolidityServlet), - "/walletsolidity/getassetissuebyid"); - context.addServlet(new ServletHolder(getAssetIssueListByNameOnSolidityServlet), - "/walletsolidity/getassetissuelistbyname"); - context.addServlet(new ServletHolder(getNowBlockOnSolidityServlet), - "/walletsolidity/getnowblock"); - context.addServlet(new ServletHolder(getBlockByNumOnSolidityServlet), - "/walletsolidity/getblockbynum"); - context.addServlet(new ServletHolder(getDelegatedResourceOnSolidityServlet), - "/walletsolidity/getdelegatedresource"); - context.addServlet(new ServletHolder(getDelegatedResourceV2OnSolidityServlet), - "/walletsolidity/getdelegatedresourcev2"); - context.addServlet(new ServletHolder(getCanDelegatedMaxSizeOnSolidityServlet), - "/walletsolidity/getcandelegatedmaxsize"); - context.addServlet(new ServletHolder(getAvailableUnfreezeCountOnSolidityServlet), - "/walletsolidity/getavailableunfreezecount"); - context.addServlet(new ServletHolder(getCanWithdrawUnfreezeAmountOnSolidityServlet), - "/walletsolidity/getcanwithdrawunfreezeamount"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexOnSolidityServlet), - "/walletsolidity/getdelegatedresourceaccountindex"); - context.addServlet(new ServletHolder(getDelegatedResourceAccountIndexV2OnSolidityServlet), - "/walletsolidity/getdelegatedresourceaccountindexv2"); - context.addServlet(new ServletHolder(getExchangeByIdOnSolidityServlet), - "/walletsolidity/getexchangebyid"); - context.addServlet(new ServletHolder(listExchangesOnSolidityServlet), - "/walletsolidity/listexchanges"); - context.addServlet(new ServletHolder(getAccountByIdOnSolidityServlet), - "/walletsolidity/getaccountbyid"); - context.addServlet(new ServletHolder(getBlockByIdOnSolidityServlet), - "/walletsolidity/getblockbyid"); - context.addServlet(new ServletHolder(getBlockByLimitNextOnSolidityServlet), - "/walletsolidity/getblockbylimitnext"); - context.addServlet(new ServletHolder(getBlockByLatestNumOnSolidityServlet), - "/walletsolidity/getblockbylatestnum"); - // context.addServlet(new ServletHolder(getMerkleTreeVoucherInfoOnSolidityServlet), - // "/walletsolidity/getmerkletreevoucherinfo"); - // context.addServlet(new ServletHolder(scanAndMarkNoteByIvkOnSolidityServlet), - // "/walletsolidity/scanandmarknotebyivk"); - // context.addServlet(new ServletHolder(scanNoteByIvkOnSolidityServlet), - // "/walletsolidity/scannotebyivk"); - // context.addServlet(new ServletHolder(scanNoteByOvkOnSolidityServlet), - // "/walletsolidity/scannotebyovk"); - // context.addServlet(new ServletHolder(isSpendOnSolidityServlet), - // "/walletsolidity/isspend"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByIvkOnSolidityServlet), - "/walletsolidity/scanshieldedtrc20notesbyivk"); - context.addServlet(new ServletHolder(scanShieldedTRC20NotesByOvkOnSolidityServlet), - "/walletsolidity/scanshieldedtrc20notesbyovk"); - context.addServlet(new ServletHolder(isShieldedTRC20ContractNoteSpentOnSolidityServlet), - "/walletsolidity/isshieldedtrc20contractnotespent"); - context.addServlet(new ServletHolder(triggerConstantContractOnSolidityServlet), - "/walletsolidity/triggerconstantcontract"); - context.addServlet(new ServletHolder(estimateEnergyOnSolidityServlet), - "/walletsolidity/estimateenergy"); - context.addServlet(new ServletHolder(getTransactionInfoByBlockNumOnSolidityServlet), - "/walletsolidity/gettransactioninfobyblocknum"); - context.addServlet(new ServletHolder(getMarketOrderByAccountOnSolidityServlet), - "/walletsolidity/getmarketorderbyaccount"); - context.addServlet(new ServletHolder(getMarketOrderByIdOnSolidityServlet), - "/walletsolidity/getmarketorderbyid"); - context.addServlet(new ServletHolder(getMarketPriceByPairOnSolidityServlet), - "/walletsolidity/getmarketpricebypair"); - context.addServlet(new ServletHolder(getMarketOrderListByPairOnSolidityServlet), - "/walletsolidity/getmarketorderlistbypair"); - context.addServlet(new ServletHolder(getMarketPairListOnSolidityServlet), - "/walletsolidity/getmarketpairlist"); - - // only for SolidityNode - context.addServlet(new ServletHolder(getTransactionByIdOnSolidityServlet), - "/walletsolidity/gettransactionbyid"); - context.addServlet(new ServletHolder(getTransactionInfoByIdOnSolidityServlet), - "/walletsolidity/gettransactioninfobyid"); - - context.addServlet(new ServletHolder(getTransactionCountByBlockNumOnSolidityServlet), - "/walletsolidity/gettransactioncountbyblocknum"); - - context.addServlet(new ServletHolder(getNodeInfoOnSolidityServlet), "/wallet/getnodeinfo"); - context.addServlet(new ServletHolder(getNodeInfoOnSolidityServlet), - "/walletsolidity/getnodeinfo"); - context.addServlet(new ServletHolder(getBrokerageServlet), "/walletsolidity/getBrokerage"); - context.addServlet(new ServletHolder(getRewardServlet), "/walletsolidity/getReward"); - context - .addServlet(new ServletHolder(getBurnTrxOnSolidityServlet), "/walletsolidity/getburntrx"); - context.addServlet(new ServletHolder(getBandwidthPricesOnSolidityServlet), - "/walletsolidity/getbandwidthprices"); - context.addServlet(new ServletHolder(getEnergyPricesOnSolidityServlet), - "/walletsolidity/getenergyprices"); - - context.addServlet(new ServletHolder(getBlockOnSolidityServlet), - "/walletsolidity/getblock"); + applicationContext.getBeansWithAnnotation(SolidityServlet.class).values() + .stream().filter(o -> o instanceof Servlet) + .map(o -> (Servlet) o) + .filter(o -> AopUtils.getTargetClass(o).isAnnotationPresent(SolidityServlet.class)) + .forEach(o -> { + SolidityServlet path = AopUtils.getTargetClass(o) + .getAnnotation(SolidityServlet.class); + Arrays.stream(path.value()).filter(StringUtil::isNotBlank).forEach(p -> + context.addServlet(new ServletHolder(o), p)); + }); }