Retrieves the boundary that is used to separate the request parts from the Content-Type header.

@param contentType the value of the Content-Type header.

@return a byte array with the boundary.
165308
protected byte[] getBoundary(String contentType) {
		ParameterParser parser = new ParameterParser();
		parser.setLowerCaseNames(true);
		// Parameter parser can handle null input
		Map<String,String> params = parser.parse(contentType, new char[] {';', ','});
		String boundaryStr = (String) params.get("boundary");

		if (boundaryStr == null) {
			return null;
		}

		byte[] boundary;
		try {
			boundary = boundaryStr.getBytes("ISO-8859-1");
		} catch (UnsupportedEncodingException e) {
			boundary = boundaryStr.getBytes();
		}
		return boundary;
	}
366173
protected function get_attachment_headers($type, $boundary)
	{
		$return = '';

		$newline = $this->config['newline'];

		foreach ($this->attachments[$type] as $attachment)
		{
			$return .= '--'.$boundary.$newline;
			$return .= 'Content-Type: '.$attachment['mime'].'; name="'.$attachment['file'][1].'"'.$newline;
			$return .= 'Content-Transfer-Encoding: base64'.$newline;
			$type === 'inline' and $return .= 'Content-ID: <'.substr($attachment['cid'], 4).'>'.$newline;
			$return .= 'Content-Disposition: '.$type.'; filename="'.$attachment['file'][1].'"'.$newline.$newline;
			$return .= $attachment['contents'].$newline.$newline;
		}

		return $return;
	}
281811
public static ContentType getInstance(String type)
    {
        if(type.equals(TEST.toString()))
        {
            return TEST;
        }
        else if(type.equals(REQUIREMENT.toString()))
        {
            return REQUIREMENT;
        }
        else if(type.equals(BOTH.toString()))
        {
            return BOTH;
        }

        return UNKNOWN;
    }
1276385
public static Action contentType(final String contentType) {
        return new Action(r -> {
            r.setContentType(contentType);
            return r;
        });
    }
8096
public static String parseCharacterEncoding( final String contentType )
    {

        if ( contentType == null )
        {
            return ( null );
        }
        final int start = contentType.indexOf( "charset=" );
        if ( start < 0 )
        {
            return ( null );
        }
        String encoding = contentType.substring( start + 8 );
        final int end = encoding.indexOf( ';' );
        if ( end >= 0 )
        {
            encoding = encoding.substring( 0, end );
        }
        encoding = encoding.trim();
        if ( ( encoding.length() > 2 ) && ( encoding.startsWith( "\"" ) ) && ( encoding.endsWith( "\"" ) ) )
        {
            encoding = encoding.substring( 1, encoding.length() - 1 );
        }
        return ( encoding.trim() );

    }
29386
public static int contentTypeToFlickrContentTypeId(JinxConstants.ContentType contentType) {
        if (contentType == null) {
            return -1;
        }
        int ret;
        switch (contentType) {
            case photo:
                ret = 1;
                break;
            case screenshot:
                ret = 2;
                break;
            case other:
                ret = 3;
                break;
            case photos_and_screenshots:
                ret = 4;
                break;
            case screenshots_and_other:
                ret = 5;
                break;
            case photos_and_other:
                ret = 6;
                break;
            case all:
                ret = 7;
                break;
            default:
                ret = -1;
                break;
        }
        return ret;
    }
1268218
protected Set<String> getContentTypes(String contentType) {
        if (StringUtils.isNullOrEmpty(contentType)) {
            return Collections.emptySet();
        }

        Set<String> set = new LinkedHashSet<>();
        String[] types = contentType.split(",");
        for (String type : types) {
            if (type.contains(";")) {
                // drop ;q=0.8 quality scores
                type = type.substring(0, type.indexOf(';'));
            }

            set.add(type.trim().toLowerCase());
        }

        return set;
    }
986237
public MultipartContent part(String fieldName, String contentType, String value) {
        return part(fieldName, null, contentType, value);
    }
126205
public void startPart(String contentType)
         throws IOException
    {
        if (inPart)
            out.write(__CRLF);
        inPart=true;
        out.write(__DASHDASH);
        out.write(boundaryBytes);
        out.write(__CRLF);
        out.write(("Content-Type: "+contentType).getBytes(StringUtil.__ISO_8859_1));
        out.write(__CRLF);
        out.write(__CRLF);
    }
774901
protected function parseContentType($contentType) {
        $parts = explode(';', $contentType);

        foreach ($parts as $key => $value) {
            $parts[$key] = trim($value);
        }

        return $parts;
    }
1200926
public MediaType getContentType() {
		String value = getFirst(CONTENT_TYPE);
		return (StringUtils.hasLength(value) ? MediaType.parseMediaType(value) : null);
	}
577444
public void startPart(String contentType, String[] headers) throws IOException {
        if (inPart)
            out.write(__CRLF);
        out.write(__DASHDASH);
        out.write(boundary);
        out.write(__CRLF);
        out.write("Content-Type: ");
        out.write(contentType);
        out.write(__CRLF);
        for (int i = 0; headers != null && i < headers.length; i++) {
            out.write(headers[i]);
            out.write(__CRLF);
        }
        out.write(__CRLF);
        inPart = true;
    }
136767
public com.google.api.ads.adwords.axis.v201809.cm.ContentLabelType getContentLabelType() {
        return contentLabelType;
    }
860501
private String getEncoding(final String contentType) {
        if (contentType == null || !contentType.contains(CHARSET)) {
            return DEFAULT_ENCODING;
        }
        String encoding = null;
        try {
            encoding = contentType.substring(contentType.indexOf(CHARSET) + CHARSET.length());
            encoding = encoding.toLowerCase().replaceAll("\"", "");
        } catch (Exception e) {
            //Extraction from the string failed.
        }
        if (!validEncodings.contains(encoding)) {
            LOGGER.warn("Invalid Encoding '{}' - using default - '{}'", encoding, DEFAULT_ENCODING);
            encoding = DEFAULT_ENCODING;
        }
        return encoding;
    }
864546
private String getMediaType(String contentType) {
        if (contentType == null) {
            return null;
        }
        String result = contentType.toLowerCase(Locale.ENGLISH);
        int firstSemiColonIndex = result.indexOf(';');
        if (firstSemiColonIndex > -1) {
            result = result.substring(0, firstSemiColonIndex);
        }
        result = result.trim();
        return result;
    }
436878
public final B contentType(MediaType contentType) {
        requireNonNull(contentType, "contentType");
        autoDetectedContentType(false);
        getOrCreateHeaders().contentType(contentType);
        return self();
    }
661714
public KieServerHttpRequest contentType(final String contentType, final String charset ) {
        if( charset != null && charset.length() > 0 ) {
            final String separator = "; " + PARAM_CHARSET + '=';
            return header(CONTENT_TYPE, contentType + separator + charset);
        } else
            return header(CONTENT_TYPE, contentType);
    }