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


Java WebResponse.setContentType方法代码示例

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


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

示例1: respond

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
@Override
public void respond(IRequestCycle requestCycle) {
    String script = ToastrHelper.generateJs(singularException, ToastrType.ERROR, false);

    WebResponse response = (WebResponse)requestCycle.getResponse();
    final String encoding = Application.get()
            .getRequestCycleSettings()
            .getResponseRequestEncoding();

    // Set content type based on markup type for page
    response.setContentType("text/xml; charset=" + encoding);

    // Make sure it is not cached by a client
    response.disableCaching();

    response.write("<?xml version=\"1.0\" encoding=\"");
    response.write(encoding);
    response.write("\"?>");
    response.write("<ajax-response>");
    response.write("<evaluate><![CDATA[" + script + "]]></evaluate>");
    response.write("</ajax-response>");

}
 
开发者ID:opensingular,项目名称:singular-server,代码行数:24,代码来源:AjaxErrorRequestHandler.java

示例2: HtmlIFramePanel

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
public HtmlIFramePanel(String id, final IModel<String> htmlModel) {

        super(id);

        IResource resource = new IResource() {
            @Override
            public void respond(Attributes attributes) {
                WebResponse response = (WebResponse) attributes.getResponse();
                response.setContentType("text/html; charset=utf-8");
                response.write(htmlModel.getObject());
            }
        };

        setResource(resource);

    }
 
开发者ID:jkrasnay,项目名称:panelized,代码行数:17,代码来源:HtmlIFramePanel.java

示例3: respond

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
@Override
public void respond(Attributes attributes) {
	if (mainPage.getNanopub() == null) return;
	WebResponse resp = (WebResponse) attributes.getResponse();
	RDFFormat format = mainPage.getFormat();
	if (format == null) {
		format = mainPage.getFormat();
	}
	if (format == null) {
		format = RDFFormat.TRIG;
	}
	resp.setContentType(format.getMIMETypes().get(0));
	resp.setAttachmentHeader("nanopub." + format.getDefaultFileExtension());
	try {
		NanopubUtils.writeToStream(mainPage.getNanopub(), resp.getOutputStream(), format);
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	resp.close();
}
 
开发者ID:tkuhn,项目名称:nanopub-validator,代码行数:21,代码来源:DownloadResource.java

示例4: newStringResponse

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
private WebResponse newStringResponse() {
    WebResponse response = (WebResponse) getResponse();
    response.setContentType("text/plain");
    response.write(responseText());
    response.flush();
    response.setStatus(HttpStatus.OK.value());
    return response;
}
 
开发者ID:zutherb,项目名称:AppStash,代码行数:9,代码来源:AbstractPlainTextPage.java

示例5: Result

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
private Result(WebResponse response, int status, String contentType) {
    this.status = status;
    this.contentType = contentType;
    response.setStatus(status);
    response.setContentType(contentType);
}
 
开发者ID:PkayJava,项目名称:pluggable,代码行数:7,代码来源:Result.java

示例6: serializeObjectToResponse

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
/**
 * Method invoked to serialize the result of the invoked method and write
 * this value to the response.
 * 
 * @param response
 *            The current response object.
 * @param result
 *            The object to write to response.
 * @param restMimeFormats
 */
private void serializeObjectToResponse(WebResponse response, Object result, String mimeType) {
	try {
		response.setContentType(mimeType);
		objSerialDeserial.objectToResponse(result, response, mimeType);
	} catch (Exception e) {
		throw new RuntimeException("Error writing object to response.", e);
	}
}
 
开发者ID:bitstorm,项目名称:Wicket-rest-annotations,代码行数:19,代码来源:AbstractRestResource.java


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