A developer may choose not to expose a Web Application
Description Language (WADL) document for a resource so that they do
not expose information about the service. Information about the service
might be better obtained via a document provided by the developer
outside of the service.
About this task
By default, a WADL document can be requested for a particular
resource by invoking an HTTP OPTIONS request for any Java™ API for RESTful Web Services (JAX-RS) URL.
You can issue an OPTIONS request with most HTTP clients. However,
if you do not like this behavior and want to merely return an empty
document for any OPTIONS request by default, you can disable the default
WADL generation for your application.
In the following example,
you can disable the default WADL generation for your application.
Procedure
- Create a properties file that contains the custom properties
for the application. The following example illustrates
a simple properties file:
org.apache.wink.server.options.handler=none
- Put the properties file in your application.
- Use the propertiesLocation initialization
parameter in the web.xml file. The
following example illustrates a web.xml file
with the propertiesLocation initialization parameter.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/
XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/
j2ee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<load-on-startup>1</load-on-startup>
<init-param>
<param-name>propertiesLocation</param-name>
<param-value>path/to/file.properties</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>javax.ws.rs.core.Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Results
You have disabled the default WADL generation for your
application.