Using HttpContext

Documents for the development of and with JVx.

Using HttpContext

Postby Development@SIB » Tue Dec 09, 2014 3:53 pm

The com.sibvisions.rad.server.http.HttpContext is useful for application server deployments. It allows accessing the original request and response from the http connection. If you need access to the HttpRequest, HttpResponse, PortletReqeust or PortletResponse, simply use the HttpContext.

The HttpContext is in use for JVx' Server, REST interface, Mobile server, Vaadin UI and other projects using JVx.

Simply use HttpContext to get the request URL:
Syntax: [ Download ] [ Hide ]
HttpContext ctxt = HttpContext.getCurrentInstance();

if (ctxt != null)
    Object oRequest = ctxt.getRequest();
    if (oRequest instanceof HttpServletRequest)
        String sURI = ((HttpServletRequest)oRequest).getRequestURL().toString();
        //e.g. PortletRequest

The HttpContext is available in application server environments and will be created before the ServerContext.
User avatar
Posts: 312
Joined: Mon Sep 28, 2009 1:54 pm

Return to Documentation