Convert bierman02 from web.xml to programmtic web API
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / jersey / providers / spi / AbstractNormalizedNodeBodyReader.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, 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.rfc8040.jersey.providers.spi;
9
10 import com.google.common.annotations.Beta;
11 import javax.ws.rs.core.Request;
12 import javax.ws.rs.core.UriInfo;
13 import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
14 import org.opendaylight.restconf.common.context.NormalizedNodeContext;
15
16 /**
17  * Common superclass for readers producing {@link NormalizedNodeContext}.
18  *
19  * @author Robert Varga
20  */
21 @Beta
22 public abstract class AbstractNormalizedNodeBodyReader
23         extends AbstractIdentifierAwareJaxRsProvider<NormalizedNodeContext> {
24
25     public final void injectParams(final UriInfo uriInfo, final Request request) {
26         setUriInfo(uriInfo);
27         setRequest(request);
28     }
29
30     @Override
31     protected final NormalizedNodeContext emptyBody(final InstanceIdentifierContext<?> path) {
32         return new NormalizedNodeContext(path, null);
33     }
34 }