Configuring The Links Section

It is possible to configure the link section with the configuration parameter linksection. Five possibilities:

  • the value REMOTE (default value) makes it possible to obtain links whose URI is determined by the system of variables and thus makes it possible to obtain a URI seen from outside;

  • the LOCAL value makes it possible to obtain links whose URI is determined by the request object (HttpServletRequest) and thus allows to obtain a local URI, seen from the server;

  • the value OUTBOUND allows you to use outgoing URL rewriting (outbound) to manage the replacement; The string received is a relative URL. The start of the URL is handled as with REMOTE (unless the returned URL is relative).

    Example rule, by single rule:
    From: ^/_plugins/WXM_RESTAPI/page/view.jspz(\?viewName=(.*?))(.*)$
    To: /RESTAPI/$2/LIST$3

    Example of rules, by doubled rule: one to treat the case without parameter, one to treat the case with parameter

    Rule 1 (blocker)
    From: ^/_plugins/WXM_RESTAPI/page/view.jspz\?viewName=([^&]*)$
    To: /RESTAPI/$1/LIST

    Rule 2
    From: ^/_plugins/WXM_RESTAPI/page/view.jspz\?viewName=(*?)&(.*)$
    To: /RESTAPI/$1/LIST?$2

    The protocol inheritance works if the returned URL is relative.

    Result with the above rules (and a view called TEST):

    "links": { "href": "https://localhost:8080/RESTAPI/TEST/LIST", "previous": null, "next": "https://localhost:8080/RESTAPI/TEST/LIST?from=50" }



    the NONE value is used to disable generation of the links section
  • a plug-in class URI allows you to program a component that will generate a specific URI (for example, when using incoming URL rewriting to offer the client RESTful URLs, or when the outgoing URL rewriting setting is really too complex to handle by the regular expressions system + replacement. The class URI is in the form:

    • a plug-in name

    • two points (:)

    • a class name;

    An example plug-in is available as labs: labs_restapi_link
    The class that implements the URI production code is called fr.wedia.restapi.linksection.sample.LinkSectionSample.
    The value to put in the linksection parameter of the wxm_restapi plug-in is therefore:
    labs_restapi_link:fr.wedia.restapi.linksection.sample.LinkSectionSample

    The resulting links section for the views will be (here the test view):

    "links": { "href": "https://localhost:8080/RESTAPI/TEST/LIST", "first": "https://localhost:8080/RESTAPI/TEST/LIST", "previous": null, "next": "https://localhost:8080/RESTAPI/TEST/LIST?from=50" }