Changeset 96:8fefa4651d00 in AnnotationManagerN4J for src


Ignore:
Timestamp:
Feb 10, 2015, 6:00:13 PM (9 years ago)
Author:
casties
Branch:
default
Message:

changed source indentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/restlet/utils/UrlPrefixFilter.java

    r94 r96  
    3636public class UrlPrefixFilter extends Filter {
    3737
    38         private String prefix = null;
    39        
    40         /**
    41         * Set the prefix to add.
    42         *
    43         * @param prefix
    44         */
    45         public void setPrefix(String prefix) {
    46                 if (!prefix.startsWith("/")) {
    47                         prefix = "/" + prefix;
    48                 }
    49                 this.prefix = prefix;
    50         }
    51        
    52         @Override
    53         protected int beforeHandle(Request request, Response response) {
    54                 // get ref to change
    55             Reference ref = request.getResourceRef();
    56             String path = ref.getPath();
    57             // add prefix to path
    58             ref.setPath(prefix + path);
    59             // change baseRef as well
    60             Reference baseRef = ref.getBaseRef();
    61             String basePath = baseRef.getPath();
    62             // add prefix to base ref path
    63             baseRef.setPath(prefix + basePath);
    64                 return super.beforeHandle(request, response);
    65         }
     38    private String prefix = null;
     39
     40    /**
     41    * Set the prefix to add.
     42    *
     43    * @param prefix
     44    */
     45    public void setPrefix(String prefix) {
     46        if (!prefix.startsWith("/")) {
     47            prefix = "/" + prefix;
     48        }
     49        this.prefix = prefix;
     50    }
     51
     52    @Override
     53    protected int beforeHandle(Request request, Response response) {
     54        // get ref to change
     55        Reference ref = request.getResourceRef();
     56        String path = ref.getPath();
     57        // add prefix to path
     58        ref.setPath(prefix + path);
     59        // change baseRef as well
     60        Reference baseRef = ref.getBaseRef();
     61        String basePath = baseRef.getPath();
     62        // add prefix to base ref path
     63        baseRef.setPath(prefix + basePath);
     64        return super.beforeHandle(request, response);
     65    }
    6666
    6767}
Note: See TracChangeset for help on using the changeset viewer.