org.glassfish.grizzly.servlet.WebappContext.normalize()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(83)

本文整理了Java中org.glassfish.grizzly.servlet.WebappContext.normalize()方法的一些代码示例,展示了WebappContext.normalize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebappContext.normalize()方法的具体详情如下:
包路径:org.glassfish.grizzly.servlet.WebappContext
类名称:WebappContext
方法名:normalize

WebappContext.normalize介绍

[英]Return a context-relative path, beginning with a "/", that represents the canonical version of the specified path after ".." and "." elements are resolved out. If the specified path attempts to go outside the boundaries of the current context (i.e. too many ".." path elements are present), return null instead.
[中]返回上下文相对路径,以“/”开头,表示“.”之后指定路径的规范版本“和”元素被分解了。如果指定路径试图超出当前上下文的边界(即太多“)如果存在路径元素,则返回null

代码示例

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public InputStream getResourceAsStream(String path) {
  String pathLocal = normalize(path);
  if (pathLocal == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (pathLocal.length() > 1) {
    pathLocal = pathLocal.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResourceAsStream(pathLocal);
}

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

/**
 * {@inheritDoc}
 */
@Override
public URL getResource(String path) throws MalformedURLException {
  if (path == null || !path.startsWith("/")) {
    throw new MalformedURLException(path);
  }
  path = normalize(path);
  if (path == null) {
    return (null);
  }
  // Help the UrlClassLoader, which is not able to load resources
  // that contains '//'
  if (path.length() > 1) {
    path = path.substring(1);
  }
  return Thread.currentThread().getContextClassLoader().getResource(path);
}

代码示例来源:origin: javaee/grizzly

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: javaee/grizzly

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: javaee/grizzly

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: org.glassfish.grizzly/grizzly-websockets-server

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: javaee/grizzly

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: javaee/grizzly

path = normalize(path);
if (path == null) {
  return (null);

代码示例来源:origin: javaee/grizzly

path = path.substring(0, pos);
path = normalize(path);
if (path == null)
  return null;

代码示例来源:origin: javaee/grizzly

path = path.substring(0, pos);
path = normalize(path);
if (path == null)
  return null;

相关文章

WebappContext类方法