public class WebSocketRequestHandler extends Object implements IWebSocketRequestHandler
Constructor and Description |
---|
WebSocketRequestHandler(Component component,
IWebSocketConnection connection) |
Modifier and Type | Method and Description |
---|---|
void |
add(Component... components)
Adds components to the list of components to be rendered.
|
void |
add(Component component,
String markupId)
Adds a component to the list of components to be rendered
|
void |
addChildren(MarkupContainer parent,
Class<?> childCriteria)
Visits all children of the specified parent container and adds them to the target if they are
of same type as
childCriteria |
void |
appendJavaScript(CharSequence javascript)
Adds javascript that will be evaluated on the client side after components are replaced
|
void |
detach(IRequestCycle requestCycle)
This method is called at the end of a request cycle to indicate that processing is done and
that cleaning up of the subject(s) of this target may be done.
|
void |
focusComponent(Component component)
Sets the focus in the browser to the given component.
|
Collection<? extends Component> |
getComponents()
Returns an unmodifiable collection of all components added to this target
|
IHeaderResponse |
getHeaderResponse()
Returns the header response associated with current handler.
|
ILogData |
getLogData()
Returns the collected log data for this request handler and should never throw an exception.
|
Page |
getPage()
Returns the page.
|
Class<? extends IRequestablePage> |
getPageClass()
Returns the page class
|
Integer |
getPageId()
Returns the page id.
|
PageParameters |
getPageParameters() |
Integer |
getRenderCount()
Returns the number of times this page has been rendered.
|
boolean |
isPageInstanceCreated()
Checks if the page instance is already created or if it will be created when
IPageRequestHandler.getPage() is called |
void |
prependJavaScript(CharSequence javascript)
Adds javascript that will be evaluated on the client side before components are replaced.
|
void |
push(byte[] message,
int offset,
int length)
Pushes a binary message to the client.
|
void |
push(CharSequence message)
Pushes a text message to the client.
|
void |
respond(IRequestCycle requestCycle)
Generates a response.
|
public WebSocketRequestHandler(Component component, IWebSocketConnection connection)
public void push(CharSequence message)
IWebSocketRequestHandler
push
in interface IWebSocketRequestHandler
message
- the text message to push to the client if the web socket connection is openpublic void push(byte[] message, int offset, int length)
IWebSocketRequestHandler
push
in interface IWebSocketRequestHandler
message
- the binary message to push to the client if the web socket connection is openoffset
- the offset to start to read from the messagelength
- how many bytes to read from the messagepublic void add(Component component, String markupId)
IPartialPageRequestHandler
add
in interface IPartialPageRequestHandler
component
- component to be renderedmarkupId
- id of client-side dom element that will be updatedpublic void add(Component... components)
IPartialPageRequestHandler
add
in interface IPartialPageRequestHandler
components
- components to be renderedpublic final void addChildren(MarkupContainer parent, Class<?> childCriteria)
IPartialPageRequestHandler
childCriteria
addChildren
in interface IPartialPageRequestHandler
parent
- Must not be null.childCriteria
- Must not be null. If you want to traverse all components use ` Component.class as
the value for this argument.public void appendJavaScript(CharSequence javascript)
IPartialPageRequestHandler
If the javascript needs to do something asynchronously (i.e. needs to use window.setTimeout(), for example
to do animations) then the following special syntax may be used: someFunctionName|myJsLogic(someFunctionName);
.
Wicket will transform it to: function(someFunctionName){myJsLogic(someFunctionName);}
and your code
is responsible to execute someFunctionName() when the asynchronous task is finished. Once someFunctionName
is executed the next appended script will be executed. Important: it is highly recommended to
execute your code in try/finally to make sure someFunctionName is executed even an error happens in
your code, otherwise all following scripts wont be executed.
appendJavaScript
in interface IPartialPageRequestHandler
public void prependJavaScript(CharSequence javascript)
IPartialPageRequestHandler
If the javascript needs to do something asynchronously (i.e. needs to use window.setTimeout(), for example
to do animations) then the following special syntax may be used: someFunctionName|myJsLogic(someFunctionName);
.
Wicket will transform it to: function(someFunctionName){myJsLogic(someFunctionName);}
and your code
is responsible to execute someFunctionName() when the asynchronous task is finished. Once someFunctionName
is executed the next prepended script will be executed. Important: it is highly recommended to
execute your code in try/finally to make sure someFunctionName is executed even an error happens in
your code, otherwise all following scripts and component replacements wont be made.
prependJavaScript
in interface IPartialPageRequestHandler
public Collection<? extends Component> getComponents()
IPartialPageRequestHandler
getComponents
in interface IPartialPageRequestHandler
public final void focusComponent(Component component)
IPartialPageRequestHandler
focusComponent
in interface IPartialPageRequestHandler
component
- The component to get the focus or null.public IHeaderResponse getHeaderResponse()
IPartialPageRequestHandler
getHeaderResponse
in interface IPartialPageRequestHandler
public Page getPage()
IPageRequestHandler
getPage
in interface IPageRequestHandler
public Integer getPageId()
IPageRequestHandler
getPageId
in interface IPageRequestHandler
public boolean isPageInstanceCreated()
IPageRequestHandler
IPageRequestHandler.getPage()
is calledisPageInstanceCreated
in interface IPageRequestHandler
true
iff page instance is already createdpublic Integer getRenderCount()
IPageRequestHandler
getRenderCount
in interface IPageRequestHandler
IRequestablePage.getRenderCount()
public ILogData getLogData()
ILoggableRequestHandler
getLogData
in interface ILoggableRequestHandler
public Class<? extends IRequestablePage> getPageClass()
IPageClassRequestHandler
getPageClass
in interface IPageClassRequestHandler
public PageParameters getPageParameters()
getPageParameters
in interface IPageClassRequestHandler
public void respond(IRequestCycle requestCycle)
IRequestHandler
respond
in interface IRequestHandler
requestCycle
- the current request cyclepublic void detach(IRequestCycle requestCycle)
IRequestHandler
detach
in interface IRequestHandler
requestCycle
- the current request cycleCopyright © 2006–2021 Apache Software Foundation. All rights reserved.