You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Nitish Chitta <nc...@tibco.com.INVALID> on 2023/01/04 09:51:02 UTC

Query regarding ContentType API's

Hello,
May I know the difference between ContentType.create() and
ContentType.parse() API's? I want the object to be returned after parsing
the content type along with the parameters.
The create() API fails to do the same. Can parse() be used as an
alternative?

Regards,
Nitish

Re: Query regarding ContentType API's

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2023-01-04 at 15:21 +0530, Nitish Chitta wrote:
> Hello,
> May I know the difference between ContentType.create() and
> ContentType.parse() API's? I want the object to be returned after
> parsing
> the content type along with the parameters.
> The create() API fails to do the same. Can parse() be used as an
> alternative?
> 
> Regards,
> Nitish


    /**
     * Creates a new instance of {@link ContentType}.
     *
     * @param mimeType MIME type. It may not be {@code null} or empty.
It may not contain
     *        characters {@code <">, <;>, <,>} reserved by the HTTP
specification.
     * @param charset charset.
     * @return content type
     */
    public static ContentType create(final String mimeType, final
Charset charset) {


Oleg

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org