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


Java WebResponse.write方法代码示例

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


在下文中一共展示了WebResponse.write方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: toObject

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
/**
 * Utility method to convert string values to the corresponding objects.
 * 
 * @param clazz
 *            the type of the object we want to obtain.
 * @param value
 *            the string value we want to convert.
 * @return the object corresponding to the converted string value, or null
 *         if value parameter is null
 */
public static Object toObject(Class clazz, String value) throws IllegalArgumentException {
	if (value == null)
		return null;
	// we use the standard Wicket conversion mechanism to obtain the
	// converted value.
	try {
		IConverter converter = Application.get().getConverterLocator().getConverter(clazz);

		return converter.convertToObject(value, Session.get().getLocale());
	} catch (Exception e) {
		WebResponse response = (WebResponse) RequestCycle.get().getResponse();

		response.setStatus(400);
		response.write("Could not find a suitable constructor for value '" + value
				+ "' of type '" + clazz + "'");

		return null;
	}
}
 
开发者ID:bitstorm,项目名称:Wicket-rest-annotations,代码行数:30,代码来源:AbstractRestResource.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: objectToResponse

import org.apache.wicket.request.http.WebResponse; //导入方法依赖的package包/类
@Override
public void objectToResponse(Object targetObject, WebResponse response, String mimeType)
		throws Exception {
	setCharsetResponse(response);
	
	String strOutput;
	
	if(RestMimeTypes.TEXT_PLAIN.equals(mimeType))
		strOutput = targetObject == null ? "" : targetObject.toString();
	else
		strOutput = objectToString(targetObject, mimeType);
	
	response.write(strOutput);
}
 
开发者ID:bitstorm,项目名称:Wicket-rest-annotations,代码行数:15,代码来源:TextualObjectSerialDeserial.java


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