Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 14th, 2011  |  syntax: None  |  size: 0.58 KB  |  views: 84  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //todo - remove this when https://issues.jboss.org/browse/ARQ-56 is fixed
  2.     public static boolean runningInAS() {
  3.         Exception e = new Exception();
  4.         StackTraceElement[] stack = e.getStackTrace();
  5.         for (int i=stack.length-1; i>=0; i--) {
  6.             //we're looking for the HTTP invoker (part of jboss)
  7.             //to see if we're running server-side (as part of
  8.             //an arquillian-generated HTTP GET request)
  9.             if (stack[i].getClassName().contains("http11")) {
  10.                 return true;
  11.             }
  12.         }
  13.         return false;
  14.     }
clone this paste RAW Paste Data