Skip to content

Commit

Permalink
[HWKMETRICS-185] Add correct filter configuration and update filter c…
Browse files Browse the repository at this point in the history
…ode.
  • Loading branch information
Stefan Negrea committed Aug 4, 2015
1 parent db30b10 commit 05c35a3
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha

if (path.startsWith(StatusHandler.PATH)) {
// The status page does not require the MetricsService to be up and running.
chain.doFilter(request, response);
return;
}

Expand Down Expand Up @@ -108,6 +109,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
out.println(new ApiError(STOPPED).toString());
return;
}

chain.doFilter(request, response);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,10 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha

@Override
public void destroy() {
// TODO Auto-generated method stub

}

@Override
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub

}
}
24 changes: 24 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/WEB-INF/beans.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
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.
-->
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
version="1.1" bean-discovery-mode="annotated">
</beans>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
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.
-->
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider"/>
<module name="org.jboss.resteasy.resteasy-jettison-provider"/>
</exclusions>
<dependencies>
<module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
24 changes: 24 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/WEB-INF/jboss-web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
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.
-->
<jboss-web>
<context-root>/hawkular/metrics</context-root>
<!-- see https://community.jboss.org/wiki/JBossAS7SecurityAuditing for the next tag -->
<!--<disable-audit>false</disable-audit>-->
</jboss-web>
70 changes: 70 additions & 0 deletions api/metrics-api-jaxrs-1.1/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
and other contributors as indicated by the @author tags.
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="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">

<display-name>Hawkular Metrics Rest interface - JAX-RS 1.1</display-name>

<context-param>
<param-name>hawkular.metrics.version</param-name>
<param-value>${project.version}</param-value>
</context-param>

<context-param>
<param-name>resteasy.media.type.mappings</param-name>
<param-value>html : text/html, json : application/json, xml : application/xml, csv : text/csv, txt: text/plain,
yaml: application/yaml, jsonw: application/vnd.hawkular.wrapped+json
</param-value>
</context-param>

<!--context-param>
<param-name>resteasy.providers</param-name>
<param-value>org.hawkular.metrics.api.jaxrs.util.JacksonConfig</param-value>
</context-param-->

<filter>
<filter-name>TenantFilter</filter-name>
<filter-class>org.hawkular.metrics.api.jaxrs.filter.TenantFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>TenantFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.hawkular.metrics.api.jaxrs.filter.CorsFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

<filter>
<filter-name>MetricsServiceStateFilter</filter-name>
<filter-class>org.hawkular.metrics.api.jaxrs.filter.MetricsServiceStateFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>MetricsServiceStateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
9 changes: 8 additions & 1 deletion rest-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@
<type>war</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>hawkular-metrics-api-jaxrs-1.1</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
Expand Down Expand Up @@ -200,7 +207,7 @@
</goals>
<configuration>
<groupId>${project.groupId}</groupId>
<artifactId>hawkular-metrics-api-jaxrs</artifactId>
<artifactId>hawkular-metrics-api-jaxrs-1.1</artifactId>
<name>hawkular-metric-rest.war</name>
</configuration>
</execution>
Expand Down

0 comments on commit 05c35a3

Please sign in to comment.