Package org.apache.wicket.response
Class StringResponse
- java.lang.Object
-
- org.apache.wicket.request.Response
-
- org.apache.wicket.response.StringResponse
-
public class StringResponse extends Response
Response object that writes to a StringWriter. If the StringResponse is later converted to a String via toString(), the output which was written to the StringResponse will be returned as a String.- Author:
- Jonathan Locke
-
-
Field Summary
Fields Modifier and Type Field Description protected AppendingStringBuffer
out
StringWriter to write to
-
Constructor Summary
Constructors Constructor Description StringResponse()
ConstructorStringResponse(int initialCapacity)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
encodeURL(CharSequence url)
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.CharSequence
getBuffer()
Object
getContainerResponse()
Provides access to the low-level container response object that implementaion of thisResponse
delegate to.void
reset()
Called when the Response needs to reset itself.String
toString()
void
write(byte[] array)
Writes the buffer to output.void
write(byte[] array, int offset, int length)
Writes the buffer to output.void
write(CharSequence string)
Writes theCharSequence
to output.-
Methods inherited from class org.apache.wicket.request.Response
close, getOutputStream
-
-
-
-
Field Detail
-
out
protected final AppendingStringBuffer out
StringWriter to write to
-
-
Constructor Detail
-
StringResponse
public StringResponse()
Constructor
-
StringResponse
public StringResponse(int initialCapacity)
Constructor- Parameters:
initialCapacity
- the initial capacity of the internal buffer
-
-
Method Detail
-
write
public void write(CharSequence string)
Description copied from class:Response
Writes theCharSequence
to output.- Specified by:
write
in classResponse
- See Also:
Response.write(CharSequence)
-
reset
public void reset()
Description copied from class:Response
Called when the Response needs to reset itself. Subclasses can empty there buffer or build up state.- Overrides:
reset
in classResponse
- See Also:
Response.reset()
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
getBuffer
public CharSequence getBuffer()
- Returns:
- The internal buffer directly as a
CharSequence
-
write
public void write(byte[] array)
Description copied from class:Response
Writes the buffer to output.
-
write
public void write(byte[] array, int offset, int length)
Description copied from class:Response
Writes the buffer to output.
-
encodeURL
public String encodeURL(CharSequence url)
Description copied from class:Response
Encodes the specified URL by including the session ID in it, or, if encoding is not needed, returns the URL unchanged.
-
getContainerResponse
public Object getContainerResponse()
Description copied from class:Response
Provides access to the low-level container response object that implementaion of thisResponse
delegate to. This allows users to access features provided by the container response but not by generalized WicketResponse
objects.- Specified by:
getContainerResponse
in classResponse
- Returns:
- low-level container response object, or
null
if none
-
-