Sure, following an example with main methods:
sender = new
org.parosproxy.paros.network.HttpSender(org.parosproxy.paros.model.Model.getSingleton().getOptionsParam().getConnectionParam(),
true, 6)
msg = new org.parosproxy.paros.network.HttpMessage(new
org.parosproxy.paros.network.HttpRequestHeader("GET / HTTP/1.1\r\nHost:
example.com"))
print(msg.getRequestHeader())
msg.getRequestHeader().setMessage("DELETE
https://domain.example.com
HTTP/1.0")
print(msg.getRequestHeader())
msg.setRequestHeader(new
org.parosproxy.paros.network.HttpRequestHeader("PUT", new
org.apache.commons.httpclient.URI("
https://domain.example.com", /* if
given uri is escaped */ true), "HTTP/1.1"))
msg.setRequestBody(new org.zaproxy.zap.network.HttpRequestBody("a=b&c=d"))
msg.getRequestHeader().setContentLength(msg.getRequestBody().length())
print(msg.getRequestHeader())
print(msg.getRequestBody())
msg.getRequestHeader().setURI(new
org.apache.commons.httpclient.URI("
http://example.com", true))
print(msg.getRequestHeader().getURI())
msg.getRequestHeader().setMethod("GET")
print(msg.getRequestHeader().getMethod())
msg.getRequestBody().setBody("");
msg.getRequestHeader().setHeader("Content-Length", null);
msg.getRequestHeader().addHeader("X-Custom-Header", "Value");
print(msg.getRequestHeader())
print(msg.getRequestBody())
sender.sendAndReceive(msg)
print("====================================")
print("====================================")
print(msg.getResponseHeader())
print(msg.getResponseBody())
If you are using Rhino as the JavaScript engine (Java 7) you should
replace "print" with "println".
It was missing the "new" keyword in previous message to create the
HttpSender :/
Best regards.
On 12/08/15 12:28, Michael Courcy wrote:
> Ok, a last question how do you create the message object ?
>
> If you don't have the time don't bother I can dig , I could watch the
> sendAndReceive method and find out the nature of the message object
> (especially its constructor) but if it's easy to explain can you share ?
>
> Thanks anyway.
>
>
> Le mer. 12 août 2015 10:07, <
thc...@gmail.com
> <mailto:
thc...@gmail.com>> a écrit :
>
> OK, you can create the object to send the requests with:
> sender =
> org.parosproxy.paros.network.HttpSender(org.parosproxy.paros.model.Model.getSingleton().getOptionsParam().getConnectionParam(),
> true, 6)
>
> and do the request with:
> sender.sendAndReceive(message)
>
> and, if you do not want to follow redirects:
> sender.sendAndReceive(message, false)
>
>
> Best regards.
>
> On 12/08/15 08:44, Michael Courcy wrote:
> > Hi
> > I need to send request.
> > Thx
> >
> >
> > Le mer. 12 août 2015 09:32, <
thc...@gmail.com
> <mailto:
thc...@gmail.com>
> > <mailto:
thc...@gmail.com <mailto:
thc...@gmail.com>>> a écrit :
> > <mailto:
zaproxy-users%2Bunsu...@googlegroups.com
> <mailto:
zaproxy-users%252Buns...@googlegroups.com>>
> > > <mailto:
zaproxy-user...@googlegroups.com
> <mailto:
zaproxy-users%2Bunsu...@googlegroups.com>
> > <mailto:
zaproxy-users%2Bunsu...@googlegroups.com
> <mailto:
zaproxy-users%252Buns...@googlegroups.com>>>.
> > <mailto:
zaproxy-users%2Bunsu...@googlegroups.com
> <mailto:
zaproxy-users%252Buns...@googlegroups.com>>.