本文整理汇总了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;
}