Example usage for org.apache.wicket.request.http WebRequest PARAM_AJAX

List of usage examples for org.apache.wicket.request.http WebRequest PARAM_AJAX

Introduction

In this page you can find the example usage for org.apache.wicket.request.http WebRequest PARAM_AJAX.

Prototype

String PARAM_AJAX

To view the source code for org.apache.wicket.request.http WebRequest PARAM_AJAX.

Click Source Link

Document

marker for Ajax requests

Usage

From source file:com.evolveum.midpoint.web.security.WicketLoginUrlAuthenticationEntryPoint.java

License:Apache License

private boolean isWicketAjaxRequest(HttpServletRequest request) {
    String value = request.getParameter(WebRequest.PARAM_AJAX);
    if (value != null && "true".equals(value)) {
        return true;
    }/*from  w ww . j av a  2  s  .  c om*/

    value = request.getHeader(WebRequest.HEADER_AJAX);
    if (value != null && "true".equals(value)) {
        return true;
    }

    return false;
}

From source file:com.evolveum.midpoint.web.security.WicketRedirectStrategy.java

License:Apache License

public static boolean isWicketAjaxRequest(HttpServletRequest request) {
    String value = request.getParameter(WebRequest.PARAM_AJAX);
    if (Boolean.parseBoolean(value)) {
        return true;
    }/* www .j  ava2s.  co  m*/

    value = request.getHeader(WebRequest.HEADER_AJAX);
    if (Boolean.parseBoolean(value)) {
        return true;
    }

    return false;
}

From source file:com.mylab.wicket.jpa.ui.pages.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks
    if (isAjax()) {
        AjaxSettings ajax = getSettings().getAjax(true);
        ajax.setData(String.format(
                "function(params) { return { q: params.term, page: params.page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
                WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));
        ajax.setProcessResults("function(data, page) { return { results: data.items };  }");
    }//ww  w . j a  va2 s .  c  o m
    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}

From source file:com.vaynberg.wicket.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks

    AjaxSettings ajax = settings.getAjax(true);

    ajax.setData(String.format(/*  w  ww .j a va 2s.  c om*/
            "function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
            WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));

    ajax.setResults("function(data, page) { return data; }");

    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}

From source file:org.wicketstuff.select2.AbstractSelect2Choice.java

License:Apache License

@Override
protected void onInitialize() {
    super.onInitialize();

    // configure the ajax callbacks
    if (isAjax()) {
        AjaxSettings ajax = settings.getAjax(true);
        ajax.setData(String.format(
                "function(term, page) { return { term: term, page:page, '%s':true, '%s':[window.location.protocol, '//', window.location.host, window.location.pathname].join('')}; }",
                WebRequest.PARAM_AJAX, WebRequest.PARAM_AJAX_BASE_URL));
        ajax.setResults("function(data, page) { return data; }");
    }//from  w  w w  .  jav  a 2s . c om
    // configure the localized strings/renderers
    getSettings().setFormatNoMatches("function() { return '" + getEscapedJsString("noMatches") + "';}");
    getSettings().setFormatInputTooShort("function(input, min) { return min - input.length == 1 ? '"
            + getEscapedJsString("inputTooShortSingular") + "' : '" + getEscapedJsString("inputTooShortPlural")
            + "'.replace('{number}', min - input.length); }");
    getSettings().setFormatSelectionTooBig(
            "function(limit) { return limit == 1 ? '" + getEscapedJsString("selectionTooBigSingular") + "' : '"
                    + getEscapedJsString("selectionTooBigPlural") + "'.replace('{limit}', limit); }");
    getSettings().setFormatLoadMore("function() { return '" + getEscapedJsString("loadMore") + "';}");
    getSettings().setFormatSearching("function() { return '" + getEscapedJsString("searching") + "';}");
}