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
Contributor
frandelbetis
Posts: 42
Registered: ‎03-17-2012
My Device: Blackberry playbook
Accepted Solution

HTTP Status 500 when I get webpage with HTTPConnection

Hello,

I have a method that get a string with the  HTML source of a webpage. I use HTTPConnection utils for this. This method works perfectly, I used this in other project and I didn´t have any problem. In my new project I want to use this method again for a specific webpage(I can´t say the URL of this web).

My problem is that this page return an 'HTTP Status 500' error. If I use the BlackBerry browser,  the web loads perfectly, and in the BB simulator too. 

I thought that the problem was the HTTP Request Header, and I included some Request properties like:

 

httpConnection.setRequestProperty("Content-Type", rawInputContentType);

Connection", "keep-alive");
httpConnection.setRequestProperty("User-Agent", "Mozilla/5.0 (BlackBerry; U; BlackBerry 9360; es) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.190 Mobile Safari/534.11+");
httpConnection.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml,*/*;q=0.5");
httpConnection.setRequestProperty("Accept-Language", "es");
httpConnection.setRequestProperty("Accept-Encoding","gzip,deflate");
httpConnection.setRequestProperty("x-wap-profile", "\"http://www.blackberry.net/go/mobile/profiles/uaprof/9360_80211g/7.1.0.rdf\"");

 

But the error is the same. The exception is:

 

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.RuntimeException: de.arvatomobile.bdev.scr.exception.MissingDeviceDetectionHeaderException
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:681)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:574)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:108)
info.magnolia.cms.filters.MgnlMainFilter.doFilter(MgnlMainFilter.java:216)
com.mondiamedia.shop.magnolia.filter.MagnoliaContextFilter.doFilter(MagnoliaContextFilter.java:113)
info.magnolia.cms.filters.AbstractMgnlFilter.doFilter(AbstractMgnlFilter.java:88)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
com.mondiamedia.common.filter.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:83)
com.mondiamedia.shop.vodafone.es.adult.filter.BlacklistFilter.forwardToBlacklist(BlacklistFilter.java:221)
com.mondiamedia.shop.vodafone.es.adult.filter.BlacklistFilter.doFilter(BlacklistFilter.java:99)
org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

 

Do you know why I get this error?. Thank you.

Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: HTTP Status 500 when I get webpage with HTTPConnection

Your user-agent looks incorrect for a Blackberry device.

 

At the end of the day, your best bet is to get the logs from the host web site. Thios will tell you exactly what the complaint is.

 

 

Contributor
frandelbetis
Posts: 42
Registered: ‎03-17-2012
My Device: Blackberry playbook

Re: HTTP Status 500 when I get webpage with HTTPConnection

It´s resolved. It had two problems. The first, I connected with WIFI of my office, and this had very bad signal. The second, it was only neccesary to specify the user-agent, others header parameters gave problems.