jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: using a raw object output stream
Date Thu, 04 Apr 2013 14:30:11 GMT
On 2 April 2013 16:10, Mark Lybarger <mlybarger@gmail.com> wrote:

> I have an applet that has some code to send objects to the server. The
> sendComand is below. I did a quick record of the traffic with jmeter, and i
> can replay it just nicely, but i cannot figure out how to customize the
> data that is sent. Can anyone help with ideas on how to test this type of
> http traffic?
>

Use the facility to send an entire file as the content:

"If it is a POST or PUT or PATCH request and there is a single file whose
'Parameter name' attribute (below) is omitted, then the file is sent as the
entire body of the request, i.e. no wrappers are added. This allows
arbitrary bodies to be sent."


> Thanks,
> -mark-
>
>  private void sendCommand(URLConnection urlConnection, Properties command)
> throws Exception
> {
> urlConnection.setDoInput(true);
> urlConnection.setDoOutput(true);
>
> urlConnection.setUseCaches (false);
> urlConnection.setDefaultUseCaches (false);
>
> // Specify the content type that we will send binary data
> urlConnection.setRequestProperty ("Content-Type",
> "application/octet-stream");
>
> // Send command
> ObjectOutputStream objOutputStream = new
> ObjectOutputStream(urlConnection.getOutputStream());
> objOutputStream.writeObject(command);
> objOutputStream.flush();
> objOutputStream.close();
> }
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message