2016-07-20 93 views
1

我打算讓這個職位,但我也想設置我希望收到我的迴應的語言。JAX-WS如何設置接受語言

final String language = metadata.getLanguage(); //this is the string i want to send with the post 
final String baseUrl = getProperty(BASE_URL_PROPERTY); 

final Client client = ClientBuilder.newClient(); 
final WebTarget target = client.target(baseUrl); 
final WebTarget template = target.path("myURI"); 
final Invocation.Builder invocationBuilder = template.request(MediaTypes.ORDER_REQUEST_JSON); 

final Response response = invocationBuilder.post(Entity.json(orderRequest)); 

能否請你幫我附上以某種方式向請求提供語言? 謝謝!

回答

0

簡單:

final Invocation.Builder invocationBuilder = template.request(MediaTypes.ORDER_REQUEST_JSON).acceptLanguage(language);