package com.topsy.jmxproxy;

import com.google.common.base.Optional;

import com.topsy.jmxproxy.core.Host;
import com.topsy.jmxproxy.jmx.ConnectionManager;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.WebApplicationException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Path("/{host}:{port:\\d+}")
@Produces(MediaType.APPLICATION_JSON)
public class JMXProxyResource {
    private static final Logger LOG = LoggerFactory.getLogger(JMXProxyResource.class);

    private final ConnectionManager manager;

    public JMXProxyResource(ConnectionManager manager) {
        this.manager = manager;
    }

    @GET
    public Host getJMXHostData(@PathParam("host") String hostName, @PathParam("port") int port, @QueryParam("domains") Optional<Boolean> includeDomains) {
        LOG.debug("fetching jmx data for " + hostName + ":" + port + " (domains:" + includeDomains.or(false) + ")");

        try {
            Host host = manager.getHost(hostName + ":" + port);
            host.toggleDomains(includeDomains.or(false));
            return host;
        } catch (Exception e) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
    }
}

@@ -26,49 +26,8 @@
 y;%0A%0A
-import com.google.common.base.Optional;%0A%0A
 impo
@@ -109,16 +109,107 @@
 nager;%0A%0A
+import com.yammer.dropwizard.jersey.params.BooleanParam;%0A%0Aimport javax.ws.rs.DefaultValue;%0A
 import j
@@ -973,34 +973,32 @@
 s%22) 
-Optional%3CBoolean%3E includeD
+@DefaultValue(%22false%22) d
 omai
@@ -1087,39 +1087,28 @@
 ins:%22 + 
-includeDomains.or(false
+domains.get(
 ) + %22)%22)
@@ -1223,31 +1223,20 @@
 ins(
-includeDomains.or(false
+domains.get(
 ));%0A

Use @DefaultValue() instead of @Optional for better clarity.