Accepted answer

using rwt.getrequest() is not recommended because usually rwt would shield you from the lower-level servlet api and certain direct interactions with the request could even interfere with rwts life cycle and yield funny responses.

while in your case it would be safe to access the servletcontext via rwt.getrequest(), i recommend to use

rwt.getuisession( display ).gethttpsession().getservletcontext();

to access the servlet context.

the second approach accesses internal classes that aren't part of the public api and therefore shouldn't be use. the accessed classes may change or be (re)moved in the future without further notice and break your application.

Related Query

More Query from same tag