javax.servlet.http.HttpServletRequestWrapper.getServletContext()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(157)

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

HttpServletRequestWrapper.getServletContext介绍

暂无

代码示例

代码示例来源:origin: cloudfoundry/uaa

  1. @Override
  2. public ServletContext getServletContext() {
  3. return super.getServletContext();
  4. }

代码示例来源:origin: org.springframework.boot/spring-boot

  1. @Override
  2. public ServletContext getServletContext() {
  3. this.simulateGetMethod = false;
  4. return super.getServletContext();
  5. }

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

  1. @Override
  2. public String getServletPath() {
  3. if (servletPath == null) {
  4. try {
  5. Method m = ServletContext.class.getMethod("getFilterRegistration", new Class[] {String.class});
  6. Object registration = m.invoke(super.getServletContext(), new Object[]{filterName});
  7. if (registration != null) {
  8. m = registration.getClass().getMethod("getUrlPatternMappings", new Class[] {});
  9. Collection<String> mappings =
  10. CastUtils.cast((Collection<?>)m.invoke(registration, new Object[]{}));
  11. if (!mappings.isEmpty()) {
  12. String mapping = mappings.iterator().next();
  13. if (mapping.endsWith("/*")) {
  14. servletPath = mapping.substring(0, mapping.length() - 2);
  15. }
  16. }
  17. }
  18. } catch (Throwable ex) {
  19. // ignore
  20. }
  21. if (servletPath == null) {
  22. servletPath = "";
  23. }
  24. }
  25. return servletPath;
  26. }

代码示例来源:origin: com.github.wuic/wuic-servlet

  1. /**
  2. * {@inheritDoc}
  3. */
  4. @Override
  5. public ServletContext getServletContext() {
  6. // Synchronized access
  7. synchronized (mutex) {
  8. return super.getServletContext();
  9. }
  10. }

代码示例来源:origin: apache/cxf

  1. @Override
  2. public String getServletPath() {
  3. if (servletPath == null) {
  4. try {
  5. Method m = ServletContext.class.getMethod("getFilterRegistration", new Class[] {String.class});
  6. Object registration = m.invoke(super.getServletContext(), new Object[]{filterName});
  7. if (registration != null) {
  8. m = registration.getClass().getMethod("getUrlPatternMappings", new Class[] {});
  9. Collection<String> mappings =
  10. CastUtils.cast((Collection<?>)m.invoke(registration, new Object[]{}));
  11. if (!mappings.isEmpty()) {
  12. String mapping = mappings.iterator().next();
  13. if (mapping.endsWith("/*")) {
  14. servletPath = mapping.substring(0, mapping.length() - 2);
  15. }
  16. }
  17. }
  18. } catch (Throwable ex) {
  19. // ignore
  20. }
  21. if (servletPath == null) {
  22. servletPath = "";
  23. }
  24. }
  25. return servletPath;
  26. }

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

  1. @Override
  2. public String getServletPath() {
  3. if (servletPath == null) {
  4. try {
  5. Method m = ServletContext.class.getMethod("getFilterRegistration", new Class[] {String.class});
  6. Object registration = m.invoke(super.getServletContext(), new Object[]{filterName});
  7. if (registration != null) {
  8. m = registration.getClass().getMethod("getUrlPatternMappings", new Class[] {});
  9. Collection<String> mappings =
  10. CastUtils.cast((Collection<?>)m.invoke(registration, new Object[]{}));
  11. if (!mappings.isEmpty()) {
  12. String mapping = mappings.iterator().next();
  13. if (mapping.endsWith("/*")) {
  14. servletPath = mapping.substring(0, mapping.length() - 2);
  15. }
  16. }
  17. }
  18. } catch (Throwable ex) {
  19. // ignore
  20. }
  21. if (servletPath == null) {
  22. servletPath = "";
  23. }
  24. }
  25. return servletPath;
  26. }

相关文章

HttpServletRequestWrapper类方法