當前位置: 首頁>>代碼示例>>Java>>正文


Java UriInfo.getRequestUri方法代碼示例

本文整理匯總了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();
}
 
開發者ID:phoenixctms,項目名稱:ctsms,代碼行數:23,代碼來源:FileDavResourceBase.java

示例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;
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:22,代碼來源:CellEsImpl.java

示例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;
}
 
開發者ID:trajano,項目名稱:app-ms,代碼行數:37,代碼來源:ClonableSwagger.java


注:本文中的javax.ws.rs.core.UriInfo.getRequestUri方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。