本文整理匯總了Java中javax.ws.rs.core.UriInfo.getRequestUri方法的典型用法代碼示例。如果您正苦於以下問題:Java UriInfo.getRequestUri方法的具體用法?Java UriInfo.getRequestUri怎麽用?Java UriInfo.getRequestUri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.ws.rs.core.UriInfo
的用法示例。
在下文中一共展示了UriInfo.getRequestUri方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: davPropFind
import javax.ws.rs.core.UriInfo; //導入方法依賴的package包/類
protected javax.ws.rs.core.Response davPropFind(Long id, UriInfo uriInfo, String depth, Providers providers) throws AuthenticationException, AuthorisationException,
ServiceException {
final Response folder = new Response(new HRef(uriInfo.getRequestUri()), null, null, null, new PropStat(new Prop(new DisplayName("My Collection"),
new CreationDate(new Date()), new GetLastModified(new Date()), COLLECTION), new Status((StatusType) OK)));
if (depth.equals(DEPTH_0) || id == null) {
return javax.ws.rs.core.Response.status(MULTI_STATUS).entity(new MultiStatus(folder)).build();
}
final Collection<Response> responses = new LinkedList<Response>(singletonList(folder));
Iterator<FileOutVO> it = WebUtil.getServiceLocator().getFileService().getFiles(getAuth(), getFileModule(), id, null, null, null).iterator();
if (it != null) {
while (it.hasNext()) {
FileOutVO out = it.next();
// responses.add(buildResponse(f, uriInfo.getAbsolutePathBuilder().path(format("%s", c.getMatchCode())).build(), providers));
FilePathSplitter filePath = new FilePathSplitter(out.getFileName());
String extension = filePath.getExtension();
if (isTempFile(extension) || isEditableFile(extension)) {
responses.add(buildResponse(out, uriInfo.getAbsolutePathBuilder().path(getDavFileName(out)).build(), providers));
}
}
}
return javax.ws.rs.core.Response.status(MULTI_STATUS).entity(new MultiStatus(responses.toArray(new Response[0]))).build();
}
示例2: load
import javax.ws.rs.core.UriInfo; //導入方法依賴的package包/類
/**
* Load cell info.
* @param uriInfo UriInfo
* @return CellObject. If Cell does not exist, it returns null.
*/
public static Cell load(UriInfo uriInfo) {
URI reqUri = uriInfo.getRequestUri();
URI baseUri = uriInfo.getBaseUri();
String rPath = reqUri.getPath();
String bPath = baseUri.getPath();
rPath = rPath.substring(bPath.length());
String[] paths = StringUtils.split(rPath, "/");
CellEsImpl cell = (CellEsImpl) findCell("s.Name.untouched", paths[0]);
if (cell != null) {
cell.url = getBaseUri(uriInfo, cell.name);
cell.owner = UriUtils.convertSchemeFromLocalUnitToHttp(cell.getUnitUrl(), cell.owner);
}
return cell;
}
示例3: withUriInfo
import javax.ws.rs.core.UriInfo; //導入方法依賴的package包/類
/**
* Creates a shallow copy of the swagger but set the schemes, host and base path
* based on {@link UriInfo}.
*
* @param uriInfo
* URI info of the request.
* @return shallow copy
*/
public ClonableSwagger withUriInfo(final UriInfo uriInfo) {
final ClonableSwagger copy = new ClonableSwagger();
copy.swagger = swagger;
copy.info = info;
final URI requestUri = uriInfo.getRequestUri();
if (requestUri.getPort() != -1) {
copy.host = requestUri.getHost() + ":" + requestUri.getPort();
} else {
copy.host = requestUri.getHost();
}
copy.basePath = basePath;
copy.tags = tags;
copy.schemes = Collections.singletonList(Scheme.forValue(requestUri.getScheme()));
copy.consumes = consumes;
copy.produces = produces;
copy.security = security;
copy.paths = paths;
copy.securityDefinitions = securityDefinitions;
copy.definitions = definitions;
copy.parameters = parameters;
copy.responses = responses;
copy.externalDocs = externalDocs;
copy.vendorExtensions = vendorExtensions;
return copy;
}