Skip to content

Commit

Permalink
cleanup - section 7.1.7 completed section 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
benrhine committed Oct 15, 2019
1 parent 4f1968f commit 0c61cf3
Show file tree
Hide file tree
Showing 22 changed files with 378 additions and 347 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
Often you want to consume an endpoint and bind to a POJO if the request is successful or bind to a different POJO if an error occurs. The following example shows how to invoke `exchange` with a success and error type.

[source,java]
----
include::{testsclient}/httpclientexceptionbody/BooksController.java[tag=clazz,indent=0]
----

[source,groovy]
----
include::{testsclient}/httpclientexceptionbody/BindHttpClientExceptionBodySpec.groovy[tags=test, indent=0]
----
snippet::io.micronaut.docs.httpclientexceptionbody.BooksController[tags="clazz", indent=0]

'''

snippet::io.micronaut.docs.httpclientexceptionbody.BindHttpClientExceptionBodySpec[tags="test", indent=0]

<1> Success Type
<2> Error Type
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
/*
* Copyright 2017-2019 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.http.client.docs.httpclientexceptionbody
package io.micronaut.docs.httpclientexceptionbody

import io.micronaut.context.ApplicationContext
import io.micronaut.context.env.Environment
Expand All @@ -22,9 +7,7 @@ import io.micronaut.http.HttpRequest
import io.micronaut.http.HttpResponse
import io.micronaut.http.HttpStatus
import io.micronaut.http.client.HttpClient
import io.micronaut.http.client.exceptions.HttpClientException
import io.micronaut.http.client.exceptions.HttpClientResponseException
import io.micronaut.http.codec.CodecException
import io.micronaut.runtime.server.EmbeddedServer
import spock.lang.AutoCleanup
import spock.lang.Shared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.http.client.docs.streaming;
package io.micronaut.docs.httpclientexceptionbody

/**
* @author graemerocher
* @since 1.0
*/
public class Headline {
private String text;
import groovy.transform.CompileStatic

public String getText() {
return text;
}
@CompileStatic
class Book {
String isbn
String title

public void setText(String text) {
this.text = text;
Book(String isbn, String title) {
this.isbn = isbn
this.title = title
}
}
Loading

0 comments on commit 0c61cf3

Please sign in to comment.