java - How to retrieve servletRequest.attributes on client side -
i trying test servlet sets attributes on servletrequest. using jbehave resttemplate , apache httpclient send request servlet. possible verify attributes set on servletrequest?
here trying in servlet:
public void doget(httpservletrequest request, httpservletresponse response) throws oexception, servletexception{ request.setattribute("attributename","simple_name"); ... }
and client:
httpentity entity = httpentity.empty; map<string, string> map = new hashmap<string, string>(); resttemplate.setrequestfactory(new httpcomponentsclienthttprequestfactory()); httpentity<string> response = resttemplate.exchange(uri, httpmethod.get, entity, string.class, map);
so in case verify attributename set value simple_name
no, not possible. httpservletrequest
attributes server side implementation detail has nothing http protocol. such, http client has no knowledge of (and shouldn't).
if want check attribute added server side, can implement , register servletrequestattributelistener
in web application.
Comments
Post a Comment