Skip to content

Commit a4c647c

Browse files
committed
Add information about RequestFactory in Rest JavaDoc
androidannotations#1189
1 parent f218eeb commit a4c647c

1 file changed

Lines changed: 36 additions & 2 deletions

File tree

  • AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/rest

‎AndroidAnnotations/androidannotations-api/src/main/java/org/androidannotations/annotations/rest/Rest.java‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,40 @@
136136
*
137137
* </p>
138138
*
139+
* <h1>RequestFactory</h1>
140+
* <p>
141+
* You can use your own request factory if you want to customize how requests
142+
* are created. The {@link #requestFactory()} parameter lets you define the
143+
* {@link org.springframework.http.client.ClientHttpRequestFactory
144+
* ClientHttpRequestFactory}.
145+
* </p>
146+
*
147+
* <p>
148+
* You can inject {@link org.androidannotations.annotations.EBean EBean} request
149+
* factories just like as interceptors.
150+
* </p>
151+
* <blockquote>
152+
*
153+
* <b>Example :</b>
154+
*
155+
* <pre>
156+
* &#064;Rest(converters = MappingJacksonHttpMessageConverter.class, <b>requestFactory</b> = MyRequestFactory.class)
157+
* public interface MyRestClient {
158+
*
159+
* &#064;Get(&quot;/events&quot;)
160+
* EventList getEvents();
161+
* }
162+
*
163+
* public class MyRequestFactory implements ClientHttpRequestFactory {
164+
*
165+
* &#064;Override
166+
* public ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod) throws IOException {
167+
* // create and return the request
168+
* }
169+
* }
170+
* </pre>
171+
*
172+
* </blockquote>
139173
*
140174
* <h1>Magic methods</h1>
141175
* <p>
@@ -235,9 +269,9 @@
235269
Class<?>[] interceptors() default {};
236270

237271
/**
238-
* TODO .
272+
* The request factory class which is used to create the HTTP requests.
239273
*
240-
* @return TODO
274+
* @return the request factory class
241275
*/
242276
Class<?> requestFactory() default Void.class;
243277
}

0 commit comments

Comments
 (0)