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

  1. http request application
  2. your handler method invoked
  3. you use http client send new http request url
  4. you http response url
  5. you stream response http response.

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -