You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@atlas.apache.org by Mandar Ambawane <ma...@freestoneinfotech.com> on 2020/06/16 14:37:51 UTC

Re: Review Request 72593: ATLAS-3841 Response Headers: Code refactoring

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72593/
-----------------------------------------------------------

(Updated June 16, 2020, 2:37 p.m.)


Review request for atlas, Jayendra Parab, Madhan Neethiraj, Nixon Rodrigues, and Sarath Subramanian.


Bugs: ATLAS-3841
    https://issues.apache.org/jira/browse/ATLAS-3841


Repository: atlas


Description
-------

Currently headers setting code is scattered at different places.
In this patch, code refactoring is done to set response headers from AtlasHeaderFilter.java

Also this patch provides flexibility to select file formats to be excluded from applying response headers.


Diffs
-----

  distro/src/conf/atlas-application.properties e06e74a 
  intg/src/main/java/org/apache/atlas/AtlasConfiguration.java 2c007ca 
  webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java d9b1c82 
  webapp/src/main/java/org/apache/atlas/web/filters/AtlasDelegatingAuthenticationEntryPoint.java c629a7e 
  webapp/src/main/java/org/apache/atlas/web/filters/AtlasHeaderFilter.java fa7218c 
  webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java 1944a9f 
  webapp/src/main/java/org/apache/atlas/web/filters/HeadersUtil.java 1f8845d 
  webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java e74a9e9 
  webapp/src/main/webapp/WEB-INF/web.xml 2595a15 


Diff: https://reviews.apache.org/r/72593/diff/1/


Testing
-------

PreCommit: https://builds.apache.org/job/PreCommit-ATLAS-Build-Test/1964/console


Thanks,

Mandar Ambawane


Re: Review Request 72593: ATLAS-3841 Response Headers: Code refactoring

Posted by Sarath Subramanian <sa...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/72593/#review221017
-----------------------------------------------------------


Fix it, then Ship it!





webapp/src/main/java/org/apache/atlas/web/filters/AtlasHeaderFilter.java
Lines 40 (patched)
<https://reviews.apache.org/r/72593/#comment309790>

    consider refactoring to:
    
    ```
    private boolean isFileExtensionExcluded(String fileExtension) {
      boolean ret = false;
    
      if (ArrayUtils.isNotEmpty(excludeFileFormats)) {
        ret = Arrays.asList(excludeFileFormats).contains(fileExtension.toLowerCase());
      }
      
      return ret;
    }
    ```



webapp/src/main/java/org/apache/atlas/web/filters/AtlasHeaderFilter.java
Lines 51 (patched)
<https://reviews.apache.org/r/72593/#comment309789>

    consider using the following to get file extension:
    ```
    String fileExtension = FilenameUtils.getExtension(path);
    
    if (!isFileExtensionExcluded(fileExtension)) {
      setHeaders((HttpServletResponse) response);
    }
    ```


- Sarath Subramanian


On June 16, 2020, 7:37 a.m., Mandar Ambawane wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/72593/
> -----------------------------------------------------------
> 
> (Updated June 16, 2020, 7:37 a.m.)
> 
> 
> Review request for atlas, Jayendra Parab, Madhan Neethiraj, Nixon Rodrigues, and Sarath Subramanian.
> 
> 
> Bugs: ATLAS-3841
>     https://issues.apache.org/jira/browse/ATLAS-3841
> 
> 
> Repository: atlas
> 
> 
> Description
> -------
> 
> Currently headers setting code is scattered at different places.
> In this patch, code refactoring is done to set response headers from AtlasHeaderFilter.java
> 
> Also this patch provides flexibility to select file formats to be excluded from applying response headers.
> 
> 
> Diffs
> -----
> 
>   distro/src/conf/atlas-application.properties e06e74a 
>   intg/src/main/java/org/apache/atlas/AtlasConfiguration.java 2c007ca 
>   webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java d9b1c82 
>   webapp/src/main/java/org/apache/atlas/web/filters/AtlasDelegatingAuthenticationEntryPoint.java c629a7e 
>   webapp/src/main/java/org/apache/atlas/web/filters/AtlasHeaderFilter.java fa7218c 
>   webapp/src/main/java/org/apache/atlas/web/filters/AtlasKnoxSSOAuthenticationFilter.java 1944a9f 
>   webapp/src/main/java/org/apache/atlas/web/filters/HeadersUtil.java 1f8845d 
>   webapp/src/main/java/org/apache/atlas/web/security/AtlasSecurityConfig.java e74a9e9 
>   webapp/src/main/webapp/WEB-INF/web.xml 2595a15 
> 
> 
> Diff: https://reviews.apache.org/r/72593/diff/1/
> 
> 
> Testing
> -------
> 
> PreCommit: https://builds.apache.org/job/PreCommit-ATLAS-Build-Test/1964/console
> 
> 
> Thanks,
> 
> Mandar Ambawane
> 
>