org.apache.jmeter.protocol.http.sampler

Class PostWriter

Known Direct Subclasses:
PutWriter

public class PostWriter
extends Object

Class for setting the necessary headers for a POST request, and sending the body of the POST.

Field Summary

protected static String
BOUNDARY
The bounday string between multiparts
static String
ENCODING
protected byte[]
formDataPostBody
The form data that is going to be sent in post body
protected byte[]
formDataUrlEncoded
The form data that is going to be sent as url encoded

Constructor Summary

PostWriter()
Constructor for PostWriter.
PostWriter(String boundary)
Constructor for PostWriter

Method Summary

protected String
getBoundary()
Get the boundary string, used to separate multiparts
String
sendPostData(URLConnection connection, HTTPSampler sampler)
Send POST data from Entry to the open connection.
void
setHeaders(URLConnection connection, HTTPSampler sampler)

Field Details

BOUNDARY

protected static final String BOUNDARY
The bounday string between multiparts

ENCODING

public static final String ENCODING

formDataPostBody

protected byte[] formDataPostBody
The form data that is going to be sent in post body

formDataUrlEncoded

protected byte[] formDataUrlEncoded
The form data that is going to be sent as url encoded

Constructor Details

PostWriter

public PostWriter()
Constructor for PostWriter. Uses the PostWriter.BOUNDARY as the boundary string

PostWriter

public PostWriter(String boundary)
Constructor for PostWriter
Parameters:
boundary - the boundary string to use as marker between multipart parts

Method Details

getBoundary

protected String getBoundary()
Get the boundary string, used to separate multiparts
Returns:
the boundary string

sendPostData

public String sendPostData(URLConnection connection,
                           HTTPSampler sampler)
            throws IOException
Send POST data from Entry to the open connection.
Returns:
the post body sent. Actual file content is not returned, it is just shown as a placeholder text "actual file content"

setHeaders

public void setHeaders(URLConnection connection,
                       HTTPSampler sampler)
            throws IOException

Copyright © 1998-2010 Apache Software Foundation. All Rights Reserved.