Split out operation output serialization
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / nb / jaxrs / JsonReplyBodyWriter.java
1 /*
2  * Copyright (c) 2024 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.restconf.nb.jaxrs;
9
10 import java.io.IOException;
11 import java.io.OutputStream;
12 import javax.ws.rs.Produces;
13 import javax.ws.rs.core.MediaType;
14 import javax.ws.rs.ext.Provider;
15 import org.opendaylight.restconf.api.MediaTypes;
16 import org.opendaylight.restconf.server.api.ReplyBody;
17
18 @Provider
19 @Produces({ MediaTypes.APPLICATION_YANG_DATA_JSON, MediaType.APPLICATION_JSON })
20 public final class JsonReplyBodyWriter extends ReplyBodyWriter {
21     @Override
22     void writeTo(final ReplyBody body, final OutputStream out) throws IOException {
23         body.writeJSON(out);
24     }
25 }