Skip navigation links

Package org.takes.rq.form

This package contains implementations of the interface RqForm.

See: Description

Package org.takes.rq.form Description

This package contains implementations of the interface RqForm.

RqForm implementations can parse FORM data in application/x-www-form-urlencoded format (RFC 1738) from Request objects.

All implementations of this interface must be immutable and thread-safe.

Current implementations: RqFormBase base implementation; RqFormFake implementation that is useful for testing purposes. You can add your parameters in constructor; RqFormSmart decorator with extra features: Get single parameter and, if parameter doesn't exist use default value or throw HTTP exception.

Also please look at usage examples:

 
 final String body = "alpha=a+b+c&beta=%20Yes%20";
 final RqForm base = new RqFormBase(
     new RqBuffered(
         new RqFake(
             Arrays.asList(
                 "GET /h?a=3",
                 "Host: www.example.com",
                 String.format(
                     "Content-Length: %d",
                     body.getBytes().length
                 )
             ),
             body
         )
     )
 );
 
 
Create fake form with parameter: "param=value"
 
 final RqForm final = new RqFormFake(
     new RqFake(),
     "param",
     "value"
 );
 
 
Get "alpha" value form parameters:
 
 new RqFormSmart(base).single("alpha")
 
 
Since:
0.33
Skip navigation links

Copyright © 2015–2019 Take. All rights reserved.