-
- try {
- InetAddress.getByName(networkAddress);
- } catch (UnknownHostException e) {
- throw new UnsupportedMediaTypeException(networkAddress + " "
- + RestMessages.INVALIDADDRESS.toString());
- }
- if(!networkAddress.equals(hc.getNetworkAddress())) {
- throw new UnsupportedMediaTypeException(networkAddress + " is not the same as "
- + hc.getNetworkAddress());
- }
- if(!hc.isStaticHost()) {
- throw new UnsupportedMediaTypeException("StaticHost flag must be true");
+ if (!hc.isStaticHost()) {
+ return Response.status(Response.Status.BAD_REQUEST)
+ .entity("Can only add static host.")
+ .build();