org.jboss.errai.bus.server.servlet
Class DefaultBlockingServlet
java.lang.Object
javax.servlet.GenericServlet
javax.servlet.http.HttpServlet
org.jboss.errai.bus.server.servlet.AbstractErraiServlet
org.jboss.errai.bus.server.servlet.DefaultBlockingServlet
- All Implemented Interfaces:
- Serializable, javax.servlet.Filter, javax.servlet.Servlet, javax.servlet.ServletConfig
- Direct Known Subclasses:
- ChaosMonkeyServlet
public class DefaultBlockingServlet
- extends AbstractErraiServlet
- implements javax.servlet.Filter
The default DefaultBlockingServlet which provides the HTTP-protocol gateway
between the server bus and the client buses.
Configuration
The DefaultBlockingServlet, as its name suggests, is normally configured as
an HTTP Servlet in the web.xml
file:
<servlet>
<servlet-name>ErraiServlet</servlet-name>
<servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>ErraiServlet</servlet-name>
<url-pattern>*.erraiBus</url-pattern>
</servlet-mapping>
Alternatively, the DefaultBlockingServlet can be deployed as a Servlet
Filter. This may be necessary in cases where an existing filter is configured
in the web application, and that filter interferes with the Errai Bus
requests. In this case, configuring DefaultBlockingServlet to handle
*.erraiBus
requests ahead of other filters in web.xml will solve the
problem:
<filter>
<filter-name>ErraiServlet</filter-name>
<filter-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</filter-class>
</filter>
<filter-mapping>
<filter-name>ErraiServlet</filter-name>
<url-pattern>*.erraiBus</url-pattern>
</filter-mapping>
<!-- other filter-mapping and servlet-mapping elements go here -->
- See Also:
- Serialized Form
Method Summary |
void |
doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
Services this request in the same way as it would be serviced if configured
as a Servlet. |
protected void |
doGet(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
Called by the server (via the service method) to allow a servlet to handle a GET request by supplying
a response |
protected void |
doPost(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
Called by the server (via the service method) to allow a servlet to handle a POST request, by
sending the request |
void |
init(javax.servlet.FilterConfig filterConfig)
|
void |
init(javax.servlet.ServletConfig config)
|
void |
initAsFilter(javax.servlet.FilterConfig config)
|
Methods inherited from class org.jboss.errai.bus.server.servlet.AbstractErraiServlet |
destroy, getClientId, getConnectionPhase, getLongPollTimeout, getSSETimeout, isLongPollingEnabled, isSSERequest, prepareCometPoll, prepareSSE, prepareSSEContinue, sendDisconnectDueToSessionExpiry, sendDisconnectWithReason, shouldWait, writeExceptionToOutputStream, writeToOutputStream |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
Methods inherited from class javax.servlet.GenericServlet |
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.Filter |
destroy |
DefaultBlockingServlet
public DefaultBlockingServlet()
init
public void init(javax.servlet.ServletConfig config)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Servlet
- Overrides:
init
in class AbstractErraiServlet
- Throws:
javax.servlet.ServletException
initAsFilter
public void initAsFilter(javax.servlet.FilterConfig config)
throws javax.servlet.ServletException
- Overrides:
initAsFilter
in class AbstractErraiServlet
- Throws:
javax.servlet.ServletException
doGet
protected void doGet(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws javax.servlet.ServletException,
IOException
- Called by the server (via the service method) to allow a servlet to handle a GET request by supplying
a response
- Overrides:
doGet
in class javax.servlet.http.HttpServlet
- Parameters:
httpServletRequest
- - object that contains the request the client has made of the servlethttpServletResponse
- - object that contains the response the servlet sends to the client
- Throws:
IOException
- - if an input or output error is detected when the servlet handles the GET request
javax.servlet.ServletException
- - if the request for the GET could not be handled
doPost
protected void doPost(javax.servlet.http.HttpServletRequest httpServletRequest,
javax.servlet.http.HttpServletResponse httpServletResponse)
throws javax.servlet.ServletException,
IOException
- Called by the server (via the
service
method) to allow a servlet to handle a POST request, by
sending the request
- Overrides:
doPost
in class javax.servlet.http.HttpServlet
- Parameters:
httpServletRequest
- - object that contains the request the client has made of the servlethttpServletResponse
- - object that contains the response the servlet sends to the client
- Throws:
IOException
- - if an input or output error is detected when the servlet handles the request
javax.servlet.ServletException
- - if the request for the POST could not be handled
init
public void init(javax.servlet.FilterConfig filterConfig)
throws javax.servlet.ServletException
- Specified by:
init
in interface javax.servlet.Filter
- Throws:
javax.servlet.ServletException
doFilter
public void doFilter(javax.servlet.ServletRequest request,
javax.servlet.ServletResponse response,
javax.servlet.FilterChain chain)
throws IOException,
javax.servlet.ServletException
- Services this request in the same way as it would be serviced if configured
as a Servlet. Does not invoke any filters further down the chain. See the
class-level comment for the reason why this servlet might be configured as a
filter.
- Specified by:
doFilter
in interface javax.servlet.Filter
- Throws:
IOException
javax.servlet.ServletException
Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.