tyrus
  1. tyrus
  2. TYRUS-208

HandshakeRequest.getHeaders is not readonly

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None

      Description

      javadoc says:

      Return the read only Map of Http Headers that came with the handshake request.

      but the following code adds to the map (and to a response):

      public class ReadonlyGetHeadersConfigurator extends Configurator {
      	static final String KEY = "ReadOnlyKey";
      	static final String [] VALUES = { "ReadOnlyValue1", "ReadOnlyValue2" };
      
      	@Override
      	public void modifyHandshake(ServerEndpointConfig sec,
      			HandshakeRequest request, HandshakeResponse response) {
      		Map<String, List<String>> map = request.getHeaders();
      		try {
      			map.put(KEY, Arrays.asList(VALUES));
      		} catch (Exception e) {
      			// possible, but not mandatory
      		}
      		map = request.getHeaders();
      		response.getHeaders().putAll(map);
      	}
      }
      

        Activity

        jan.supol created issue -
        Pavel Bucek made changes -
        Field Original Value New Value
        Assignee Pavel Bucek [ pavel_bucek ]
        Pavel Bucek made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.2 [ 16550 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: