Added copyright header jmx-rest-api
authorhb
Wed, 27 Dec 2017 18:39:52 +0530
branchjmx-rest-api
changeset 55997 f881344569d9
parent 55996 e8d4ccaf6877
child 55998 54779691e11f
Added copyright header
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/GetRequestHandler.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpResponse.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpUtil.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/JmxRestAdapter.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanCollectionResource.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanResource.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanServerCollectionResource.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/PostRequestHandler.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestCollectionFilter.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestConfig.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestResource.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONArray.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONElement.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONObject.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONPrimitive.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONDataException.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMapper.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingException.java
src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingFactory.java
src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/GetRequestHandler.java	Wed Dec 27 16:05:53 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,187 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.oracle.jmx.remote.rest.http;
-
-import com.oracle.jmx.remote.rest.json.JSONArray;
-import com.oracle.jmx.remote.rest.json.JSONObject;
-import com.oracle.jmx.remote.rest.json.JSONPrimitive;
-import com.oracle.jmx.remote.rest.mapper.JSONMappingException;
-import com.oracle.jmx.remote.rest.mapper.JSONMappingFactory;
-
-import javax.management.*;
-import java.net.HttpURLConnection;
-import java.util.*;
-
-/**
- * @author harsha
- */
-public class GetRequestHandler {
-
-    private final MBeanServer mbeanServer;
-    private final List<String> allowedMBeans;
-
-    public GetRequestHandler(MBeanServer mServer, List<String> allowedMBeans) {
-        this.mbeanServer = mServer;
-        this.allowedMBeans = allowedMBeans;
-    }
-
-    public synchronized JSONObject handle(String resource, String query) {
-
-        System.out.println("Resource = " + resource + ", Body = " + query);
-
-        try {
-            if ((query == null || query.isEmpty()) && (resource == null || resource.isEmpty())) {
-                return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                        new JSONPrimitive(resource + (query == null ? "" : query)),
-                        new JSONPrimitive("Nothing to see here.. move along"));
-            }
-            if (query != null && resource.isEmpty()) { // Handle default domain
-                String[] tokens = query.split(Tokens.FORWARD_SLASH);
-                if (tokens.length == 1 && tokens[0].equalsIgnoreCase(Tokens.DEFAULT_DOMAIN)) {
-                    // Get default domain
-                    return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                            new JSONPrimitive(resource + (query == null ? "" : query)),
-                            new JSONPrimitive(mbeanServer.getDefaultDomain()));
-
-                } else { // Get mbeans belonging to a domain
-
-                }
-            } else {
-                // handle string escaping for '/'
-                String[] tokens = resource.split("/");
-                switch (tokens[0]) {
-                    case Tokens.DOMAINS:
-                        String[] domains = mbeanServer.getDomains();
-                        JSONArray jarr = new JSONArray();
-                        Arrays.stream(domains).forEach(a -> jarr.add(new JSONPrimitive(a)));
-                        return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                                new JSONPrimitive(resource + (query == null ? "" : query)),
-                                jarr);
-                    case Tokens.MBEANS:
-
-                        //Set<ObjectInstance> mbeans = mbeanServer.queryMBeans(null, null);
-                        jarr = new JSONArray();
-                        //mbeans.stream()
-                        //.map(objIns -> objIns.getObjectName().toString())
-                        allowedMBeans.stream().forEach(a -> jarr.add(new JSONPrimitive(a)));
-                        return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                                new JSONPrimitive(resource + (query == null ? "" : query)),
-                                jarr);
-                    default:
-                        if (tokens.length == 2) {
-                            if (!allowedMBeans.contains(tokens[0])) {
-                                throw new InstanceNotFoundException("Invalid MBean");
-                            }
-                            ObjectName mbean = ObjectName.getInstance(tokens[0]);
-                            JSONObject jsonObject = getJSONObject(readAttributes(mbeanServer, mbean, tokens[1]));
-                            return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                                    new JSONPrimitive(resource + (query == null ? "" : query)),
-                                    jsonObject);
-                        } else if (tokens.length == 1 && query != null && !query.isEmpty()) {
-                            if (!allowedMBeans.contains(tokens[0])) {
-                                throw new InstanceNotFoundException("Invalid MBean");
-                            }
-                            ObjectName mbean = ObjectName.getInstance(tokens[0]);
-                            if (query.startsWith(Tokens.ATTRS)) {
-                                String attrs = query.split(Tokens.EQUALS)[1];
-                                JSONObject jsonObject = getJSONObject(readAttributes(mbeanServer, mbean, attrs));
-                                return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                                        new JSONPrimitive(resource + (query == null ? "" : query)),
-                                        jsonObject);
-                            }
-                        } else if (tokens.length == 1 && (query == null || query.isEmpty())) {
-                            if (!allowedMBeans.contains(tokens[0])) {
-                                throw new InstanceNotFoundException("Invalid MBean");
-                            }
-
-                            // We get MBeanInfo
-                            ObjectName mbeanObj = ObjectName.getInstance(tokens[0]);
-                            return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                                    new JSONPrimitive(5), new JSONPrimitive(5));
-                        }
-                        System.out.println("Unrecognized token : " + tokens[0]);
-                }
-            }
-        } catch (MBeanException | JSONMappingException | IntrospectionException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex),
-                    new JSONPrimitive(resource + (query == null ? "" : query)),
-                    new JSONPrimitive("Invalid Mbean attribute"));
-
-        } catch (AttributeNotFoundException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex),
-                    new JSONPrimitive(resource + (query == null ? "" : query)),
-                    new JSONPrimitive(ex.getMessage()));
-        } catch (InstanceNotFoundException | ReflectionException | MalformedObjectNameException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex),
-                    new JSONPrimitive(resource + (query == null ? "" : query)),
-                    new JSONPrimitive("Invalid Mbean"));
-        }
-        return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK,
-                new JSONPrimitive(resource + (query == null ? "" : query)),
-                new JSONPrimitive("Nothing to see here.. move along"));
-    }
-
-    private Map<String, Object> readAttributes(MBeanServer mbeanServer,
-                                               ObjectName objName, String requestStr)
-            throws InstanceNotFoundException, IntrospectionException,
-            ReflectionException, MBeanException, AttributeNotFoundException {
-        requestStr = requestStr.trim();
-        Map<String, Object> result = new HashMap<>();
-
-        String[] attrs = Arrays.stream(requestStr.split(Tokens.COMMA))
-                .map(String::trim)
-                .toArray(String[]::new);
-
-        if (attrs.length == 1) {
-            result.put(attrs[0], mbeanServer.getAttribute(objName, attrs[0]));
-        } else {
-            AttributeList attrVals = mbeanServer.getAttributes(objName, attrs);
-            if (attrVals.size() != attrs.length) {
-                List<String> missingAttrs = new ArrayList<>(Arrays.asList(attrs));
-                for (Attribute a : attrVals.asList()) {
-                    missingAttrs.remove(a.getName());
-                    result.put(a.getName(), a.getValue());
-                }
-                for (String attr : missingAttrs) {
-                    result.put(attr, "< Error: No such attribute >");
-                }
-            } else {
-                attrVals.asList().forEach((a) -> {
-                    result.put(a.getName(), a.getValue());
-                });
-            }
-        }
-
-        return result;
-    }
-
-    private JSONObject getJSONObject(Map<String, Object> attributeMap) throws JSONMappingException {
-        JSONObject jobject = new JSONObject();
-        JSONMappingFactory mappingFactory = JSONMappingFactory.INSTANCE;
-        for (String key : attributeMap.keySet()) {
-            Object attrVal = attributeMap.get(key);
-            if (attrVal == null) {
-                jobject.put(key, new JSONPrimitive());
-            } else if (mappingFactory.getTypeMapper(attrVal) != null) {
-                jobject.put(key, mappingFactory.getTypeMapper(attrVal).toJsonValue(attrVal));
-            }
-        }
-        return jobject;
-    }
-
-    private interface Tokens {
-
-        public static final String DOMAINS = "domains";
-        public static final String MBEANS = "mbeans";
-        public static final String ATTRS = "attributes";
-        public static final String DOMAIN = "domain";
-        public static final String DEFAULT_DOMAIN = "domain=default";
-        public static final String ALL = "all";
-        public static final String EQUALS = "=";
-        public static final String COMMA = ",";
-        public static final String FORWARD_SLASH = "/";
-    }
-}
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpResponse.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpResponse.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,7 +1,28 @@
 /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.http;
 
 import javax.management.AttributeNotFoundException;
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpUtil.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/HttpUtil.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.oracle.jmx.remote.rest.json.JSONObject;
@@ -164,7 +189,7 @@
                 currPage = Integer.parseInt(pageStr);
             }
         }
-        String path = PlatformRestAdapter.getAuthority() + exchange.getRequestURI().getPath() + "?";
+        String path = PlatformRestAdapter.getDomain() + exchange.getRequestURI().getPath() + "?";
         Map<String, String> queryMap = getGetRequestQueryMap(exchange);
         if (queryMap != null) {
             queryMap.remove("page");
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/JmxRestAdapter.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/JmxRestAdapter.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.oracle.jmx.remote.rest.json.JSONElement;
@@ -106,7 +126,7 @@
 
     @Override
     public HttpResponse doGet(HttpExchange exchange) {
-        String selfUrl = PlatformRestAdapter.getAuthority() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
+        String selfUrl = PlatformRestAdapter.getDomain() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
         Map<String, String> links = new LinkedHashMap<>();
         links.put("mbeans", selfUrl + "/mbeans");
 
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanCollectionResource.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanCollectionResource.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.oracle.jmx.remote.rest.json.JSONElement;
@@ -123,7 +148,7 @@
     public HttpResponse doGet(HttpExchange exchange) {
         // add links
 
-        final String path = PlatformRestAdapter.getAuthority() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
+        final String path = PlatformRestAdapter.getDomain() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
         try {
             List<ObjectName> mbeans = allowedMbeans;
             Map<String, String> queryMap = HttpUtil.getGetRequestQueryMap(exchange);
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanResource.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanResource.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.oracle.jmx.remote.rest.json.JSONArray;
@@ -447,7 +472,7 @@
         if (exchange.getRequestURI().getPath().endsWith("info")) {
             return doMBeanInfo(exchange);
         }
-        String path = PlatformRestAdapter.getAuthority() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
+        String path = PlatformRestAdapter.getDomain() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
         String info = path + "/info";
 
         try {
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanServerCollectionResource.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/MBeanServerCollectionResource.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,3 +1,28 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.oracle.jmx.remote.rest.json.JSONArray;
@@ -5,13 +30,13 @@
 import com.sun.net.httpserver.HttpExchange;
 import com.sun.net.httpserver.HttpServer;
 
-import javax.management.JMX;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerDelegate;
-import javax.management.MBeanServerDelegateMBean;
 import javax.management.remote.rest.PlatformRestAdapter;
 import java.util.List;
 
+/**
+ * This class handles all the HTTP requests for the base URL
+ * for REST adapter.
+ */
 public class MBeanServerCollectionResource implements RestResource {
 
     private final List<JmxRestAdapter> restAdapters;
@@ -22,40 +47,35 @@
         server.createContext("/jmx/servers", this);
     }
 
-    private String getMBeanServerID(MBeanServer server) {
-        MBeanServerDelegateMBean mbean = JMX.newMBeanProxy(server,
-                MBeanServerDelegate.DELEGATE_NAME, MBeanServerDelegateMBean.class);
-        return mbean.getMBeanServerId();
-    }
-
     @Override
     public HttpResponse doGet(HttpExchange exchange) {
         try {
             JSONObject _links = HttpUtil.getPaginationLinks(exchange, restAdapters, pageSize);
             List<JmxRestAdapter> filteredList = HttpUtil.filterByPage(exchange, restAdapters, pageSize);
             if (filteredList == null) {
-                return new HttpResponse(HttpResponse.BAD_REQUEST, "Invald query parameters");
+                return HttpResponse.OK;
             }
 
-            final String path = PlatformRestAdapter.getAuthority() + exchange.getRequestURI().getPath().replaceAll("\\/$", "");
+            final String path = PlatformRestAdapter.getDomain() +
+                    exchange.getRequestURI().getPath().replaceAll("\\/$", "");
 
             JSONObject root = new JSONObject();
-            if(_links != null && !_links.isEmpty()) {
-                root.put("_links",_links);
+            if (_links != null && !_links.isEmpty()) {
+                root.put("_links", _links);
             }
 
-            root.put("mBeanServerCount",Integer.toString(restAdapters.size()));
+            root.put("mBeanServerCount", Integer.toString(restAdapters.size()));
 
             JSONArray list = new JSONArray();
             filteredList.stream().map((adapter) -> {
                 JSONObject result = new JSONObject();
                 result.put("name", adapter.getAlias());
-                result.put("href", path +"/" +adapter.getAlias());
+                result.put("href", path + "/" + adapter.getAlias());
                 return result;
             }).forEachOrdered((result) -> {
                 list.add(result);
             });
-            root.put("items",list);
+            root.put("items", list);
             return new HttpResponse(200, root.toJsonString());
         } catch (Exception ex) {
             ex.printStackTrace();
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/PostRequestHandler.java	Wed Dec 27 16:05:53 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-/*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
-package com.oracle.jmx.remote.rest.http;
-
-import javax.management.*;
-import javax.management.openmbean.OpenMBeanAttributeInfo;
-import javax.management.openmbean.OpenMBeanParameterInfo;
-import javax.management.openmbean.OpenType;
-import com.oracle.jmx.remote.rest.json.JSONArray;
-import com.oracle.jmx.remote.rest.json.JSONElement;
-import com.oracle.jmx.remote.rest.json.JSONObject;
-import com.oracle.jmx.remote.rest.json.JSONPrimitive;
-import com.oracle.jmx.remote.rest.mapper.JSONDataException;
-import com.oracle.jmx.remote.rest.mapper.JSONMapper;
-import com.oracle.jmx.remote.rest.mapper.JSONMappingException;
-import com.oracle.jmx.remote.rest.mapper.JSONMappingFactory;
-import com.oracle.jmx.remote.rest.json.parser.JSONParser;
-import com.oracle.jmx.remote.rest.json.parser.ParseException;
-import java.net.HttpURLConnection;
-import java.util.*;
-
-/**
- * @author harsha
- */
-public class PostRequestHandler {
-
-    private static final String MBEAN_NAME = "name";
-    private static final String MBEAN_ARGUMENTS = "arguments";
-    private final static Map<String, Class<?>> primitiveToObject = new HashMap<>();
-
-    static {
-        primitiveToObject.put("int", Integer.TYPE);
-        primitiveToObject.put("long", Long.TYPE);
-        primitiveToObject.put("double", Double.TYPE);
-        primitiveToObject.put("float", Float.TYPE);
-        primitiveToObject.put("boolean", Boolean.TYPE);
-        primitiveToObject.put("char", Character.TYPE);
-        primitiveToObject.put("byte", Byte.TYPE);
-        primitiveToObject.put("void", Void.TYPE);
-        primitiveToObject.put("short", Short.TYPE);
-    }
-
-    private final MBeanServer mbeanServer;
-    private final List<String> allowedMbeans;
-
-    public PostRequestHandler(MBeanServer mServer, List<String> allowedMbeans) {
-        this.mbeanServer = mServer;
-        this.allowedMbeans = allowedMbeans;
-    }
-
-    public synchronized List<JSONObject> handle(String jsonStr) {
-
-        JSONElement object;
-        List<JSONObject> postResponse = new ArrayList<>();
-        try {
-            object = new JSONParser(jsonStr).parse();
-        } catch (ParseException ex) {
-            postResponse.add(HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex), new JSONPrimitive(jsonStr), new JSONPrimitive("Invalid JSON String")));
-            return postResponse;
-        }
-
-        if (object instanceof JSONObject) {
-            postResponse.add(handleIndividualRequest((JSONObject) object));
-            return postResponse;
-        } else if (object instanceof JSONArray) {
-            JSONArray jarr = (JSONArray) object;
-
-            for (JSONElement jval : jarr) {
-                if (jval instanceof JSONObject) {
-                    JSONObject resp = handleIndividualRequest((JSONObject) jval);
-                    postResponse.add(resp);
-                }
-            }
-            return postResponse;
-        } else {
-            postResponse.add(HttpResponse.getJsonObject(HttpURLConnection.HTTP_BAD_REQUEST, new JSONPrimitive(jsonStr), new JSONPrimitive("Invalid request")));
-            return postResponse;
-        }
-    }
-
-    private JSONObject handleIndividualRequest(JSONObject jobject) {
-
-        try {
-            JSONObject map = jobject;
-            ObjectName name = getObjectName(map);
-            MBeanOps operation = null;
-            for (MBeanOps op : MBeanOps.values()) {
-                if (map.containsKey(op.toString())) {
-                    operation = op;
-                    break;
-                }
-            }
-
-            if (operation == null) {
-                throw new JSONDataException("Invalid operation string");
-            }
-
-            JSONElement val = map.get(operation.toString());
-            if (!(val instanceof JSONPrimitive) || !(((JSONPrimitive) val).getValue() instanceof String)) {
-                throw new JSONDataException("Invalid JSON String");
-            }
-
-            String attrOrOperation = (String) ((JSONPrimitive) val).getValue();
-            JSONElement result = new JSONPrimitive("success");
-
-            val = map.get(MBEAN_ARGUMENTS);
-            if (val != null) {
-                if (!(val instanceof JSONArray)) {
-                    throw new JSONDataException("Invalid JSON String");
-                }
-            }
-
-            JSONArray args = (JSONArray) val;
-
-            switch (operation) {
-                case READ:
-                    result = readAttribute(name, attrOrOperation, args);
-                    break;
-                case WRITE:
-                    writeAttribute(name, attrOrOperation, args);
-                    break;
-                case EXEC:
-                    result = execOperation(name, attrOrOperation, args);
-                    break;
-            }
-            return HttpResponse.getJsonObject(HttpURLConnection.HTTP_OK, jobject, result);
-        } catch (JSONDataException | MBeanException | JSONMappingException | ClassNotFoundException | IntrospectionException | InvalidAttributeValueException | IllegalArgumentException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex), jobject, new JSONPrimitive(ex.toString()));
-        } catch (AttributeNotFoundException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex), jobject, new JSONPrimitive("Invalid Mbean attribute"));
-        } catch (InstanceNotFoundException | ReflectionException ex) {
-            return HttpResponse.getJsonObject(HttpResponse.getHttpErrorCode(ex), jobject, new JSONPrimitive("Invalid Mbean"));
-        }
-    }
-
-    private JSONElement readAttribute(ObjectName name, String attribute, JSONArray args)
-            throws InstanceNotFoundException, IntrospectionException, ReflectionException, ClassNotFoundException,
-            MBeanException, AttributeNotFoundException, JSONMappingException {
-        MBeanInfo mInfos = mbeanServer.getMBeanInfo(name);
-        MBeanAttributeInfo attrInfo = Arrays.stream(mInfos.getAttributes()).filter(a -> a.getName().equals(attribute)).findFirst().orElse(null);
-        if (attrInfo != null && attrInfo.isReadable()) {
-            JSONMapper mapper;
-            if (attrInfo instanceof OpenMBeanAttributeInfo) {
-                OpenType<?> type = ((OpenMBeanAttributeInfo) attrInfo).getOpenType();
-                mapper = JSONMappingFactory.INSTANCE.getTypeMapper(type);
-            } else {
-                mapper = JSONMappingFactory.INSTANCE.getTypeMapper(Class.forName(attrInfo.getType()));
-            }
-            Object attrVal = mbeanServer.getAttribute(name, attribute);
-            return mapper.toJsonValue(attrVal);
-        } else {
-            throw new AttributeNotFoundException();
-        }
-    }
-
-    private void writeAttribute(ObjectName name, String attribute, JSONArray args)
-            throws InstanceNotFoundException, IntrospectionException, ReflectionException, ClassNotFoundException,
-            JSONDataException, AttributeNotFoundException, InvalidAttributeValueException, MBeanException {
-
-        if (args == null || args.isEmpty()) {
-            throw new JSONDataException("Null arguments for set attribute");
-        }
-
-        MBeanInfo mInfos = mbeanServer.getMBeanInfo(name);
-        MBeanAttributeInfo attrInfo = Arrays.stream(mInfos.getAttributes()).filter(a -> a.getName().equals(attribute)).findFirst().orElse(null);
-        if (attrInfo != null && attrInfo.isWritable()) {
-            JSONMapper mapper;
-            if (attrInfo instanceof OpenMBeanAttributeInfo) {
-                OpenType<?> type = ((OpenMBeanAttributeInfo) attrInfo).getOpenType();
-                mapper = JSONMappingFactory.INSTANCE.getTypeMapper(type);
-            } else {
-                mapper = JSONMappingFactory.INSTANCE.getTypeMapper(Class.forName(attrInfo.getType()));
-            }
-
-            JSONElement val = args.get(0);
-            Object argVal = mapper.toJavaObject(val);
-            Attribute attrObj = new Attribute(attribute, argVal);
-            mbeanServer.setAttribute(name, attrObj);
-
-        } else {
-            throw new AttributeNotFoundException();
-        }
-    }
-
-    private Object[] mapArgsToSignature(JSONArray args, MBeanParameterInfo[] signature) {
-        if (args.size() != signature.length) {
-            throw new IllegalArgumentException("Invalid parameters : expected - " + signature.length + " parameters, got - " + args.size());
-        }
-        if (signature.length == 0 && args.isEmpty()) {
-            return new Object[0];
-        }
-        int i = 0;
-        Object[] params = new Object[signature.length];
-        for (MBeanParameterInfo info : signature) {
-            if (info instanceof OpenMBeanParameterInfo) {
-                OpenType<?> openType = ((OpenMBeanParameterInfo) info).getOpenType();
-                JSONMapper typeMapper = JSONMappingFactory.INSTANCE.getTypeMapper(openType);
-                try {
-                    params[i] = typeMapper.toJavaObject(args.get(i));
-                } catch (JSONDataException ex) {
-                    throw new IllegalArgumentException("Invalid JSON String : " + args.get(i).toJsonString() + " for arguments");
-                }
-            } else {
-                Class<?> inputCls = primitiveToObject.get(info.getType());
-                try {
-                    if (inputCls == null) {
-                        inputCls = Class.forName(info.getType());
-                    }
-                } catch (ClassNotFoundException | ClassCastException ex) {
-                    throw new IllegalArgumentException("Invalid parameters : " + args.get(i).toJsonString() + " cannot be mapped to : " + info.getType());
-                }
-                JSONMapper typeMapper = JSONMappingFactory.INSTANCE.getTypeMapper(inputCls);
-                if (typeMapper == null) {
-                    throw new IllegalArgumentException("Invalid parameters : " + args.get(i).toJsonString() + " cannot be mapped to : " + info.getType());
-                }
-                try {
-                    params[i] = typeMapper.toJavaObject(args.get(i));
-                } catch (JSONDataException ex) {
-                    throw new IllegalArgumentException("Invalid JSON String : " + args.get(i).toJsonString() + " for arguments");
-                }
-            }
-            i++;
-        }
-        return params;
-    }
-
-    private JSONElement execOperation(ObjectName name, String opstr, JSONArray args)
-            throws MBeanException, JSONMappingException, IntrospectionException, ReflectionException {
-        if (args == null) {
-            args = new JSONArray();
-        }
-        MBeanInfo mBeanInfo;
-        try {
-            mBeanInfo = mbeanServer.getMBeanInfo(name);
-        } catch (InstanceNotFoundException ex) {
-            throw new IllegalArgumentException("Invalid Operation String");
-        }
-
-        MBeanOperationInfo[] opinfos = Arrays.stream(mBeanInfo.getOperations()).
-                filter(a -> a.getName().equals(opstr)).toArray(MBeanOperationInfo[]::new);
-
-        if (opinfos.length == 0) {
-            throw new IllegalArgumentException("Invalid Operation String");
-        }
-
-        String[] signature = null;
-        Object[] params = null;
-
-        if (opinfos.length == 1) {
-            MBeanParameterInfo[] sig = opinfos[0].getSignature();
-            params = mapArgsToSignature(args, sig);
-            signature = Arrays.asList(sig).stream().map(a -> a.getType()).toArray(a -> new String[a]);
-        } else if (opinfos.length > 1) {
-            IllegalArgumentException exception = null;
-            for (MBeanOperationInfo opInfo : opinfos) {
-                MBeanParameterInfo[] sig = opInfo.getSignature();
-                try {
-                    params = mapArgsToSignature(args, sig);
-                    signature = Arrays.asList(sig).stream().map(a -> a.getType()).toArray(a -> new String[a]);
-                    exception = null;
-                    break;
-                } catch (IllegalArgumentException ex) {
-                    exception = ex;
-                }
-            }
-            if (exception != null) {
-                throw exception;
-            }
-        }
-
-        Object invoke;
-        try {
-            invoke = mbeanServer.invoke(name, opstr, params, signature);
-        } catch (InstanceNotFoundException ex) {
-            throw new IllegalArgumentException("Invalid Operation String");
-        }
-        if (invoke != null) {
-            JSONMapper typeMapper = JSONMappingFactory.INSTANCE.getTypeMapper(invoke);
-            if (typeMapper != null) {
-                return typeMapper.toJsonValue(invoke);
-            } else {
-                return new JSONPrimitive();
-            }
-        } else {
-            return new JSONPrimitive();
-        }
-    }
-
-    private ObjectName getObjectName(JSONObject map) throws JSONDataException, InstanceNotFoundException {
-        do {
-            if (map.get(MBEAN_NAME) == null || !(map.get(MBEAN_NAME) instanceof JSONPrimitive)) {
-                break;
-            }
-            JSONPrimitive mbean_name = (JSONPrimitive) map.get(MBEAN_NAME);
-            if (!(mbean_name.getValue() instanceof String)) {
-                break;
-            }
-            if (!allowedMbeans.contains((String) mbean_name.getValue())) {
-                throw new InstanceNotFoundException("Invalid MBean");
-            }
-            try {
-                return ObjectName.getInstance((String) mbean_name.getValue());
-            } catch (MalformedObjectNameException ex) {
-            }
-        } while (false);
-        throw new JSONDataException("Invalid JSON String");
-    }
-
-    private static enum MBeanOps {
-        READ("read"),
-        WRITE("write"),
-        EXEC("exec");
-
-        private final String text;
-
-        private MBeanOps(final String text) {
-            this.text = text;
-        }
-
-        @Override
-        public String toString() {
-            return text;
-        }
-    }
-}
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestCollectionFilter.java	Wed Dec 27 16:05:53 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-package com.oracle.jmx.remote.rest.http;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-public interface RestCollectionFilter<T> {
-    List<T> filter(List<T> input);
-}
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestConfig.java	Wed Dec 27 16:05:53 2017 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-package com.oracle.jmx.remote.rest.http;
-
-public interface RestConfig {
-    public static final int DEFAULT_PAGE_SIZE = 50;
-}
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestResource.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/http/RestResource.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.http;
 
 import com.sun.net.httpserver.HttpExchange;
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONArray.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONArray.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.json;
 
 import java.util.ArrayList;
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONElement.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONElement.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.json;
 
 /**
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONObject.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONObject.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.json;
 
 import java.util.LinkedHashMap;
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONPrimitive.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/json/JSONPrimitive.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.json;
 
 /**
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONDataException.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONDataException.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.mapper;
 
 /**
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMapper.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMapper.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.mapper;
 
 import com.oracle.jmx.remote.rest.json.JSONElement;
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingException.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingException.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.mapper;
 
 /**
--- a/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingFactory.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/com/oracle/jmx/remote/rest/mapper/JSONMappingFactory.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package com.oracle.jmx.remote.rest.mapper;
 
 import com.oracle.jmx.remote.rest.json.JSONArray;
--- a/src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java	Wed Dec 27 16:05:53 2017 +0530
+++ b/src/java.management.rest/share/classes/javax/management/remote/rest/PlatformRestAdapter.java	Wed Dec 27 18:39:52 2017 +0530
@@ -1,8 +1,28 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
  */
+
 package javax.management.remote.rest;
 
 import javax.management.MBeanServerFactoryListener;
@@ -29,8 +49,9 @@
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executors;
 
-/**
- * @author harsha
+/** This is the root class that initializes the HTTPServer and
+ * REST adapter for platform mBeanServer.
+ * @since 11
  */
 public class PlatformRestAdapter implements MBeanServerFactoryListener {
 
@@ -39,12 +60,14 @@
      * acts as container for platform rest adapter
      */
     private static HttpServer httpServer = null;
-    private static List<JmxRestAdapter> restAdapters = new CopyOnWriteArrayList<>();
+
+    // Save configuration to be used for other MBeanServers
     private static Map<String, Object> env;
-
     private static String portStr;
     private static Properties props;
 
+    private static List<JmxRestAdapter> restAdapters = new CopyOnWriteArrayList<>();
+
     private PlatformRestAdapter() {
     }
 
@@ -137,7 +160,7 @@
 
     }
 
-    public static synchronized String getAuthority() {
+    public static synchronized String getDomain() {
         if(httpServer == null) {
             throw new IllegalStateException("Platform rest adapter not initialized");
         }