removed REST to run JETTY
diff --git a/apps/fpcagent/BUCK b/apps/fpcagent/BUCK
index 3915fac..0569ee0 100644
--- a/apps/fpcagent/BUCK
+++ b/apps/fpcagent/BUCK
@@ -7,8 +7,6 @@
'//lib:org.apache.httpcomponents.httpasyncclient-osgi',
'//lib:httpcore-osgi',
'//lib:netty',
- '//lib:javax.ws.rs-api',
- '//utils/rest:onlab-rest',
'//core/store/serializers:onos-core-serializers',
'//apps/restconf/utils:onos-apps-restconf-utils',
'//apps/config:onos-apps-config',
@@ -18,17 +16,16 @@
'//lib:jetty-http',
':jetty-servlet',
':jetty-annotations',
- ':jetty-server-v9.4.6',
+ '//lib:jetty-server',
'//lib:jetty-util',
- '//lib:jersey-server',
'//lib:javax.servlet-api',
+ '//lib:jetty-io',
':zeromq',
':json',
]
TEST_DEPS = [
'//lib:TEST_ADAPTERS',
- '//lib:TEST_REST',
'//utils/osgi:onlab-osgi-tests',
]
@@ -38,20 +35,15 @@
'//lib:httpcore-osgi',
'//lib:org.apache.httpcomponents.httpasyncclient-osgi',
'//lib:jetty-http',
- ':jetty-servlet',
- ':jetty-annotations',
- ':jetty-server-v9.4.6',
+ '//lib:jetty-io',
+ '//lib:jetty-server',
'//lib:jetty-util',
- '//lib:jersey-server',
'//lib:javax.servlet-api',
]
EXCLUDED_BUNDLES = [
':zeromq',
':json',
- ':jetty-servlet',
- ':jetty-annotations',
- ':jetty-server-v9.4.6',
]
APPS = [
@@ -66,11 +58,6 @@
osgi_jar_with_tests(
deps = COMPILE_DEPS,
test_deps = TEST_DEPS,
- web_context = '/tmp',
- api_title = 'FPC REST API',
- api_package = 'org.onosproject.fpcagent.rest',
- api_version = '1.0',
- api_description = 'FPC REST API',
)
onos_app(
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebApplication.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebApplication.java
deleted file mode 100644
index c745500..0000000
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebApplication.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.onosproject.fpcagent.rest;
-
-import org.onlab.rest.AbstractWebApplication;
-
-import java.util.Set;
-
-public class FpcWebApplication extends AbstractWebApplication {
- @Override
- public Set<Class<?>> getClasses() {
- return getClasses(FpcWebResource.class);
- }
-}
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebResource.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebResource.java
deleted file mode 100644
index 2e336fe..0000000
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/FpcWebResource.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.fpcagent.rest;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.commons.lang.exception.ExceptionUtils;
-import org.apache.http.HttpVersion;
-import org.apache.http.client.ResponseHandler;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.BasicResponseHandler;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-import org.onosproject.rest.AbstractWebResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.io.InputStream;
-
-@Path("/")
-public class FpcWebResource extends AbstractWebResource {
- private static final Logger log =
- LoggerFactory.getLogger(FpcWebResource.class);
-
- private ResponseHandler<String> handler = new BasicResponseHandler();
-
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/request")
- public Response getRequest(InputStream stream) {
- try {
- ObjectNode node = (ObjectNode) mapper().readTree(stream);
-
- log.info("Received {}", node.toString());
-
- CloseableHttpClient client = HttpClients.createDefault();
- HttpGet httpGet = new HttpGet(node.get("client-uri").asText());
-
- httpGet.addHeader("User-Agent", "ONOS FPC Agent");
- httpGet.addHeader("Charset", "utf-8");
- httpGet.addHeader("Content-type", "text/event-stream");
- httpGet.setProtocolVersion(HttpVersion.HTTP_1_1);
-
- CloseableHttpResponse httpResponse = client.execute(httpGet);
-
- String response = handler.handleResponse(httpResponse);
- log.info("Response {}", response);
- } catch (IOException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- }
-
- return Response.ok().build();
- }
-
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/response")
- public Response getResponse(InputStream stream) {
- try {
- ObjectNode node = (ObjectNode) mapper().readTree(stream);
-
- log.info("Received {}", node.toString());
- } catch (IOException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- }
- return Response.ok().build();
- }
-
- @POST
- @Consumes(MediaType.APPLICATION_JSON)
- @Path("/notification")
- public Response getNotification(InputStream stream) {
- try {
- ObjectNode node = (ObjectNode) mapper().readTree(stream);
-
- log.info("Received {}", node.toString());
- } catch (IOException e) {
- log.error(ExceptionUtils.getFullStackTrace(e));
- }
- return Response.ok().build();
- }
-}
-
diff --git a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/package-info.java b/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/package-info.java
deleted file mode 100644
index e4eb116..0000000
--- a/apps/fpcagent/src/main/java/org/onosproject/fpcagent/rest/package-info.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 2017-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.fpcagent.rest;
\ No newline at end of file
diff --git a/apps/fpcagent/src/main/webapp/WEB-INF/web.xml b/apps/fpcagent/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 6e74a95..0000000
--- a/apps/fpcagent/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2016-present Open Networking Foundation
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- id="ONOS" version="2.5">
- <display-name>FPC REST API v1.0</display-name>
-
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>Secured</web-resource-name>
- <url-pattern>/*</url-pattern>
- </web-resource-collection>
- <auth-constraint>
- <role-name>admin</role-name>
- </auth-constraint>
- </security-constraint>
-
- <security-role>
- <role-name>admin</role-name>
- </security-role>
-
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>karaf</realm-name>
- </login-config>
-
- <servlet>
- <servlet-name>JAX-RS Service</servlet-name>
- <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
- <init-param>
- <param-name>javax.ws.rs.Application</param-name>
- <param-value>org.onosproject.fpcagent.rest.FpcWebApplication</param-value>
- </init-param>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>JAX-RS Service</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
-</web-app>
\ No newline at end of file