Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Access to XML parsing after login authorization

 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

http://www.myDomain.dk/servlet/Login?username=cust1&password=cust2

If the user is authorized the login servlet redirect to the servlet which build the XML document. The XML document is built from i.e. userID which is stored in a session.

The users can parse the XML document with the following code. But how can they do the user authorization, before parsing the XML document:


[ January 10, 2006: Message edited by: Jeppe Fjord ]
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you read any of the tutorials about J2EE Filters, always the first example given is enforcing that the client is logged in.
 
Jeppe Sommer
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic