Disabling generation of WADL documents for HTTP OPTIONS requests

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

  1. 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
  2. Put the properties file in your application.
  3. 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.

Task topic    

Terms and conditions for information centers | Feedback

Last updated: April 20, 2014 08:46 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-nd-mp&topic=twbs_jaxrs_wadl_http_options
File name: twbs_jaxrs_wadl_http_options.html