rewrite is very very nice urlrewrite.

Splash Forums Rewrite Users rewrite is very very nice urlrewrite.

This topic contains 0 replies, has 1 voice, and was last updated by  dolphincn 5 years, 8 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #18134

    dolphincn
    Participant

    It is very good way for ajax function.

    .defineRule().when(Path.matches(“/”)).perform(new HttpOperation() {

    @Override

    public void performHttp(final HttpServletRewrite event, final EvaluationContext context)

    {

    try {

    PrintWriter writer = event.getResponse().getWriter();

    writer.write(“<html>”

    +

    “<body>”

    +

    “<h1>Rewrite Rest Demo</h1>”

    +

    “Sorry for the boring page, there are no HTML pages in this demo! Try some of the following operations:”

    + “”

    +

      +

    • GET <a href=””

      + event.getContextPath()

      + “/store/product/0”>/store/product/0

    • +

    • GET <a href=””

      + event.getContextPath()

      + “/store/products”>/store/products

    • +

    • POST “

      + event.getContextPath()

      + “/store/products – This requires a rest client, or you can use curl

      +

      “curl –data “<product><name>James</name><description>yay</description><price>12.9</price></product>” http://localhost:8080/rewrite-showcase-rest/store/products

    • +

    ” +

    “</body></html>”);

    SendStatus.code(200).perform(event, context);

    }

    catch (IOException e) {

    throw new RuntimeException();

    }

    }

    });

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Comments are closed.