Is it possible from varnish vcl script to set an attribute on the request and get it in the backend by java Servlet getAttribute() method? http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getAttribute(java.lang.String)
Request attributes are a mechanism internal to the Servlet framework, so it is not possible to set them from the outside. It would however be possible to set a Request parameter (in either query String or request body, depending on the request type), that would then be available through HttpServletRequest.getParameter(name)