Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Inconsistency in headers

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,619
    Thanks
    25
    Thanked 322 Times in 300 Posts

    Default Inconsistency in headers

    I have a really weird issue which I cannot begin to figure out.

    So we have two systems, the client and the webserver. The client sends messages to the webserver, and the webserver responses with messages of its own. To send and receive the messages, we are using the WebServiceMessageCallback class.

    The client has a session id. We have a boolean configuration which, when set to true, attaches the session id as a header to the message sent to the webserver. It attaches the session id with the key: "SessionKey". When that boolean is false, the session key should not be attached to the header.

    We have a log message on the client side indicating when a header is added to the message. We also have a log on the webserver providing a list of the message headers. We are also watching the message headers with browser dev tools. I just use the ones provided by Chrome, but all of the different tools are showing the same results.

    Here is where it gets interesting:
    When the boolean value is set to true:
    The client logs that a header has been added, the dev tools show the session key in the message header (named "sessionKey" instead of "SessionKey". Not sure if that is important), and the webserver confirms the session key is there. Everything works as expected and there are no problems here.
    HOWEVER, when the boolean value is set to false:
    The client does not log that a header has been added (this is good), the web server does not find the session key in the header (this is also good), but the dev tools show the session key in the message header (also named "sessionKey")... That right there is the problem.

    So I'm at a loss here. I could understand if the dev tools AND the webserver were finding the session key. That would probably indicate that it is being added somewhere other than where we have the log message in the client. But how can the dev tools indicate the session key is in the headers, but the webserver disagrees? And, why has the first "s" in the header key changed to lowercase?
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,262
    Thanks
    176
    Thanked 821 Times in 764 Posts
    Blog Entries
    5

    Default Re: Inconsistency in headers

    Is it possible the dev tools is loading a cached version of the result? This can be an issue with web browsers at least, in that they can cache page information and when requested to load the data again it loads from a cache rather than refreshing the data from the source.

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,619
    Thanks
    25
    Thanked 322 Times in 300 Posts

    Default Re: Inconsistency in headers

    Actually, I found out what was happening. Apparently we were adding a "sessionKey" variable to messages in some javascript pages when we did some sort of ajax call. I'm not even sure when that was occurring. As it turns out, the header information the web browser tools display doesn't even include any header data that we added to the web service messaging objects in java, but rather only the header information added via the javascript code. So we could add all the header data we wanted in java and none of it would be displayed by the web browser's tools (although it was passed correctly to and from the web server).
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. [SOLVED] URLConnection inconsistency + SSCCE
    By Tjstretch in forum What's Wrong With My Code?
    Replies: 6
    Last Post: March 15th, 2012, 05:41 PM
  2. How do I connect 2 method headers to make it recursive???
    By tripline in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 5th, 2011, 05:27 AM
  3. Difficulty with method headers.
    By tripline in forum What's Wrong With My Code?
    Replies: 5
    Last Post: October 30th, 2011, 10:58 AM
  4. How to remove all Headers from a MimeMessage
    By ArgyrisV in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 8th, 2011, 11:38 AM
  5. Set headers for HttpServletRequest object?
    By FailMouse in forum Web Frameworks
    Replies: 3
    Last Post: December 1st, 2010, 02:00 PM