Package org.apache.cxf.transport.http
Class Headers
- java.lang.Object
-
- org.apache.cxf.transport.http.Headers
-
public class Headers extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static StringADD_HEADERS_PROPERTYEach header value is added as a separate HTTP header, example, given A header with 'a' and 'b' values, two A headers will be added as opposed to a single A header with the "a,b" value.static StringEMPTY_REQUEST_PROPERTYstatic StringHTTP_HEADERS_LINKstatic StringHTTP_HEADERS_SETCOOKIEstatic StringKEY_HTTP_CONNECTIONThis constant is the Message(Map) key for the HttpURLConnection that is used to get the response.static StringPROTOCOL_HEADERS_CONTENT_TYPEstatic StringSET_EMPTY_REQUEST_CT_PROPERTYstatic StringUSER_AGENT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopyFromRequest(javax.servlet.http.HttpServletRequest req)Copy the request headers into the message.protected voidcopyToResponse(javax.servlet.http.HttpServletResponse response)Copy the response headers into the response.StringdetermineContentType()StringgetAuthorization()static SimpleDateFormatgetHttpDateFormat()static Map<String,List<String>>getSetProtocolHeaders(org.apache.cxf.message.Message message)While extracting the Message.PROTOCOL_HEADERS property from the Message, this call ensures that the Message.PROTOCOL_HEADERS property is set on the Message.static StringgetUserAgent()Map<String,List<String>>headerMap()voidreadFromConnection(HttpURLConnection connection)voidreadFromConnection(Map<String,List<String>> origHeaders)voidremoveAuthorizationHeaders()voidsetAuthorization(String authorization)voidsetProtocolHeadersInConnection(HttpURLConnection connection)Set content type and protocol headers (Message.PROTOCOL_HEADERS) headers into the URL connection.voidsetProxyAuthorization(String authorization)static StringtoHttpDate(Date date)static StringtoHttpLanguage(Locale locale)voidwriteSessionCookies(Map<String,Cookie> sessionCookies)Write cookie header from given session cookies
-
-
-
Field Detail
-
KEY_HTTP_CONNECTION
public static final String KEY_HTTP_CONNECTION
This constant is the Message(Map) key for the HttpURLConnection that is used to get the response.- See Also:
- Constant Field Values
-
ADD_HEADERS_PROPERTY
public static final String ADD_HEADERS_PROPERTY
Each header value is added as a separate HTTP header, example, given A header with 'a' and 'b' values, two A headers will be added as opposed to a single A header with the "a,b" value.- See Also:
- Constant Field Values
-
PROTOCOL_HEADERS_CONTENT_TYPE
public static final String PROTOCOL_HEADERS_CONTENT_TYPE
-
HTTP_HEADERS_SETCOOKIE
public static final String HTTP_HEADERS_SETCOOKIE
- See Also:
- Constant Field Values
-
HTTP_HEADERS_LINK
public static final String HTTP_HEADERS_LINK
- See Also:
- Constant Field Values
-
EMPTY_REQUEST_PROPERTY
public static final String EMPTY_REQUEST_PROPERTY
- See Also:
- Constant Field Values
-
USER_AGENT
public static final String USER_AGENT
-
SET_EMPTY_REQUEST_CT_PROPERTY
public static final String SET_EMPTY_REQUEST_CT_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getUserAgent
public static String getUserAgent()
-
writeSessionCookies
public void writeSessionCookies(Map<String,Cookie> sessionCookies)
Write cookie header from given session cookies- Parameters:
sessionCookies-
-
removeAuthorizationHeaders
public void removeAuthorizationHeaders()
-
setAuthorization
public void setAuthorization(String authorization)
-
setProxyAuthorization
public void setProxyAuthorization(String authorization)
-
getSetProtocolHeaders
public static Map<String,List<String>> getSetProtocolHeaders(org.apache.cxf.message.Message message)
While extracting the Message.PROTOCOL_HEADERS property from the Message, this call ensures that the Message.PROTOCOL_HEADERS property is set on the Message. If it is not set, an empty map is placed there, and then returned.- Parameters:
message- The outbound message- Returns:
- The PROTOCOL_HEADERS map
-
readFromConnection
public void readFromConnection(HttpURLConnection connection)
-
setProtocolHeadersInConnection
public void setProtocolHeadersInConnection(HttpURLConnection connection) throws IOException
Set content type and protocol headers (Message.PROTOCOL_HEADERS) headers into the URL connection. Note, this does not mean they immediately get written to the output stream or the wire. They just just get set on the HTTP request.- Parameters:
connection-- Throws:
IOException
-
determineContentType
public String determineContentType()
-
copyFromRequest
protected void copyFromRequest(javax.servlet.http.HttpServletRequest req)
Copy the request headers into the message.- Parameters:
req- the current servlet request
-
copyToResponse
protected void copyToResponse(javax.servlet.http.HttpServletResponse response)
Copy the response headers into the response.- Parameters:
response- the current ServletResponse
-
getAuthorization
public String getAuthorization()
-
getHttpDateFormat
public static SimpleDateFormat getHttpDateFormat()
-
-