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


Java Reference.setPath方法代碼示例

本文整理匯總了Java中org.restlet.data.Reference.setPath方法的典型用法代碼示例。如果您正苦於以下問題:Java Reference.setPath方法的具體用法?Java Reference.setPath怎麽用?Java Reference.setPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.restlet.data.Reference的用法示例。


在下文中一共展示了Reference.setPath方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createInboundRoot

import org.restlet.data.Reference; //導入方法依賴的package包/類
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {            
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
開發者ID:xuraylei,項目名稱:fresco_floodlight,代碼行數:27,代碼來源:RestApiServer.java

示例2: createInboundRoot

import org.restlet.data.Reference; //導入方法依賴的package包/類
@Override
public Restlet createInboundRoot() {
    Router baseRouter = new Router(context);
    baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
    for (RestletRoutable rr : restlets) {
        baseRouter.attach(rr.basePath(), rr.getRestlet(context));
    }

    Filter slashFilter = new Filter() {            
        @Override
        protected int beforeHandle(Request request, Response response) {
            Reference ref = request.getResourceRef();
            String originalPath = ref.getPath();
            if (originalPath.contains("//"))
            {
                String newPath = originalPath.replaceAll("/+", "/");
                ref.setPath(newPath);
            }
            return Filter.CONTINUE;
        }

    };
    slashFilter.setNext(baseRouter);
    
    return slashFilter;
}
 
開發者ID:JianqingJiang,項目名稱:QoS-floodlight,代碼行數:27,代碼來源:RestApiServer.java

示例3: newClient

import org.restlet.data.Reference; //導入方法依賴的package包/類
public synchronized ContextResourceClient newClient( String relativePath )
{
    if( relativePath.startsWith( "http://" ) )
    {
        return contextResourceFactory.newClient( new Reference( relativePath ) );
    }

    Reference reference = this.reference.clone();
    if( relativePath.startsWith( "/" ) )
    {
        reference.setPath( relativePath );
    }
    else
    {
        reference.setPath( reference.getPath() + relativePath );
        reference = reference.normalize();
    }

    return contextResourceFactory.newClient( reference );
}
 
開發者ID:apache,項目名稱:polygene-java,代碼行數:21,代碼來源:ContextResourceClient.java

示例4: getReference

import org.restlet.data.Reference; //導入方法依賴的package包/類
public URL getReference(final Reference baseRef, String query, List<?> parts) {

        if (!refCache.containsKey(baseRef)) {
            refCache.put(baseRef, prepareReference(baseRef));
        }
        Reference r = new Reference(refCache.get(baseRef));
        
        String currPath = r.getPath();
        StringBuilder sb = new StringBuilder(currPath == null ? "" : currPath);
        for (Object pe : parts) {
            if (pe instanceof String && ((String) pe).startsWith("/")) {
                sb.append(pe);
            } else {
                sb.append("/").append(pe);
            }
        }
        r.setPath(sb.toString());
        
        if (query != null) {
            r.setQuery(query);
        }
        
        return r.toUrl();
    }
 
開發者ID:valdasraps,項目名稱:resthub,代碼行數:25,代碼來源:ServerAppConfig.java

示例5: createInboundRoot

import org.restlet.data.Reference; //導入方法依賴的package包/類
@Override
public Restlet createInboundRoot() {
    Router baseRouter = new Router(context);
    baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
    for (RestletRoutable rr : restlets) {
        baseRouter.attach(rr.basePath(), rr.getRestlet(context));
    }

    Filter slashFilter = new Filter() {
        @Override
        protected int beforeHandle(Request request, Response response) {
            Reference ref = request.getResourceRef();
            String originalPath = ref.getPath();
            if (originalPath.contains("//")) {
                String newPath = originalPath.replaceAll("/+", "/");
                ref.setPath(newPath);
            }
            return Filter.CONTINUE;
        }

    };
    slashFilter.setNext(baseRouter);

    return slashFilter;
}
 
開發者ID:opennetworkinglab,項目名稱:spring-open,代碼行數:26,代碼來源:RestApiServer.java

示例6: handle

import org.restlet.data.Reference; //導入方法依賴的package包/類
public Response handle(final Restlet resource, final Request request) throws Exception {
	String path = null;
	Reference ref = request.getResourceRef();
	path = this.hostReference.toString() + ref;

	ref.setPath(path);

	return execute(resource, new ICallBack<Response>() {

		@Override
		public Response execute() throws Exception {
			request.setHostRef(hostReference);
			Response response = component.getContext().getServerDispatcher().handle(request);
			return response;
		}

	});
}
 
開發者ID:devacfr,項目名稱:spring-restlet,代碼行數:19,代碼來源:AbstractResourceTest.java

示例7: createInboundRoot

import org.restlet.data.Reference; //導入方法依賴的package包/類
@Override
public Restlet createInboundRoot() {
	Router baseRouter = new Router(context);
	baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
	for (RestletRoutable rr : restlets) {
		baseRouter.attach(rr.basePath(), rr.getRestlet(context));
	}

	Filter slashFilter = new Filter() {
		@Override
		protected int beforeHandle(Request request, Response response) {
			Reference ref = request.getResourceRef();
			String originalPath = ref.getPath();
			if (originalPath.contains("//"))
			{
				String newPath = originalPath.replaceAll("/+", "/");
				ref.setPath(newPath);
			}
			return Filter.CONTINUE;
		}

	};
	slashFilter.setNext(baseRouter);

	return slashFilter;
}
 
開發者ID:zhenshengcai,項目名稱:floodlight-hardware,代碼行數:27,代碼來源:RestApiServer.java

示例8: createInboundRoot

import org.restlet.data.Reference; //導入方法依賴的package包/類
/**
 * Sets up the Restlet for the APIs under test using a Router.  Also, a
 * filter is installed to deal with double slashes in URLs.
 * This code is adapted from
 * net.floodlightcontroller.restserver.RestApiServer
 *
 * @return Router object for the APIs under test.
 */
@Override
public Restlet createInboundRoot() {
    Router baseRouter = new Router(context);
    baseRouter.setDefaultMatchingMode(Template.MODE_STARTS_WITH);
    for (RestletRoutable rr : restlets) {
        baseRouter.attach(rr.basePath(), rr.getRestlet(context));
    }

    /**
     * Filter out multiple slashes in URLs to make them a single slash.
     */
    Filter slashFilter = new Filter() {
        @Override
        protected int beforeHandle(Request request, Response response) {
            Reference ref = request.getResourceRef();
            String originalPath = ref.getPath();
            if (originalPath.contains("//")) {
                String newPath = originalPath.replaceAll("/+", "/");
                ref.setPath(newPath);
            }
            return Filter.CONTINUE;
        }

    };
    slashFilter.setNext(baseRouter);

    return slashFilter;
}
 
開發者ID:opennetworkinglab,項目名稱:spring-open,代碼行數:37,代碼來源:TestRestApiServer.java

示例9: buildAddress

import org.restlet.data.Reference; //導入方法依賴的package包/類
private String buildAddress(final ExtensionInfo extensionInfo, final String path) {
    final Reference ref = new Reference(extensionInfo.getBaseUrl());
    ref.setPath(path);
    return ref.toString();
}
 
開發者ID:blackducksoftware,項目名稱:hub-email-extension,代碼行數:6,代碼來源:ExtensionInfoServerResource.java


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