Java Code Examples for org.springframework.http.ContentDisposition

Following code examples demonstrate how to use org.springframework.http.ContentDispositionfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.http.ContentDispositionand various code implementation of this class.

	public ExchangeActions contentDisposition(ContentDisposition contentDisposition) {
		ContentDisposition actual = this.headers.getContentDisposition();
		assertEquals("Response header Content-Disposition", contentDisposition, actual);
		return this.exchangeActions;
	} 


    private String getFileName(HttpHeaders httpHeaders, String url){
        ContentDisposition contentDisposition = httpHeaders.getContentDisposition();
        String fileName = null;

        if(contentDisposition != null){
            fileName = contentDisposition.getFilename();
        }

        if(isBlank(fileName)){
            return FilenameUtils.getName(url);
        } else {
            return fileName;
        }
    } 

Advertisement
Javadoc
Represent the Content-Disposition type and parameters as defined in RFC 2183. @author Sebastien Dele

uze @author Juergen Hoeller @since 5.0 @see RFC 2183

Read More
Advertisement