Hello Alex,
I think that the component must not take directly in charge the request.
You need to create a real HTTP client, such as follow :
Client client = new Client(Protocol.HTTP);
client.handle(request, response);
Best regards,
Thierry
Alex Combs a écrit :
I am trying to run a test wherein I create a String that contains 5*1024 bytes
of data, add it to a Request as an http header, feed that request to a
Component that is running an http server(like this
http://www.restlet.org/tutorial#part06), and have it fail because the default
size of a header buffer is should only 4*1024 bytes (detailed here
www.restlet.org/docs/ext/com/noelios/restlet/ext/jetty/JettyServerHelper.html
However, I must be adding the String to the Request wrongly, because when I run
my current code it ignores the extra large header and successfully finds the
file. Here is what I am doing currently(using beta 20, if that makes a
difference):
...//Setting up a component as detailed at
http://www.restlet.org/tutorial#part06
Request request = new Request(Method.GET, "http://localhost:8182/testfile");
Response response = new Response(request);
//This is where I am trying to add the header, which could be wrong
ParameterList parameterList = new ParameterList();
parameterList.add("x-header-name", hugeStringName);
request.getAttributes().put("org.restlet.http.headers",parameterList);
// www.restlet.org/docs/api/org/restlet/data/Message.html#getAttributes()
request.setProtocol(Protocol.HTTP);
response.getServerInfo().setDomain("localhost");
response.getServerInfo().setPort(8182);
component.handle(request,response);
When run, hugeString should be larger than the header buffer, thus causing the
handle to fail, but it doesn't, it finds testfile and returns it. I know it
should fail because when I do a wget on the command line with the huge header
it does fail. So how am I supposed to be adding headers to an Http Request?
Thank you