Package org.apache.sling.api.request.builder

# Class Builders

java.lang.Object
org.apache.sling.api.request.builder.Builders

public final class Builders extends Object
Creates builders.

Since:
  1.0 (Sling API Bundle 2.24.0)

## Method Summary

Modifier and Type
Method
Description
`static @NotNull SlingHttpServletRequestBuilder`
`newRequestBuilder(@NotNull Resource resource)`
Creates a new request builder.
`static @NotNull RequestParameter`
`newRequestParameter(@NotNull String name, byte @NotNull [] value, String fileName, String contentType)`
Creates a new binary request parameter
`static @NotNull RequestParameter`
`newRequestParameter(@NotNull String name, @NotNull String value)`
Creates a new `application/x-www-form-urlencoded` request parameter with UTF-8 encoding
`static @NotNull RequestParameter`
`newRequestParameter(@NotNull String name, @NotNull String value, @NotNull Charset encoding)`
Creates a new `application/x-www-form-urlencoded` request parameter with the given encoding
`static @NotNull RequestProgressTracker`
`newRequestProgressTracker()`
Creates a new request progress tracker
`static @NotNull SlingHttpServletResponseBuilder`
`newResponseBuilder()`
Creates a new response builder.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### newRequestBuilder

@NotNull public static @NotNull SlingHttpServletRequestBuilder newRequestBuilder(@NotNull @NotNull Resource resource)
Creates a new request builder.

Parameters:
  `resource` - the resource on which the request is based
Returns:
  a request builder
Throws:
  `IllegalArgumentException` - If resource is `null`

### newResponseBuilder

@NotNull public static @NotNull SlingHttpServletResponseBuilder newResponseBuilder()
Creates a new response builder.

Returns:
  a response builder

### newRequestProgressTracker

@NotNull public static @NotNull RequestProgressTracker newRequestProgressTracker()
Creates a new request progress tracker

Returns:
  a request progress tracker
Since:
  1.1 (Sling API Bundle 2.25.0)

### newRequestParameter

@NotNull public static @NotNull RequestParameter newRequestParameter(@NotNull @NotNull String name, @NotNull @NotNull String value)
Creates a new `application/x-www-form-urlencoded` request parameter with UTF-8 encoding

Parameters:
  `name` - the parameter name
  `value` - the parameter value
Returns:
  a request parameter
Since:
  1.2 (Sling API Bundle 2.26.2)

### newRequestParameter

@NotNull public static @NotNull RequestParameter newRequestParameter(@NotNull @NotNull String name, @NotNull @NotNull String value, @NotNull @NotNull Charset encoding)
Creates a new `application/x-www-form-urlencoded` request parameter with the given encoding

Parameters:
  `name` - the parameter name
  `value` - the parameter value
  `encoding` - the charset of the value
Returns:
  a request parameter
Since:
  1.2 (Sling API Bundle 2.26.2)

### newRequestParameter

@NotNull public static @NotNull RequestParameter newRequestParameter(@NotNull @NotNull String name, byte @NotNull [] value, String fileName, String contentType)
Creates a new binary request parameter

Parameters:
  `name` - the parameter name
  `value` - the parameter value
  `fileName` - the file name (may be `null`)
  `contentType` - the content type (may be `null`)
Returns:
  a request parameter
Since:
  1.3 (Sling API Bundle 2.28.0)