edu.internet2.middleware.grouper.ws.rest.contentType
Enum WsRestRequestContentType

java.lang.Object
  extended by java.lang.Enum<WsRestRequestContentType>
      extended by edu.internet2.middleware.grouper.ws.rest.contentType.WsRestRequestContentType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<WsRestRequestContentType>

public enum WsRestRequestContentType
extends java.lang.Enum<WsRestRequestContentType>

possible content types by grouper ws rest


Enum Constant Summary
http
          http params set fields in a lite object http request content type should not be set, or set to: application/x-www-form-urlencoded
json
          json content type, uses the pluggable json converter http request content type should be set to text/x-json
xhtml
          default xhtml content type http request content type should be set to application/xhtml+xml
xml
          xml content type http request content type should be set to text/xml
 
Method Summary
abstract  WsRestResponseContentType calculateResponseContentType()
          based on the request type, calculate the response type
static WsRestRequestContentType findByContentType(java.lang.String theContentType, java.lang.String requestBody)
          find a request content type by content type
 java.lang.String getContentType()
          content type header for http
static JsonConverter jsonConverter()
          instantiate the json convert configured in the grouper-ws.properties file
static void main(java.lang.String[] args)
          test out a parse
abstract  java.lang.Object parseString(java.lang.String input, java.lang.StringBuilder warnings)
          parse a string to an object
static WsRestRequestContentType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static WsRestRequestContentType valueOfIgnoreCase(java.lang.String string, boolean exceptionOnNotFound)
          do a case-insensitive matching
static WsRestRequestContentType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
abstract  java.lang.String writeString(java.lang.Object object)
          write a string representation to result string
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

xhtml

public static final WsRestRequestContentType xhtml
default xhtml content type http request content type should be set to application/xhtml+xml


http

public static final WsRestRequestContentType http
http params set fields in a lite object http request content type should not be set, or set to: application/x-www-form-urlencoded


xml

public static final WsRestRequestContentType xml
xml content type http request content type should be set to text/xml


json

public static final WsRestRequestContentType json
json content type, uses the pluggable json converter http request content type should be set to text/x-json

Method Detail

values

public static WsRestRequestContentType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (WsRestRequestContentType c : WsRestRequestContentType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static WsRestRequestContentType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

jsonConverter

public static JsonConverter jsonConverter()
instantiate the json convert configured in the grouper-ws.properties file

Returns:
the json converter

calculateResponseContentType

public abstract WsRestResponseContentType calculateResponseContentType()
based on the request type, calculate the response type

Returns:
the response type or null if there is not a clear winner

main

public static void main(java.lang.String[] args)
test out a parse

Parameters:
args -

parseString

public abstract java.lang.Object parseString(java.lang.String input,
                                             java.lang.StringBuilder warnings)
parse a string to an object

Parameters:
input -
warnings - is where warnings should be written to
Returns:
the object

writeString

public abstract java.lang.String writeString(java.lang.Object object)
write a string representation to result string

Parameters:
object - to write to output
Returns:
the string representation

getContentType

public java.lang.String getContentType()
content type header for http

Returns:
the content type

findByContentType

public static WsRestRequestContentType findByContentType(java.lang.String theContentType,
                                                         java.lang.String requestBody)
find a request content type by content type

Parameters:
theContentType -
requestBody - is the request onverted to a body
Returns:
the requestContentType

valueOfIgnoreCase

public static WsRestRequestContentType valueOfIgnoreCase(java.lang.String string,
                                                         boolean exceptionOnNotFound)
                                                  throws GrouperRestInvalidRequest
do a case-insensitive matching

Parameters:
string -
exceptionOnNotFound - true to throw exception on not found
Returns:
the enum or null or exception if not found
Throws:
GrouperRestInvalidRequest - if problem