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


Java Reference.getPath方法代碼示例

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


在下文中一共展示了Reference.getPath方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getMediaDir

import org.restlet.data.Reference; //導入方法依賴的package包/類
protected File getMediaDir(Map<String,Object> attributes) {
   Object o = attributes.get(CollectionBaseRestlet.MEDIA_HREF_ATTR);
   if (o==null) {
      return defaultMediaDir;
   }
   Reference dirMediaRef = new Reference(o.toString());
   if (dirMediaRef.getScheme().equals("file")) {
      File mediaDir = new File(dirMediaRef.getPath());
      if (mediaDir.exists()) {
         if (!mediaDir.isDirectory()) {
            getLogger().severe("Media directory "+mediaDir+" is not a directory.");
            mediaDir = null;
         }
      } else {
         getLogger().severe("Media directory "+mediaDir+" does not exist.");
         mediaDir = null;
      }
      return mediaDir;
   } else {
      return null;
   }
}
 
開發者ID:alexmilowski,項目名稱:xproclet,代碼行數:23,代碼來源:FileMediaStorage.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: 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

示例7: getIdentityPath

import org.restlet.data.Reference; //導入方法依賴的package包/類
private String getIdentityPath( Reference ref )
{
    String path = ref.getPath();
    if( !path.endsWith( "/" ) )
    {
        path = path.substring( 0, path.lastIndexOf( '/' ) + 1 );
    }
    return path;
}
 
開發者ID:apache,項目名稱:polygene-java,代碼行數:10,代碼來源:ClientCache.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


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