70 71 /** 72 * Overwrites all the HTTP response headers written thus far. 73 * 74 * <p> 75 * The implementation should copy the contents of the {@link Map}, 76 * rather than retaining a reference. The {@link Map} passed as a 77 * parameter may change after this method is invoked. 78 * 79 * <p> 80 * This method may be called repeatedly, although in normal use 81 * case that's rare (so the implementation is encourage to take 82 * advantage of this usage pattern to improve performance, if possible.) 83 * 84 * <p> 85 * Initially, no header is set. 86 * 87 * <p> 88 * This parameter is usually exposed to {@link WebServiceContext} 89 * as {@link Packet#OUTBOUND_TRANSPORT_HEADERS}, and thus it 90 * should ignore <tt>Content-Type</tt> and <tt>Content-Length</tt> headers. 91 * 92 * @param headers 93 * See {@link HttpURLConnection#getHeaderFields()} for the format. 94 * This parameter may not be null, but since the user application 95 * code may invoke this method, a graceful error checking with 96 * an helpful error message should be provided if it's actually null. 97 * @see #setContentTypeResponseHeader(String) 98 */ 99 public abstract void setResponseHeaders(@NotNull Map<String,List<String>> headers); 100 101 public void setResponseHeader(String key, String value) { 102 setResponseHeader(key, Collections.singletonList(value)); 103 } 104 105 public abstract void setResponseHeader(String key, List<String> value); 106 107 /** 108 * Sets the <tt>"Content-Type"</tt> header. 109 * 110 * <p> 111 * If the Content-Type header has already been set, this method will overwrite 112 * the previously set value. If not, this method adds it. 113 * 114 * <p> 115 * Note that this method and {@link #setResponseHeaders(java.util.Map)} 116 * may be invoked in any arbitrary order. 117 * 118 * @param value 119 * strings like <tt>"application/xml; charset=UTF-8"</tt> or 120 * <tt>"image/jpeg"</tt>. 121 */ 122 public abstract void setContentTypeResponseHeader(@NotNull String value); 123 124 /** 125 * Sets the HTTP response code like {@link #OK}. 126 * 127 * <p> 128 * While JAX-WS processes a {@link WSHTTPConnection}, it 129 * will at least call this method once to set a valid HTTP response code. 130 * Note that this method may be invoked multiple times (from user code), 131 * so do not consider the value to be final until {@link #getOutput()} 132 * is invoked. 133 */ 134 135 public abstract void setStatus(int status); 136 137 /** 138 * Gets the last value set by {@link #setStatus(int)}. 139 * 140 * @return | 70 71 /** 72 * Overwrites all the HTTP response headers written thus far. 73 * 74 * <p> 75 * The implementation should copy the contents of the {@link Map}, 76 * rather than retaining a reference. The {@link Map} passed as a 77 * parameter may change after this method is invoked. 78 * 79 * <p> 80 * This method may be called repeatedly, although in normal use 81 * case that's rare (so the implementation is encourage to take 82 * advantage of this usage pattern to improve performance, if possible.) 83 * 84 * <p> 85 * Initially, no header is set. 86 * 87 * <p> 88 * This parameter is usually exposed to {@link WebServiceContext} 89 * as {@link Packet#OUTBOUND_TRANSPORT_HEADERS}, and thus it 90 * should ignore {@code Content-Type} and {@code Content-Length} headers. 91 * 92 * @param headers 93 * See {@link HttpURLConnection#getHeaderFields()} for the format. 94 * This parameter may not be null, but since the user application 95 * code may invoke this method, a graceful error checking with 96 * an helpful error message should be provided if it's actually null. 97 * @see #setContentTypeResponseHeader(String) 98 */ 99 public abstract void setResponseHeaders(@NotNull Map<String,List<String>> headers); 100 101 public void setResponseHeader(String key, String value) { 102 setResponseHeader(key, Collections.singletonList(value)); 103 } 104 105 public abstract void setResponseHeader(String key, List<String> value); 106 107 /** 108 * Sets the {@code "Content-Type"} header. 109 * 110 * <p> 111 * If the Content-Type header has already been set, this method will overwrite 112 * the previously set value. If not, this method adds it. 113 * 114 * <p> 115 * Note that this method and {@link #setResponseHeaders(java.util.Map)} 116 * may be invoked in any arbitrary order. 117 * 118 * @param value 119 * strings like {@code "application/xml; charset=UTF-8"} or 120 * {@code "image/jpeg"}. 121 */ 122 public abstract void setContentTypeResponseHeader(@NotNull String value); 123 124 /** 125 * Sets the HTTP response code like {@link #OK}. 126 * 127 * <p> 128 * While JAX-WS processes a {@link WSHTTPConnection}, it 129 * will at least call this method once to set a valid HTTP response code. 130 * Note that this method may be invoked multiple times (from user code), 131 * so do not consider the value to be final until {@link #getOutput()} 132 * is invoked. 133 */ 134 135 public abstract void setStatus(int status); 136 137 /** 138 * Gets the last value set by {@link #setStatus(int)}. 139 * 140 * @return |