org.ocpsoft.logging.Logger.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(287)

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

Logger.warn介绍

暂无

代码示例

代码示例来源:origin: ocpsoft/rewrite

  1. protected void closeQuietly(Closeable closeable)
  2. {
  3. try
  4. {
  5. closeable.close();
  6. }
  7. catch (IOException e)
  8. {
  9. logger.warn(e.getMessage(), e);
  10. }
  11. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLEncoder.encode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not encode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-api-servlet

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLEncoder.encode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not encode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLEncoder.encode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not encode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLDecoder.decode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not decode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-api-servlet

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLDecoder.decode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not decode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String encode(final String value)
  3. {
  4. try {
  5. return URLDecoder.decode(value, "UTF-8");
  6. }
  7. catch (UnsupportedEncodingException e) {
  8. throw new RewriteException("Encoding type UTF-8 is not supported by this JVM.", e);
  9. }
  10. catch (IllegalArgumentException e)
  11. {
  12. log.warn("Could not decode query parameter: " + value);
  13. return value;
  14. }
  15. }
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String getBeanName(Class<?> clazz)
  3. {
  4. Set<Bean<?>> beans = beanManager.getBeans(clazz);
  5. // no matching beans, the BeanManager doesn't know something about this class
  6. if (beans == null || beans.size() == 0) {
  7. return null;
  8. }
  9. // more than one result -> warn the user
  10. else if (beans.size() > 1) {
  11. log.warn("The BeanManager returns more than one name for [{}]", clazz.getName());
  12. return null;
  13. }
  14. // exactly one result -> we got a name
  15. else {
  16. return beans.iterator().next().getName();
  17. }
  18. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public void findClasses(ClassVisitor visitor)
  3. {
  4. try
  5. {
  6. // get the absolute URL of the classes folder
  7. URL classesFolderUrl = servletContext.getResource(CLASSES_FOLDER);
  8. // abort if classes folder is missing
  9. if (classesFolderUrl == null)
  10. {
  11. log.warn("Cannot find classes folder: " + CLASSES_FOLDER);
  12. return;
  13. }
  14. // call recursive directory processing method
  15. processDirectory(classesFolderUrl, CLASSES_FOLDER, visitor);
  16. }
  17. catch (MalformedURLException e)
  18. {
  19. throw new IllegalStateException("Invalid URL: " + e.getMessage(), e);
  20. }
  21. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public void findClasses(ClassVisitor visitor)
  3. {
  4. try
  5. {
  6. // get the absolute URL of the classes folder
  7. URL classesFolderUrl = servletContext.getResource(CLASSES_FOLDER);
  8. // abort if classes folder is missing
  9. if (classesFolderUrl == null)
  10. {
  11. log.warn("Cannot find classes folder: " + CLASSES_FOLDER);
  12. return;
  13. }
  14. // call recursive directory processing method
  15. processDirectory(classesFolderUrl, CLASSES_FOLDER, visitor);
  16. }
  17. catch (MalformedURLException e)
  18. {
  19. throw new IllegalStateException("Invalid URL: " + e.getMessage(), e);
  20. }
  21. }

代码示例来源:origin: org.jboss.windup.web.addons/windup-web-support-impl

  1. private static List<String> findPaths(Path path, boolean relativeOnly)
  2. {
  3. List<String> results = new ArrayList<>();
  4. results.add(path.normalize().toAbsolutePath().toString());
  5. if (Files.isDirectory(path))
  6. {
  7. try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path))
  8. {
  9. for (Path child : directoryStream)
  10. {
  11. results.addAll(findPaths(child, relativeOnly));
  12. }
  13. }
  14. catch (IOException e)
  15. {
  16. Logger.getLogger(PackageDiscoveryServiceImpl.class).warn("Could not read file: " + path + " due to: " + e.getMessage());
  17. }
  18. }
  19. else if (Files.isRegularFile(path) && ZipUtil.endsWithZipExtension(path.toString()))
  20. {
  21. results.addAll(ZipUtil.scanZipFile(path, relativeOnly));
  22. }
  23. return results;
  24. }
  25. }

代码示例来源:origin: ocpsoft/rewrite

  1. @SuppressWarnings("unchecked")
  2. private static List<ExpressionLanguageProvider> getProviders()
  3. {
  4. if (_providers == null)
  5. {
  6. synchronized (El.class)
  7. {
  8. if (_providers == null)
  9. {
  10. _providers = Iterators.asList(ServiceLoader.load(ExpressionLanguageProvider.class));
  11. Collections.sort(_providers, new WeightedComparator());
  12. if (_providers.isEmpty())
  13. {
  14. log.warn("No instances of [{}] were configured. EL support is disabled.",
  15. ExpressionLanguageProvider.class.getName());
  16. }
  17. }
  18. }
  19. }
  20. return _providers;
  21. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-api-el

  1. @SuppressWarnings("unchecked")
  2. private static List<ExpressionLanguageProvider> getProviders()
  3. {
  4. if (_providers == null)
  5. {
  6. synchronized (El.class)
  7. {
  8. if (_providers == null)
  9. {
  10. _providers = Iterators.asList(ServiceLoader.load(ExpressionLanguageProvider.class));
  11. Collections.sort(_providers, new WeightedComparator());
  12. if (_providers.isEmpty())
  13. {
  14. log.warn("No instances of [{}] were configured. EL support is disabled.",
  15. ExpressionLanguageProvider.class.getName());
  16. }
  17. }
  18. }
  19. }
  20. return _providers;
  21. }

代码示例来源:origin: ocpsoft/rewrite

  1. @SuppressWarnings("unchecked")
  2. private static List<ExpressionLanguageProvider> getProviders()
  3. {
  4. if (_providers == null)
  5. {
  6. synchronized (El.class)
  7. {
  8. if (_providers == null)
  9. {
  10. _providers = Iterators.asList(ServiceLoader.load(ExpressionLanguageProvider.class));
  11. Collections.sort(_providers, new WeightedComparator());
  12. if (_providers.isEmpty())
  13. {
  14. log.warn("No instances of [{}] were configured. EL support is disabled.",
  15. ExpressionLanguageProvider.class.getName());
  16. }
  17. }
  18. }
  19. }
  20. return _providers;
  21. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public List<ServletRegistration> getServletRegistrations(ServletContext context)
  3. {
  4. InputStream webXmlStream = context.getResourceAsStream("/WEB-INF/web.xml");
  5. if (webXmlStream != null) {
  6. try {
  7. WebXmlServletRegistrationParser parser = new WebXmlServletRegistrationParser();
  8. parser.parse(webXmlStream);
  9. return parser.getRegistrations();
  10. }
  11. catch (IOException e) {
  12. log.warn("Failed to parse web.xml to look for servlet registations", e);
  13. }
  14. }
  15. return null;
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public List<ServletRegistration> getServletRegistrations(ServletContext context)
  3. {
  4. InputStream webXmlStream = context.getResourceAsStream("/WEB-INF/web.xml");
  5. if (webXmlStream != null) {
  6. try {
  7. WebXmlServletRegistrationParser parser = new WebXmlServletRegistrationParser();
  8. parser.parse(webXmlStream);
  9. return parser.getRegistrations();
  10. }
  11. catch (IOException e) {
  12. log.warn("Failed to parse web.xml to look for servlet registations", e);
  13. }
  14. }
  15. return null;
  16. }

代码示例来源:origin: ocpsoft/rewrite

  1. public Boolean isDevelopmentMode(ServletContext servletContext)
  2. {
  3. try {
  4. return !ProjectStage.Production.equals(FacesFactory.getApplication().getProjectStage());
  5. }
  6. catch (Exception e) {
  7. log.warn("Could not determine project stage due to underlying exception.", e);
  8. return false;
  9. }
  10. }

代码示例来源:origin: org.ocpsoft.rewrite/rewrite-impl-servlet

  1. @Override
  2. public String encodeURL(final String url)
  3. {
  4. /*
  5. * In some situations "url" may be not valid according to the rules defined in the RFC.
  6. * In this case AddressBuilder.create() will fail. In these situations we basically
  7. * skip outbound rewriting and just return the result of the super class.
  8. */
  9. Address address;
  10. try
  11. {
  12. address = AddressBuilder.create(url);
  13. }
  14. catch (IllegalArgumentException e) {
  15. log.warn("Skipping outbound rewriting of invalid URL: " + url);
  16. return super.encodeURL(url);
  17. }
  18. OutboundServletRewrite<ServletRequest, ServletResponse, Address> event = rewrite(address);
  19. if (event.getFlow().is(ServletRewriteFlow.ABORT_REQUEST))
  20. {
  21. return event.getOutboundAddress().toString();
  22. }
  23. return super.encodeURL(event.getOutboundAddress().toString());
  24. }

代码示例来源:origin: ocpsoft/rewrite

  1. @Override
  2. public String encodeURL(final String url)
  3. {
  4. /*
  5. * In some situations "url" may be not valid according to the rules defined in the RFC.
  6. * In this case AddressBuilder.create() will fail. In these situations we basically
  7. * skip outbound rewriting and just return the result of the super class.
  8. */
  9. Address address;
  10. try
  11. {
  12. address = AddressBuilder.create(url);
  13. }
  14. catch (IllegalArgumentException e) {
  15. log.warn("Skipping outbound rewriting of invalid URL: " + url);
  16. return super.encodeURL(url);
  17. }
  18. OutboundServletRewrite<ServletRequest, ServletResponse, Address> event = rewrite(address);
  19. if (event.getFlow().is(ServletRewriteFlow.ABORT_REQUEST))
  20. {
  21. return event.getOutboundAddress().toString();
  22. }
  23. return super.encodeURL(event.getOutboundAddress().toString());
  24. }

代码示例来源:origin: ocpsoft/rewrite

  1. private void checkConfLocal(final Conf conf)
  2. {
  3. if (conf.isOk() && conf.isEngineEnabled()) {
  4. urlRewriter = new UrlRewriter(conf);
  5. log.debug("Tuckey UrlRewriteFilter configuration loaded (Status: OK)");
  6. }
  7. else {
  8. if (!conf.isOk()) {
  9. log.error("Tuckey UrlRewriteFilter configuration failed (Status: ERROR)");
  10. }
  11. if (!conf.isEngineEnabled()) {
  12. log.warn("Tuckey UrlRewriteFilter engine explicitly disabled in configuration");
  13. }
  14. if (urlRewriter != null) {
  15. log.debug("Tuckey UrlRewriteFilter configuration unloaded");
  16. urlRewriter = null;
  17. }
  18. }
  19. }

相关文章