Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to truncate http request size to minimum?

 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To save GPRS traffic, I wan't to delete some headers from my midlet's request. For example, if regular response headers looks like this:


then it would be great to truncate such headers to something like this:



If I try to do



then it takes no changes into resulting Http Request Headers - User agent stays as it was - Nokia5310XpressMusic/2.0 (05.81) Profile/MIDP-2.1 Configuration/CLDC-1.1 UNTRUSTED/1.0

In API docs of HttpConnection interface, there is written:
setRequestProperty
public void setRequestProperty(String key,
String value)
throws IOException
Sets the general request property. If a property with the key already exists, overwrite its value with the new value.


Looks like Nokia add that user-agent header right before connection is opening. So how to avoid this? How to truncate these headers to minimum?
 
Zandis Murāns
Ranch Hand
Posts: 174
Java Java ME Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, never mind, ill do SocketConnection instead of HttpConnection
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!