You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/08 13:28:27 UTC

[GitHub] [apisix-java-plugin-runner] bnyte opened a new issue #111: why my filter skip it

bnyte opened a new issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111


   ### Issue description
   
   - this is error log
   
   ![image](https://user-images.githubusercontent.com/75556346/148645835-d708c655-e9b2-482c-a28a-ea104fa9bf4c.png)
   
    - my filter code
   
   ```
   package org.apache.apisix.plugin.runner.filter;
   
   import com.google.gson.Gson;
   import org.apache.apisix.plugin.runner.HttpRequest;
   import org.apache.apisix.plugin.runner.HttpResponse;
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   import org.springframework.stereotype.Component;
   
   import java.util.HashMap;
   import java.util.List;
   import java.util.Map;
   
   @Component
   public class AuthPluginFilter implements PluginFilter {
   
       private static final Logger LOGGER = LoggerFactory.getLogger(AuthPluginFilter.class);
   
       @Override
       public String name() {
           return "AuthPluginFilter";
       }
   
       @Override
       public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
           String path = request.getPath();
           LOGGER.info("[AuthPluginFilter] request path is '" + path + "'");
           Map<String, Object> body = new HashMap<>();
           body.put("code", -1);
           body.put("msg", "filter auth error");
           Gson gson = new Gson();
           String bodyJson = gson.toJson(body);
   
           request.setHeader(this.getClass().getName(), "filter-add-header");
   
           response.setStatusCode(403);
           response.setBody(bodyJson);
   
           chain.filter(request, response);
       }
   
       @Override
       public List<String> requiredVars() {
           return null;
       }
   
       @Override
       public Boolean requiredBody() {
           return null;
       }
   }
   ```
   
   - my route config
   
   ![image](https://user-images.githubusercontent.com/75556346/148645910-413952d7-7c62-40dc-b7ac-6742392029ef.png)
   
   
   ### Environment
   
   * your apisix-java-plugin-runner version : `latest`
   
   
   


-- 
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@apisix.apache.org

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



[GitHub] [apisix-java-plugin-runner] bnyte commented on issue #111: why my filter skip it

Posted by GitBox <gi...@apache.org>.
bnyte commented on issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111#issuecomment-1008301622


   okay I have solved it, thanks for your reply now i close this


-- 
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@apisix.apache.org

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



[GitHub] [apisix-java-plugin-runner] leyuuu commented on issue #111: why my filter skip it

Posted by GitBox <gi...@apache.org>.
leyuuu commented on issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111#issuecomment-1008282506


   Was the class file successfully generated?
   查下类文件是不是对的
   ![image](https://user-images.githubusercontent.com/50611440/148680844-4cb87bb9-8fde-43ef-a3be-22f6a5edbca0.png)
   


-- 
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@apisix.apache.org

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



[GitHub] [apisix-java-plugin-runner] bnyte commented on issue #111: why my filter skip it

Posted by GitBox <gi...@apache.org>.
bnyte commented on issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111#issuecomment-1008289945


   but i check jar file not found this class i need Where should I need to go to confirm. .


-- 
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@apisix.apache.org

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



[GitHub] [apisix-java-plugin-runner] bnyte commented on issue #111: why my filter skip it

Posted by GitBox <gi...@apache.org>.
bnyte commented on issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111#issuecomment-1008289374


   ![image](https://user-images.githubusercontent.com/75556346/148682315-ee75e4e0-b03e-4610-ae8c-7c7cb4dfd586.png)
   this is my class file i thins this is true..


-- 
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@apisix.apache.org

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



[GitHub] [apisix-java-plugin-runner] bnyte closed issue #111: why my filter skip it

Posted by GitBox <gi...@apache.org>.
bnyte closed issue #111:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/111


   


-- 
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@apisix.apache.org

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