当前位置: 首页>>代码示例>>Java>>正文


Java UriComponent类代码示例

本文整理汇总了Java中com.sun.jersey.api.uri.UriComponent的典型用法代码示例。如果您正苦于以下问题:Java UriComponent类的具体用法?Java UriComponent怎么用?Java UriComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UriComponent类属于com.sun.jersey.api.uri包,在下文中一共展示了UriComponent类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configRequest

import com.sun.jersey.api.uri.UriComponent; //导入依赖的package包/类
private static <T> JerseyRequest<T> configRequest(JerseyRequest<T> request, String[] path, ErrorHandler errorHandler) {
    request.errorHandler = errorHandler != null ? errorHandler : new DefaultErrorHandler();
    boolean validatNnext = true;
    for (String pathElem : path) {
        if (validatNnext) {
            if (!UriComponent.valid(pathElem, UriComponent.Type.PATH_SEGMENT)) {
                pathElem = UriComponent.contextualEncode(pathElem, UriComponent.Type.PATH_SEGMENT);
            }
            if (pathElem.equals("inputControls")) {
                validatNnext = false;
            }
        } else {
            validatNnext = true;
        }
        request.setPath(pathElem);
    }

    return request;
}
 
开发者ID:Jaspersoft,项目名称:jrs-rest-java-client,代码行数:20,代码来源:JerseyRequest.java

示例2: createQueryInfo

import com.sun.jersey.api.uri.UriComponent; //导入依赖的package包/类
/**
 * QueryInfoを生成.
 * @param requestQuery requestQuery
 * @return requestQuery
 */
public static QueryInfo createQueryInfo(String requestQuery) {
    MultivaluedMap<String, String> queryParams = UriComponent.decodeQuery(requestQuery, true);
    Integer top = QueryParser.parseTopQuery(queryParams.getFirst("$top"));
    Integer skip = QueryParser.parseSkipQuery(queryParams.getFirst("$skip"));
    BoolCommonExpression filter = QueryParser.parseFilterQuery(queryParams.getFirst("$filter"));
    List<EntitySimpleProperty> select = QueryParser.parseSelectQuery(queryParams.getFirst("$select"));
    List<EntitySimpleProperty> expand = QueryParser.parseExpandQuery(queryParams.getFirst("$expand"));
    InlineCount inlineCount = QueryParser.parseInlinecountQuery(queryParams.getFirst("$inlinecount"));
    String skipToken = QueryParser.parseSkipTokenQuery(queryParams.getFirst("$skiptoken"));
    List<OrderByExpression> orderBy = QueryParser.parseOderByQuery(queryParams.getFirst("$orderby"));
    parseFullTextSearchQuery(queryParams.getFirst("q"));

    // $expand指定時は$topの最大値が変わるためチェックする
    if (expand != null && top != null && top > PersoniumUnitConfig.getTopQueryMaxSizeWithExpand()) {
        // Integerでそのまま値を返却すると、カンマが付くため、文字列でエラーメッセージを返却する
        throw PersoniumCoreException.OData.QUERY_INVALID_ERROR.params("$top", top.toString());
    }

    Map<String, String> customOptions = new HashMap<String, String>();
    customOptions.put("q", queryParams.getFirst("q"));
    QueryInfo queryInfo = new QueryInfo(
            inlineCount,
            top,
            skip,
            filter,
            orderBy,
            skipToken,
            customOptions,
            expand,
            select);
    return queryInfo;
}
 
开发者ID:personium,项目名称:personium-core,代码行数:38,代码来源:QueryParser.java

示例3: doFilter

import com.sun.jersey.api.uri.UriComponent; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
		throws ServletException, IOException {
	HttpServletRequest request = (HttpServletRequest) req;
	String httpMethod = request.getMethod();
	String requestURI = request.getRequestURI();
	String queryString = request.getQueryString();
	MultivaluedMap<String, String> queryParams;
	String interfaceName = null;
	String methodName = null;
	if (!Strings.isNullOrEmpty(queryString)) {
		queryParams = UriComponent.decodeQuery(queryString, true, true);
		interfaceName = queryParams.getFirst("interface");
		methodName = queryParams.getFirst("method");
	}
	
	if(Strings.isNullOrEmpty(interfaceName))
		interfaceName = "/";

	if ("GET".equals(httpMethod) && !Strings.isNullOrEmpty(interfaceName) && !Strings.isNullOrEmpty(methodName)) {
		if (!requestURI.endsWith("/"))
			requestURI += "/";
		final String newURI;
		if("/".equals(interfaceName))
			newURI = requestURI + methodName;
		else
		 newURI = requestURI + interfaceName + "/" + methodName;
		req.getRequestDispatcher(newURI).forward(req, res);

	} else {
		chain.doFilter(req, res);
	}
}
 
开发者ID:jkiddo,项目名称:ccow,代码行数:34,代码来源:UrlRewriteFilter.java

示例4: createMultivalueMap

import com.sun.jersey.api.uri.UriComponent; //导入依赖的package包/类
MultivaluedMapImpl createMultivalueMap( String paramName, String paramValue ) {
  MultivaluedMapImpl queryParams = new MultivaluedMapImpl();
  queryParams.add( paramName, UriComponent.encode( paramValue, UriComponent.Type.QUERY_PARAM ) );
  return queryParams;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:6,代码来源:Rest.java


注:本文中的com.sun.jersey.api.uri.UriComponent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。