use of org.apache.wicket.request.resource.PackageResource in project wicket by apache.
the class PackageResourceTest method textFileWithEncoding.
@Test
public void textFileWithEncoding() {
final String encoding = "Klingon-8859-42";
final PackageResource resource = new PackageResource(PackageResourceTest.class, "packaged1.txt", null, null, null) {
private static final long serialVersionUID = 1L;
};
resource.setTextEncoding(encoding);
tester.startResource(resource);
final String contentType = tester.getLastResponse().getContentType();
assertEquals("text/plain; charset=" + encoding, contentType);
}
use of org.apache.wicket.request.resource.PackageResource in project wicket by apache.
the class PackageResourceTest method contentType.
/**
* Test that {@link PackageResource} writes its Content-Type header in the response
*
* https://issues.apache.org/jira/browse/WICKET-4119
*/
@Test
public void contentType() {
PackageResource textResource = new PackageResource(PackageResourceTest.class, "packaged1.txt", null, null, null) {
private static final long serialVersionUID = 1L;
};
tester.startResource(textResource);
assertEquals("text/plain", tester.getLastResponse().getContentType());
PackageResource jsResource = new PackageResource(PackageResourceTest.class, "packaged3.js", null, null, null) {
private static final long serialVersionUID = 1L;
};
tester.startResource(jsResource);
assertEquals("text/javascript", tester.getLastResponse().getContentType());
}
Aggregations