java - Wicket: Get URL from browser -
i need retrieve url current web page opened in firefox using wicket. can tell me how that?
you need query underlying httpservletrequest:
public class dummypage extends webpage{ private string getrequesturl(){ // wicket-specific request interface final request request = getrequest(); if(request instanceof webrequest){ final webrequest wr = (webrequest) request; // real thing final httpservletrequest hsr = wr.gethttpservletrequest(); string requrl = hsr.getrequesturl().tostring(); final string querystring = hsr.getquerystring(); if(querystring != null){ requrl += "?" + querystring; } return requrl; } return null; } }
reference:
- (wicket) component.getrequest()
- (wicket) request
- (wicket) webrequest
- (servlet api) httpservletrequest
Comments
Post a Comment