Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
praneelpidikiti
Posts: 17
Registered: ‎07-28-2010
My Device: Not Specified

Requesting a servlet for an xml file as a response in Blackberry?

Using Httpconnection i want to send the login details as data with the request and once verified i need a xml file as a response which is used in my Blackberry device to display the details (I already implemented this and tested with an xml file)

 

private void fetchPage(String url) {
// Perform basic validation (set characters to lowercase and add http:// or https://).
boolean validHeader = false;
int i = 0;
for (i = HTTP_PROTOCOL.length - 1; i >= 0; --i) {
 
if (-1 != url.indexOf(HTTP_PROTOCOL[i])) {
    validHeader
= true;
   
break;
 
}
}
if (!validHeader) {
 
// Prepend the protocol specifier if it is missing.
  url
= HTTP_PROTOCOL[0] + url;
}
// Create a new thread for connection operations.
System.out.println("+++++++url : " + url);
_connectionThread
.fetch(url);

Thanx in Advance ..
Please use plain text.
Administrator
MSohm
Posts: 14,362
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook
My Carrier: Bell

Re: Requesting a servlet for an xml file as a response in Blackberry?

What type of authentication are you using?  If it is HTTP basic, have a look here:

 

Implement basic HTTP authentication

http://supportforums.blackberry.com/t5/Java-Development/Implement-basic-HTTP-authentication/ta-p/445...

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.