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

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

Introduction

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

Prototype

public abstract Url getClientUrl();

Source Link

Document

Returns the url against which the client, usually the browser, will resolve relative urls in the rendered markup.

Usage

From source file:org.wicketstuff.rest.resource.AbstractRestResource.java

License:Apache License

/**
 * Throw an exception if two o more methods have the same "score" for the current request. See
 * method selectMostSuitedMethod.//  www.  j  a  v  a2s  .  c o m
 *
 * @param list
 *            the list of ambiguous methods.
 */
private void throwAmbiguousMethodsException(ScoreMethodAndExtractPathVars... methods) {
    WebRequest request = getCurrentWebRequest();
    String methodsNames = "";

    for (ScoreMethodAndExtractPathVars method : methods) {
        if (!methodsNames.isEmpty())
            methodsNames += ", ";

        MethodMappingInfo urlMappingInfo = method.getMethodInfo();
        methodsNames += urlMappingInfo.getMethod().getName();
    }

    throw new WicketRuntimeException("Ambiguous methods mapped for the current request: URL '"
            + request.getClientUrl() + "', HTTP method " + HttpUtils.getHttpMethod(request) + ". "
            + "Mapped methods: " + methodsNames);
}