You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "tom055 (via GitHub)" <gi...@apache.org> on 2024/10/29 06:59:13 UTC

[I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

tom055 opened a new issue, #14838:
URL: https://github.com/apache/dubbo/issues/14838

   ### Pre-check
   
   - [X] I am sure that all the content I provide is in English.
   
   
   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache Dubbo Component
   
   Java SDK (apache/dubbo)
   
   ### Dubbo Version
   
   Dubbo java 2.7.22
   
   
   ### Steps to reproduce this issue
   
   @DubboReference(version = "1.0.0",
               retries = 0,
               timeout=5000,
               parameters = {"responseFilter=true","securityFilter=false"},
               loadbalance = "roundrobin",
               check = false,
               cluster="failsafe",
               protocol = "dubbo",
               mock = "com.tiny.notify.api.mock.NotifyServiceApiMock")
   
   I want to pass some parameters from the parameter to the provider, so that the consumer can obtain custom parameter keys and value values, but the provider cannot obtain these parameters from the URL
   
   ### What you expected to happen
   
   Did the built-in interceptor filter out my custom URL parameters?
   Looking forward to your reply. Thank you very much
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit a pull request to fix on your own?
   
   - [X] Yes I am willing to submit a pull request on my own!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

Posted by "tom055 (via GitHub)" <gi...@apache.org>.
tom055 commented on issue #14838:
URL: https://github.com/apache/dubbo/issues/14838#issuecomment-2445698677

   I only want to obtain the parameters of the URL in the provider's interception. Currently, I am unable to obtain custom parameters (responsiveFilter) in the provider's interception, but I can obtain them in the consumer's interception. Is there a problem? I am looking forward to your reply very much
   
   CONSUMER
   ```
   @DubboReference(version = "1.0.0",
               retries = 0,
               timeout=5000,
               parameters = {"responseFilter", "true", "securityFilter", "false"},
               loadbalance = "roundrobin",
               check = false,
               cluster="failsafe",
               protocol = "dubbo",
               mock = "com.device.notify.api.mock.NotifyServiceApiMock")
       NotifyServiceApi notifyServiceApi;
   ```
   
   PROVIDER
   ```
   @Activate(group = {CommonConstants.PROVIDER})
   public class SecurityFilter extends ListenableFilter {
   
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
       String responseFilter = url.getParameter("responseFilter");
       return invoker.invoke(invocation);
     }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

Posted by "wcy666103 (via GitHub)" <gi...@apache.org>.
wcy666103 commented on issue #14838:
URL: https://github.com/apache/dubbo/issues/14838#issuecomment-2445928007

   > I only want to obtain the parameters of the URL in the provider's interception. Currently, I am unable to obtain custom parameters (securityFilter) in the provider's interception, but I can obtain them in the consumer's interception. Is there a problem? I am looking forward to your reply very much
   > 
   > CONSUMER
   > 
   > ```
   > @DubboReference(version = "1.0.0",
   >             retries = 0,
   >             timeout=5000,
   >             parameters = {"securityFilter", "false","responseFilter", "true"},
   >             loadbalance = "roundrobin",
   >             check = false,
   >             cluster="failsafe",
   >             protocol = "dubbo",
   >             mock = "com.device.notify.api.mock.NotifyServiceApiMock")
   >     NotifyServiceApi notifyServiceApi;
   > ```
   > 
   > PROVIDER
   > 
   > ```
   > @Activate(group = {CommonConstants.PROVIDER})
   > public class SecurityFilter extends ListenableFilter {
   > 
   >   @Override
   >   public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
   >     String securityFilter= invoker.getUrl().getParameter("securityFilter");//value is NULL
   >     return invoker.invoke(invocation);
   >   }
   > }
   > ```
   
   I hope this helps you  https://dubbo.apache.org/zh-cn/overview/tasks/develop/context


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

Posted by "AlbumenJ (via GitHub)" <gi...@apache.org>.
AlbumenJ commented on issue #14838:
URL: https://github.com/apache/dubbo/issues/14838#issuecomment-2445680618

   Have you tried with `parameters = {"responseFilter", "true", "securityFilter", "false"}`?
   
   Also, can't you get the value by `invoker.getUrl().getParameter("responseFilter")`?
   
   BTW, configuring `xxxFilter` with `true` or `false` in `parameters` cannot enable or disable a certain `Filter`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

Posted by "tom055 (via GitHub)" <gi...@apache.org>.
tom055 commented on issue #14838:
URL: https://github.com/apache/dubbo/issues/14838#issuecomment-2445695743

   I only want to obtain the parameters of the URL in the provider's interception. Currently, I am unable to obtain custom parameters (responsiveFilter) in the provider's interception, but I can obtain them in the consumer's interception. Is there a problem? I am looking forward to your reply very much
   ```
   @Activate(group = {CommonConstants.PROVIDER})
   public class SecurityFilter extends ListenableFilter {
   
     @Override
     public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
       String responseFilter = url.getParameter("responseFilter");
       return invoker.invoke(invocation);
     }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [I] [Bug] The provider is unable to obtain custom URL parameters [dubbo]

Posted by "DeepMagic1126 (via GitHub)" <gi...@apache.org>.
DeepMagic1126 commented on issue #14838:
URL: https://github.com/apache/dubbo/issues/14838#issuecomment-2710084056

   @DubboReference's parameters will subscribe in registry  (like /dubbo/[ProviderPath]/consumers in zookeeper).When consumers invoker provider proxy ,this data will not add to RpcInvocation attachments , so org.apache.dubbo.rpc.Filter's implementation class can't get this data . I hope what I said is correct.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org