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


Java ResourceStreamRequestHandler.setContentDisposition方法代码示例

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


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

示例1: onRequest

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onRequest() {
    HttpResourceStream stream = getResourceStream();
    ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(stream);
    String key = StringUtils.isNotBlank(fileKey) ? fileKey + "_" : "";
    String ext = "";
    if (StringUtils.isNotBlank(mimeType)) {
        String extByMimeType = MIME_TYPES_LOADER.getFileExt(mimeType);
        ext = StringUtils.isBlank(extByMimeType) ? ".bin" : ("." + extByMimeType);
    }
    String fileName = key + (stream.getFilename() == null ? name : stream.getFilename()) + ext;

    handler.setFileName(fileName);
    handler.setContentDisposition(ContentDisposition.ATTACHMENT);
    getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
}
 
开发者ID:apache,项目名称:syncope,代码行数:17,代码来源:AjaxDownload.java

示例2: onClick

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onClick() {
	final InputStream stream = getModelObject();
	if (stream == null) {
		throw new IllegalStateException(getClass().getName() + " failed to retrieve a File object from model");
	}

	InputStreamResourceStream resourceStream = new InputStreamResourceStream(stream);
	// maybe file name and display name should be seperated?
	ResourceStreamRequestHandler requestHandler = new ResourceStreamRequestHandler(resourceStream,
			String.valueOf(getBody().getObject()));
	requestHandler.setContentDisposition(ContentDisposition.ATTACHMENT);
	getRequestCycle().scheduleRequestHandlerAfterCurrent(requestHandler);
}
 
开发者ID:pingunaut,项目名称:wicket-stream-download-example,代码行数:15,代码来源:InputStreamDownloadLink.java

示例3: onRequest

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onRequest() {
    final ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(getResourceStream(),
            getFileName());
    handler.setContentDisposition(ContentDisposition.ATTACHMENT);
    getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
}
 
开发者ID:subes,项目名称:invesdwin-nowicket,代码行数:8,代码来源:AAjaxDownload.java

示例4: onRequest

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onRequest()
{
    ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(
            getResourceStream(), getFileName());
    handler.setContentDisposition(ContentDisposition.ATTACHMENT);
    getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:9,代码来源:AJAXDownload.java

示例5: commonInit

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
void commonInit()
{
    downloadBehavior = new AbstractAjaxBehavior()
    {
        private static final long serialVersionUID = 3472918725573624819L;

        @Override
        public void onRequest()
        {
            String name = filename != null ? filename.getObject() : null;
            
            // If no filename has been set explicitly, try to get it from the resource
            IResourceStream is = AjaxDownloadLink.this.getModelObject();
            if (name == null) {
                if (is instanceof FileResourceStream) {
                    name = ((FileResourceStream) is).getFile().getName();
                }
                else if (is instanceof FileSystemResourceStream) {
                    name = ((FileSystemResourceStream) is).getPath().getFileName().toString();
                }
            }
            
            ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(
                    AjaxDownloadLink.this.getModelObject(), name);
            handler.setContentDisposition(ContentDisposition.ATTACHMENT);
            getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
        }
    };
    add(downloadBehavior);
}
 
开发者ID:webanno,项目名称:webanno,代码行数:31,代码来源:AjaxDownloadLink.java

示例6: onRequest

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onRequest() {
	final ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(this.getResourceStream(), this.getFileName());
	handler.setContentDisposition(ContentDisposition.ATTACHMENT);
	this.getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
}
 
开发者ID:bptlab,项目名称:Unicorn,代码行数:7,代码来源:AJAXDownload.java

示例7: onRequest

import org.apache.wicket.request.handler.resource.ResourceStreamRequestHandler; //导入方法依赖的package包/类
@Override
public void onRequest() {
	ResourceStreamRequestHandler handler = new ResourceStreamRequestHandler(getResourceStream(), getFileDisplayName());
	handler.setContentDisposition(ContentDisposition.ATTACHMENT);
	getComponent().getRequestCycle().scheduleRequestHandlerAfterCurrent(handler);
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:7,代码来源:AbstractDeferredDownloadBehavior.java


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