本文整理汇总了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>");
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}