src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanCollectionResource.java
branchjmx-rest-api
changeset 55995 a798bdd52997
parent 55994 9721e36abeb0
child 55996 e8d4ccaf6877
equal deleted inserted replaced
55994:9721e36abeb0 55995:a798bdd52997
    90     }
    90     }
    91 
    91 
    92     @Override
    92     @Override
    93     public void handle(HttpExchange exchange) throws IOException {
    93     public void handle(HttpExchange exchange) throws IOException {
    94         String path = exchange.getRequestURI().getPath();
    94         String path = exchange.getRequestURI().getPath();
    95         if (path.matches("^\\/?jmx\\/servers\\/[a-zA-Z0-9\\-\\.]+\\/mbeans\\/?$")) {
    95         String pathPrefix = "^/?jmx/servers/[a-zA-Z0-9\\-\\.]+/mbeans";
       
    96         if (path.matches(pathPrefix + "/?$")) {
    96             RestResource.super.handle(exchange);
    97             RestResource.super.handle(exchange);
    97         } else if (path.matches("^\\/?jmx\\/servers\\/[a-zA-Z0-9\\-\\.]+\\/mbeans\\/[^\\/]+\\/?.*")) {
    98         } else if (path.matches(pathPrefix + "/[^/]+/?.*")) {
    98             // Extract mbean name
    99             // Extract mbean name
    99             // Forward the request to its corresponding rest resource
   100             // Forward the request to its corresponding rest resource
   100             Pattern mbeans = Pattern.compile("^\\/?jmx\\/servers\\/[a-zA-Z0-9\\-\\.]+\\/mbeans\\/");
   101             Pattern mbeans = Pattern.compile(pathPrefix + "/");
   101             Matcher matcher = mbeans.matcher(path);
   102             Matcher matcher = mbeans.matcher(path);
   102 
   103 
   103             if (matcher.find()) {
   104             if (matcher.find()) {
   104                 String ss = path.substring(matcher.end());
   105                 String ss = path.substring(matcher.end());
   105                 String mBeanName = ss;
   106                 String mBeanName = ss;