java - how to pass htmlunit page as a modelandview (Spring) -
i wanted make proxy site. when user request url. on server side wanted request url , make object containing page details (html source, request response etc.)
i found htmlunit can fit requirements.
wanted pass response htmlunit's object users browser.
(as modelandview (spring) if possible. ) how can achieved?
@test public void getelements() throws exception { final webclient webclient = new webclient(); final htmlpage page = webclient.getpage("http://some_url"); //i wanted pass "htmlpage" user's browser. }
that's not how spring works. modelandview
object holder view
name , model
. view
name used in conjunction viewresolver
render response. model
serves hold attributes might needed during rendering process.
if want return content of separate http request/response, you'll need execute http request, response body , stream http response. follow these steps
- http request application
- your handler method invoked
- you use http client send new http request url
- you http response url
- you stream response http response.
Comments
Post a Comment