Martijn Dashorst wrote:
The following code is in WebClientInfo's constructor:

    public WebClientInfo(WebRequestCycle requestCycle)
    {
        super();
HttpServletRequest httpServletRequest = requestCycle.getWebRequest()
                .getHttpServletRequest();
        userAgent = httpServletRequest.getHeader("User-Agent");
        if (userAgent == null)
        {
throw new WicketRuntimeException("unable to read header 'User-Agent'");
        }
properties.setProperty(ClientProperties.REMOTE_ADDRESS,httpServletRequest.getRemoteAddr());
        init();
    }

If I'm not mistaken, browsers can suppress headers, amongst which the
User-Agent. Shouldn't the WebClientInfo support this?

It's rare, but sometimes you get real requests that don't have this header. I could have sworn I opened a bug for this a while back.

Yes, IMHO this is broken - it causes failures for a small minority case that's really not obvious. At the very least, the WebClientInfo constructor should throw a checked ClientInfoNotAvailableException or similar.

Al

Reply via email to