Network Deployment (Distributed operating systems), v8.0 > End-to-end paths > Web services - RESTful services > Use WADL to generate service documentation > 4. Use WADL to generate service documentation.


Disable 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.

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. We 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 the application.

In the following example, you can disable the default WADL generation for the 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 the 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.
Serving a WADL document for your resources
Use WADL to generate service documentation


Related


Web services specifications and APIs

+

Search Tips   |   Advanced Search