Example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes getRequestTimeout

List of usage examples for org.apache.wicket.ajax.attributes AjaxRequestAttributes getRequestTimeout

Introduction

In this page you can find the example usage for org.apache.wicket.ajax.attributes AjaxRequestAttributes getRequestTimeout.

Prototype

public Duration getRequestTimeout() 

Source Link

Document

Returns the timeout in milliseconds for the AJAX request.

Usage

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.AbstractMultiAjaxBehavior.java

License:Apache License

private void appendSpecial(final JSONObject attributesJson, final AjaxRequestAttributes attributes)
        throws JSONException {
    final Method method = attributes.getMethod();
    if (Method.POST == method) {
        attributesJson.put("m", method);
    }/*w w w .  j  av  a2s . c o  m*/
    if (component instanceof Page == false) {
        final String componentId = component.getMarkupId();
        attributesJson.put("c", componentId);
    }
    final JSONArray extraParameters = JsonUtils.asArray(attributes.getExtraParameters());
    if (extraParameters.length() > 0) {
        attributesJson.put("ep", extraParameters);
    }

    final String[] eventNames = attributes.getEventNames();
    if (eventNames.length == 1) {
        attributesJson.put("e", eventNames[0]);
    } else {
        for (String eventName : eventNames) {
            attributesJson.append("e", eventName);
        }
    }
    final AjaxChannel channel = attributes.getChannel();
    if (channel != null) {
        attributesJson.put("ch", channel);
    }
    final Duration requestTimeout = attributes.getRequestTimeout();
    if (requestTimeout != null) {
        attributesJson.put("rt", requestTimeout.getMilliseconds());
    }
    final String dataType = attributes.getDataType();
    if (AjaxRequestAttributes.XML_DATA_TYPE.equals(dataType) == false) {
        attributesJson.put("dt", dataType);
    }
}