Search in sources :

Example 1 with ClientException

use of com.iplanet.services.cdm.ClientException in project OpenAM by OpenRock.

the class AMI18NUtils method getContentType.

/**
     * Returns content type from client service API.
     *
     * @param clientType Client type.
     * @return content type.
     */
public static String getContentType(String clientType) {
    String contentType;
    if (clientDt.isDetectionEnabled()) {
        try {
            Client client = ClientsManager.getInstance(clientType);
            contentType = (client != null) ? client.getProperty(AMAdminConstants.CDM_CONTENT_TYPE_PROPERTY_NAME) : Client.CDM_DEFAULT_CLIENT_TYPE;
        } catch (ClientException ce) {
            debug.warning("AMI18NUtils.getContentType - " + "couldn't retrieve the content type, reverting to default.");
            contentType = Client.CDM_DEFAULT_CLIENT_TYPE;
        }
    } else {
        contentType = Client.CDM_DEFAULT_CLIENT_TYPE;
    }
    return contentType;
}
Also used : ClientException(com.iplanet.services.cdm.ClientException) Client(com.iplanet.services.cdm.Client)

Example 2 with ClientException

use of com.iplanet.services.cdm.ClientException in project OpenAM by OpenRock.

the class AMI18NUtils method getCharset.

/**
     * Returns charset type from client service API
     *
     * @param clientType Client type.
     * @param loc Locale of request.
     * @return charset.
     */
public static String getCharset(String clientType, java.util.Locale loc) {
    String charset;
    if (clientDt.isDetectionEnabled()) {
        try {
            Client client = ClientsManager.getInstance(clientType);
            charset = (client != null) ? client.getCharset(loc) : Client.CDM_DEFAULT_CHARSET;
        } catch (ClientException ce) {
            debug.warning("AMI18NUtils.getCharset - " + "couldn't retrieve the client charset, reverting to default.");
            charset = Client.CDM_DEFAULT_CHARSET;
        }
    } else {
        charset = Client.CDM_DEFAULT_CHARSET;
    }
    return charset;
}
Also used : ClientException(com.iplanet.services.cdm.ClientException) Client(com.iplanet.services.cdm.Client)

Aggregations

Client (com.iplanet.services.cdm.Client)2 ClientException (com.iplanet.services.cdm.ClientException)2