net.craftforge.essential.controller.utils
Class HeaderUtils

java.lang.Object
  extended by net.craftforge.essential.controller.utils.HeaderUtils

public class HeaderUtils
extends Object

Since:
29.08.11
Author:
Christian Bick

Constructor Summary
HeaderUtils()
           
 
Method Summary
static String[] getAuthorizationPair(String[] authorizationHeaders)
          Gets a username password pair from the HTTP authorization header values.
static String getBasicAuthorizationHeader(String username, String password)
          Gets an HTTP basic authorization header value from a username and password.
static String[] getContentTypePair(String contentTypeHeader)
          Gets a content type pair, extracting the content media type and content charset from a Content-Type header.
static Map<String,String[]> normalizeHeaderMap(Map<String,List<String>> inputMap)
          Converts an input map holding its values as a list into an output map holding its values as an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HeaderUtils

public HeaderUtils()
Method Detail

getBasicAuthorizationHeader

public static String getBasicAuthorizationHeader(String username,
                                                 String password)
Gets an HTTP basic authorization header value from a username and password.

Parameters:
username - The username
password - The password
Returns:
The HTTP basic authorization header

getAuthorizationPair

public static String[] getAuthorizationPair(String[] authorizationHeaders)
Gets a username password pair from the HTTP authorization header values.

Parameters:
authorizationHeaders - HTTP authorization header values
Returns:
The username password pair as Array of length 2

getContentTypePair

public static String[] getContentTypePair(String contentTypeHeader)
Gets a content type pair, extracting the content media type and content charset from a Content-Type header.

Parameters:
contentTypeHeader - The Content-Type header
Returns:
The content type pair

normalizeHeaderMap

public static Map<String,String[]> normalizeHeaderMap(Map<String,List<String>> inputMap)
Converts an input map holding its values as a list into an output map holding its values as an array.

Parameters:
inputMap - The input map
Returns:
The output map


Copyright © 2011. All Rights Reserved.