2 * Copyright (c) 2017 Inocybe Technologies and others. All rights reserved.
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
8 package org.opendaylight.restconf.common.util;
11 import java.util.Collections;
12 import java.util.List;
13 import javax.ws.rs.core.MultivaluedMap;
14 import javax.ws.rs.core.PathSegment;
15 import javax.ws.rs.core.UriBuilder;
16 import javax.ws.rs.core.UriInfo;
19 * Simple implementation of the {@link UriInfo} interface.
21 * @author Thomas Pantelis
23 public class SimpleUriInfo implements UriInfo {
24 private final String path;
25 private final MultivaluedMap<String, String> queryParams;
27 public SimpleUriInfo(String path) {
28 this(path, new MultivaluedHashMap<>());
31 public SimpleUriInfo(String path, MultivaluedMap<String, String> queryParams) {
33 this.queryParams = queryParams;
37 public String getPath() {
42 public String getPath(boolean decode) {
47 public List<PathSegment> getPathSegments() {
48 throw new UnsupportedOperationException();
52 public List<PathSegment> getPathSegments(boolean decode) {
53 throw new UnsupportedOperationException();
57 public URI getRequestUri() {
58 return URI.create(path);
62 public UriBuilder getRequestUriBuilder() {
63 return UriBuilder.fromUri(getRequestUri());
67 public URI getAbsolutePath() {
68 return getRequestUri();
72 public UriBuilder getAbsolutePathBuilder() {
73 return UriBuilder.fromUri(getAbsolutePath());
77 public URI getBaseUri() {
78 return URI.create("");
82 public UriBuilder getBaseUriBuilder() {
83 return UriBuilder.fromUri(getBaseUri());
87 public MultivaluedMap<String, String> getPathParameters() {
88 return new MultivaluedHashMap<>();
92 public MultivaluedMap<String, String> getPathParameters(boolean decode) {
93 return getPathParameters();
97 public MultivaluedMap<String, String> getQueryParameters() {
102 public MultivaluedMap<String, String> getQueryParameters(boolean decode) {
103 return getQueryParameters();
107 public List<String> getMatchedURIs() {
108 return Collections.emptyList();
112 public List<String> getMatchedURIs(boolean decode) {
113 return getMatchedURIs();
117 public List<Object> getMatchedResources() {
118 return Collections.emptyList();
122 public URI resolve(URI uri) {
127 public URI relativize(URI uri) {