当前位置: 首页>>代码示例>>Java>>正文


Java MediaType.valueOf方法代码示例

本文整理汇总了Java中org.restlet.data.MediaType.valueOf方法的典型用法代码示例。如果您正苦于以下问题:Java MediaType.valueOf方法的具体用法?Java MediaType.valueOf怎么用?Java MediaType.valueOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.restlet.data.MediaType的用法示例。


在下文中一共展示了MediaType.valueOf方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setResponseText

import org.restlet.data.MediaType; //导入方法依赖的package包/类
@Override
public StringRepresentation setResponseText( String text, String mediaTypeName, String languageName, String characterSetName )
{
	MediaType mediaType = mediaTypeName == null ? getMediaType() : MediaType.valueOf( mediaTypeName );
	Language language = languageName == null ? getLanguage() : Language.valueOf( languageName );
	CharacterSet characterSet = characterSetName == null ? getCharacterSet() : CharacterSet.valueOf( characterSetName );
	StringRepresentation representation = new StringRepresentation( text, mediaType, language, characterSet );
	getResponse().setEntity( representation );
	return representation;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:11,代码来源:ResourceConversationServiceBase.java

示例2: setResponseBinary

import org.restlet.data.MediaType; //导入方法依赖的package包/类
@Override
public ByteArrayRepresentation setResponseBinary( byte[] byteArray, String mediaTypeName )
{
	MediaType mediaType = mediaTypeName == null ? getMediaType() : MediaType.valueOf( mediaTypeName );
	ByteArrayRepresentation representation = new ByteArrayRepresentation( byteArray, mediaType );
	getResponse().setEntity( representation );
	return representation;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:9,代码来源:ResourceConversationServiceBase.java

示例3: getMediaType

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * Get a media type by its MIME type name.
 * 
 * @param name
 *        The MIME type name
 * @return The media type
 */
private static MediaType getMediaType( String name )
{
	MediaType mediaType = MediaType.valueOf( name );
	if( mediaType == null )
		mediaType = Application.getCurrent().getMetadataService().getMediaType( name );
	return mediaType;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:15,代码来源:DocumentService.java

示例4: toMediaType

import org.restlet.data.MediaType; //导入方法依赖的package包/类
@Converter
public static MediaType toMediaType(String name) {
    return MediaType.valueOf(name);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:RestletConverter.java

示例5: readExternal

import org.restlet.data.MediaType; //导入方法依赖的package包/类
public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException
{
	int tagsLength = in.readInt();
	tags = new String[tagsLength];
	for( int i = 0; i < tagsLength; i++ )
	{
		String tag = IoUtil.readUtf8( in );
		tags[i] = tag;
	}

	if( in.readBoolean() )
	{
		bytes = new byte[in.readInt()];
		in.readFully( bytes );
	}
	else
		string = IoUtil.readUtf8( in );

	mediaType = MediaType.valueOf( in.readUTF() );
	language = Language.valueOf( in.readUTF() );
	characterSet = CharacterSet.valueOf( in.readUTF() );
	encoding = Encoding.valueOf( in.readUTF() );

	int headersLength = in.readInt();
	if( headersLength > 0 )
	{
		headers = new Series<Header>( Header.class );
		for( int i = 0; i < headersLength; i++ )
		{
			String name = IoUtil.readUtf8( in );
			String value = IoUtil.readUtf8( in );
			headers.add( new Header( name, value ) );
		}
	}

	String tagValue = in.readUTF();
	tag = tagValue != null ? Tag.parse( tagValue ) : null;
	modificationDate = new Date( in.readLong() );
	expirationDate = new Date( in.readLong() );
	documentModificationDate = new Date( in.readLong() );
}
 
开发者ID:tliron,项目名称:prudence,代码行数:42,代码来源:CacheEntry.java

示例6: SolrOutputRepresentation

import org.restlet.data.MediaType; //导入方法依赖的package包/类
public SolrOutputRepresentation() {
  // No normalization, in case of a custom media type
  super(MediaType.valueOf(contentType));
  // TODO: For now, don't send the Vary: header, but revisit if/when content negotiation is added
  getDimensions().clear();
}
 
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:BaseSolrResource.java

示例7: setResponseText

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * A shortcut to set the response entity to a {@link StringRepresentation}.
 * 
 * @param text
 *        The text
 * @param mediaTypeName
 *        The media type or null to leave unchanged
 * @param languageName
 *        The language or null to leave unchanged
 * @param characterSetName
 *        The character set or null to leave unchanged
 * @return The string representation
 */
public StringRepresentation setResponseText( String text, String mediaTypeName, String languageName, String characterSetName )
{
	StringRepresentation representation = new StringRepresentation( text, MediaType.valueOf( mediaTypeName ), Language.valueOf( languageName ), CharacterSet.valueOf( characterSetName ) );
	getResponse().setEntity( representation );
	return representation;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:20,代码来源:ConversationService.java

示例8: setResponseBinary

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * A shortcut to set the response entity to a
 * {@link ByteArrayRepresentation}.
 * 
 * @param byteArray
 *        The byte array
 * @param mediaTypeName
 *        The media type or null to leave unchanged
 * @return The byte array representation
 */
public ByteArrayRepresentation setResponseBinary( byte[] byteArray, String mediaTypeName )
{
	ByteArrayRepresentation representation = new ByteArrayRepresentation( byteArray, MediaType.valueOf( mediaTypeName ) );
	getResponse().setEntity( representation );
	return representation;
}
 
开发者ID:tliron,项目名称:prudence,代码行数:17,代码来源:ConversationService.java

示例9: setMediaTypeName

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * @param mediaTypeName
 *        The media type name
 * @see #setMediaType(MediaType)
 */
public void setMediaTypeName( String mediaTypeName )
{
	mediaType = MediaType.valueOf( mediaTypeName );
}
 
开发者ID:tliron,项目名称:prudence,代码行数:10,代码来源:ResourceConversationServiceBase.java

示例10: getMediaTypeByName

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * Get a media type by its MIME type name.
 * 
 * @param name
 *        The MIME type name
 * @return The media type
 */
public MediaType getMediaTypeByName( String name )
{
	return MediaType.valueOf( name );
}
 
开发者ID:tliron,项目名称:prudence,代码行数:12,代码来源:ApplicationService.java

示例11: getMediaType

import org.restlet.data.MediaType; //导入方法依赖的package包/类
/**
 * The file media type.
 * 
 * @return The file media type
 * @see #getMediaTypeName()
 */
public MediaType getMediaType()
{
	return MediaType.valueOf( mediaTypeName );
}
 
开发者ID:tliron,项目名称:prudence,代码行数:11,代码来源:FileParameter.java


注:本文中的org.restlet.data.MediaType.valueOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。