Search in sources :

Example 1 with WebSocketConnectionOriginFilter

use of org.apache.wicket.protocol.ws.api.WebSocketConnectionOriginFilter in project wicket by apache.

the class WebSocketTesterProcessorTest method configureRequest.

protected void configureRequest(String[] allowedDomains, String[] origins) {
    WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
    WebSocketConnectionOriginFilter connectionFilter = new WebSocketConnectionOriginFilter(Arrays.asList(allowedDomains));
    webSocketSettings.setConnectionFilter(connectionFilter);
    MockHttpServletRequest request = tester.getRequest();
    for (String origin : origins) {
        request.addHeader("Origin", origin);
    }
    request.addParameter("resourceName", TestWebSocketResource.TEXT);
    request.addParameter(WebRequest.PARAM_AJAX_BASE_URL, ".");
}
Also used : WebSocketConnectionOriginFilter(org.apache.wicket.protocol.ws.api.WebSocketConnectionOriginFilter) MockHttpServletRequest(org.apache.wicket.protocol.http.mock.MockHttpServletRequest) WebSocketSettings(org.apache.wicket.protocol.ws.WebSocketSettings)

Aggregations

MockHttpServletRequest (org.apache.wicket.protocol.http.mock.MockHttpServletRequest)1 WebSocketSettings (org.apache.wicket.protocol.ws.WebSocketSettings)1 WebSocketConnectionOriginFilter (org.apache.wicket.protocol.ws.api.WebSocketConnectionOriginFilter)1