Documentation

Trace: Using HttpContext

(jvx:common:util)

Using HttpContext

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:

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

The HttpContext is available in application server environments and will be created before the ServerContext.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information