Skip to content
cen1 edited this page Nov 12, 2020 · 1 revision

Kumuluz uses Jersey as the JAX-RS implementation with no changes in default configuration. You can change Jersey settings by overriding getProperties() method in your javax.ws.rs.core.Application class. The example below shows how to disable WADL generation and enable the multipart feature. Full list of Jersey configuration options can be found here.

package com.kumuluzee.samples.rest;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

@ApplicationPath("")
public class RestApplication extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> classes = new HashSet<>();

        classes.add(MyRestResource.class);
        classes.add(MyExceptionMapper.class);

        return classes;
    }

    @Override
    public Map<String, Object> getProperties() {
        Map<String, Object> props = new HashMap<>();

        props.put("jersey.config.server.provider.classnames", "org.glassfish.jersey.media.multipart.MultiPartFeature");
        props.put("jersey.config.server.wadl.disableWadl", "true");

        return props;
    }
}
Clone this wiki locally