|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Response
public abstract class Response
Abstract base class for different implementations of response writing. A subclass must implement write(String) to write a String to the response destination (whether it be a browser, a file, a test harness or some other place). A subclass may optionally implement close(), encodeURL(String), redirect(String), isRedirect() or setContentType(String) as appropriate.
Constructor Summary | |
---|---|
Response()
|
Method Summary | |
---|---|
void |
close()
Closes the response output stream |
void |
detectContentType(RequestCycle requestCycle,
String uri)
Sets the Content-Type header with servlet-context-defined content-types (application's web.xml or servlet container's configuration), and fall back to system or JVM-defined (FileNameMap) content types. |
CharSequence |
encodeURL(CharSequence url)
An implementation of this method is only required if a subclass wishes to support sessions via URL rewriting. |
AppendingStringBuffer |
filter(AppendingStringBuffer responseBuffer)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
String |
getCharacterEncoding()
Get the default encoding |
abstract OutputStream |
getOutputStream()
|
boolean |
isRedirect()
Returns true if a redirection has occurred. |
void |
println(CharSequence string)
Writes the given string to the Response subclass output destination and appends a cr/nl depending on the OS |
void |
redirect(String url)
CLIENTS SHOULD NEVER CALL THIS METHOD FOR DAY TO DAY USE! |
void |
reset()
Called when the Response needs to reset itself. |
void |
setCharacterEncoding(String encoding)
Set the default encoding for the output. |
void |
setContentLength(long length)
Set the content length on the response, if appropriate in the subclass. |
void |
setContentType(String mimeType)
Set the content type on the response, if appropriate in the subclass. |
void |
setLastModifiedTime(Time time)
Set the contents last modified time, if appropriate in the subclass. |
void |
setLocale(Locale locale)
|
abstract void |
write(CharSequence string)
Writes the given string to the Response subclass output destination. |
void |
write(ComponentTag tag)
Writes the given tag to via the write(String) abstract method. |
void |
write(InputStream in)
Copies the given input stream to the servlet response |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Response()
Method Detail |
---|
public void close()
public void reset()
public CharSequence encodeURL(CharSequence url)
url
- The URL to encode
public final AppendingStringBuffer filter(AppendingStringBuffer responseBuffer)
responseBuffer
- The response buffer to be filtered
public String getCharacterEncoding()
public abstract OutputStream getOutputStream()
public boolean isRedirect()
public void redirect(String url)
A subclass may override this method to implement redirection. Subclasses which have no need to do redirection may choose not to override this default implementation, which does nothing. For example, if a subclass wishes to write output to a file or is part of a testing harness, there may be no meaning to redirection.
Framework users who want to redirect should use a construction like
RequestCycle.get().setRequestTarget(new RedirectRequestTarget(...));
or
setResponsePage(new RedirectPage(...));
url
- The URL to redirect topublic void setCharacterEncoding(String encoding)
encoding
- public void setContentLength(long length)
length
- The length of the contentpublic void setContentType(String mimeType)
mimeType
- The mime typepublic void setLastModifiedTime(Time time)
time
- The time objectpublic void setLocale(Locale locale)
locale
- Locale to use for this responsepublic final void write(ComponentTag tag)
tag
- The tag to writepublic abstract void write(CharSequence string)
string
- The string to writepublic void write(InputStream in)
NOTE Content-Length is not set because it would require to buffer the whole input stream
in
- input stream to copy, will be closed after copypublic final void println(CharSequence string)
string
- public void detectContentType(RequestCycle requestCycle, String uri)
requestCycle
- uri
- Resource name to be analyzed to detect MIME typeServletContext.getMimeType(String)
,
URLConnection.getFileNameMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |