This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I want to let the users parse an XML document to let them get data from the database. But before they are allowed to be submitted to the XML document, they have to request a login servlet which do the user authorization and redirects the users to the right XML document builder servlet. I thought about giving the user a login URL, like:
If you read any of the tutorials about J2EE Filters, always the first example given is enforcing that the client is logged in.
Joined: Jan 07, 2004
And can you give me a tip or tell me where you have read about it?
I don�t have any problems with doing the login authorization. I just don� t know how the user can�t get the URL, which the the login servlet has redirected to?
If I choose to hardcode this URL (XML builder URL), then how do I make a request from the above code (an ordinary java XML parser class), to the login servlet?
I have tried to do the login authorization before I want to parse the XML document, but it doesn�t seem to work:
//First open connection to login servlet - the authorization is created and session values stored java.net.URLConnection launch = new java.net.URL ( "http://www.myDomain.dk/servlet/login?username=cust1&password=cust2" ).openConnection(); launch.connect(); ... //Then parse the XML document org.jdom.input.SAXBuilder parser = new org.jdom.input.SAXBuilder(); org.jdom.Document doc = parser.build( XMLdocumentURL ); [ January 10, 2006: Message edited by: Jeppe Fjord ]