RequestContext request = new MockRequestContext("/");
Set principals = new PrincipalsSet();
Set publicCredentials = new HashSet();
Set privateCredentials = new HashSet();
principals.add(new UserPrincipalImpl("user"));
principals.add(new RolePrincipalImpl("role"));
request.setSubject(new Subject(true, principals, publicCredentials, privateCredentials));
request.setLocale(new Locale("en", "US"));
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setServerName("www.domain.com");
request.setRequest(servletRequest);