uCosminexus Application Server, Web Service Development Guide

[Contents][Glossary][Index][Back][Next]

10.18 Linking with the HTTP response compression functionality

The Cosminexus functionality for reducing the time required for the HTTP response communication between the Web container and the Web Service client by the gzip compression of the HTTP request body is called as HTTP response compression functionality.

You can link the JAX-WS engine with the HTTP response compression functionality. To link with the HTTP response compression functionality, you must attach the HTTP header indicating the receipt of compressed HTTP response in gzip format while sending the request message from the Web Service client. Implement the processing for attaching the HTTP header in the client application.

The following is an example of implementation in the client application.

  Map<String, List<String>> httpHeaders =
    ( Map<String, List<String>> )context.get( MessageContext.HTTP_REQUEST_HEADERS );
  if( null == httpHeaders ){
    httpHeaders = new HashMap<String, List<String>>();
  }
  List<String> acceptEncondings = httpHeaders.get( "Accept-Encoding" );
  if( null == acceptEncondings ){
    acceptEncondings = new ArrayList<String>();
  }
  acceptEncondings.add( "gzip" );
  httpHeaders.put( "Accept-Encoding", acceptEncondings );
  context.put( MessageContext.HTTP_REQUEST_HEADERS, httpHeaders );