All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mastfrog.webapi.builtin.BodyFromString Maven / Gradle / Ivy

There is a newer version: 2.9.7
Show newest version
package com.mastfrog.webapi.builtin;

import com.google.common.net.MediaType;
import com.mastfrog.netty.http.client.HttpRequestBuilder;
import com.mastfrog.webapi.Decorator;
import com.mastfrog.webapi.WebCall;
import java.io.IOException;

/**
 * A request decorator which takes a String from the context and attaches
 * it as the body of a request.
 *
 * @author Tim Boudreau
 */
public final class BodyFromString implements Decorator {

    @Override
    public void decorate(WebCall call, HttpRequestBuilder builder, String obj, Class type) throws IOException {
        builder.setBody(obj, MediaType.PLAIN_TEXT_UTF_8);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy