Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*******************************************************************************/
package org.apache.wink.server.internal.contexts;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import javax.servlet.FilterConfig;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.PathSegment;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import org.apache.wink.common.internal.MultivaluedMapImpl;
import org.apache.wink.common.internal.PathSegmentImpl;
import org.apache.wink.common.internal.i18n.Messages;
import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
import org.apache.wink.common.internal.uri.UriEncoder;
import org.apache.wink.common.internal.utils.UriHelper;
import org.apache.wink.server.handlers.MessageContext;
import org.apache.wink.server.internal.handlers.SearchResult;
import org.apache.wink.server.internal.registry.ResourceInstance;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class UriInfoImpl implements UriInfo {
private static final Logger logger = LoggerFactory.getLogger(UriInfoImpl.class);
private MessageContext messageContext;
private URI absolutePath;
private URI baseUri;
private String baseUriString;
private String path;
private MultivaluedMap pathParameters;
private MultivaluedMap decodedPathParameters;
private MultivaluedMap queryParameters;
private MultivaluedMap decodedQueryParameters;
private List pathSegments;
private List decodedPathSegments;
private List matchedURIsStrings;
private List decodedMatchedURIsStrings;
public UriInfoImpl(MessageContext msgContext) {
messageContext = msgContext;
absolutePath = null;
baseUri = null;
baseUriString = null;
path = null;
pathParameters = null;
pathSegments = null;
decodedPathSegments = null;
matchedURIsStrings = null;
decodedMatchedURIsStrings = null;
}
public URI getAbsolutePath() {
if (absolutePath == null) {
String requestPath = getPath(false);
absolutePath = getBaseUri().resolve(requestPath);
}
logger.trace("getAbsolutePath() returning: {}", absolutePath); //$NON-NLS-1$
return absolutePath;
}
public UriBuilder getAbsolutePathBuilder() {
UriBuilder builder = UriBuilder.fromUri(getAbsolutePath());
logger.trace("getAbsolutePathBuilder() returning: {}", builder); //$NON-NLS-1$
return builder;
}
public URI getBaseUri() {
if (baseUri == null) {
String baseUriString = getBaseUriString();
try {
baseUri = new URI(baseUriString);
} catch (URISyntaxException e) {
if (logger.isErrorEnabled()) {
logger.error(Messages.getMessage("uriBadBaseURI", baseUriString), e); //$NON-NLS-1$
}
}
}
logger.trace("getBaseUri() returning: {}", baseUri); //$NON-NLS-1$
return baseUri;
}
public UriBuilder getBaseUriBuilder() {
UriBuilder builder = UriBuilder.fromUri(getBaseUri());
logger.trace("getBaseUriBuilder() returning: {}", builder); //$NON-NLS-1$
return builder;
}
public List getMatchedResourceInstances() {
List resources =
Collections.unmodifiableList(messageContext.getAttribute(SearchResult.class).getData()
.getMatchedResources());
logger.trace("getMatchedResourceInstances() returning: {}", resources); //$NON-NLS-1$
return resources;
}
public List