Top Inners Fields Constructors Methods
org.glassfish.grizzly.websockets

public Class DefaultWebSocket

extends SimpleWebSocket
Class Inheritance
Annotations
@SuppressWarnings:StringContatenationInLoop
Imports
java.io.BufferedReader, .IOException, .PrintWriter, java.security.Principal, java.util.logging.Logger, org.glassfish.grizzly.Grizzly, org.glassfish.grizzly.filterchain.FilterChainContext, org.glassfish.grizzly.http.Cookie, .HttpRequestPacket, org.glassfish.grizzly.http.server.Request, .Response, org.glassfish.grizzly.servlet.HttpServletRequestImpl, .HttpServletResponseImpl, .WebappContext, org.glassfish.grizzly.websockets.glassfish.GlassfishSupport, jakarta.servlet.ServletInputStream, .ServletOutputStream, jakarta.servlet.http.HttpServletRequest, .HttpSession

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static final Logger
protected final HttpServletRequest
Inherited from org.glassfish.grizzly.websockets.SimpleWebSocket:
broadcasterconnectedlistenersprotocolHandlerstate

Constructor Summary

AccessConstructor and Description
public
DefaultWebSocket(final ProtocolHandler protocolHandler, final HttpRequestPacket request, final WebSocketListener... listeners)

Method Summary

Modifier and TypeMethod and Description
public HttpServletRequest

Returns:

the upgrade request for this WebSocket. This method may return null depending on the context under which this WebSocket was created.
getUpgradeRequest
()

Returns the upgrade request for this WebSocket.

Inherited from org.glassfish.grizzly.websockets.SimpleWebSocket:
addbroadcastbroadcastbroadcastFragmentbroadcastFragmentclosecloseclosegetBroadcastergetListenersisConnectedonCloseonConnectonFragmentonFragmentonMessageonMessageonPingonPongremovesendsendsendPingsendPongsendRawsetBroadcastersetClosedstreamstreamtoRawDatatoRawDatatoRawDatatoRawData

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Hides org.glassfish.grizzly.websockets.SimpleWebSocket.LOGGER.

servletRequestback to summary
protected final HttpServletRequest servletRequest

Constructor Detail

DefaultWebSocketback to summary
public DefaultWebSocket(final ProtocolHandler protocolHandler, final HttpRequestPacket request, final WebSocketListener... listeners)

Method Detail

getUpgradeRequestback to summary
public HttpServletRequest getUpgradeRequest()

Returns the upgrade request for this WebSocket.

Returns:HttpServletRequest

the upgrade request for this WebSocket. This method may return null depending on the context under which this WebSocket was created.

org.glassfish.grizzly.websockets back to summary

private Class DefaultWebSocket.WSRequestImpl

extends Request
Class Inheritance

Field Summary

Inherited from org.glassfish.grizzly.http.server.Request:
afterServicesListcookiescookiesParsedctxdefaultLocaledispatcherTypehttpServerFilterinputBufferlocaleslocalesParsedparameterMapparametersrawCookiesrequestrequestDispatcherPathrequestedSessionCookierequestedSessionIdrequestedSessionURLrequestParametersParsedresponsesecureSEND_FILE_ATTRSEND_FILE_ENABLED_ATTRSEND_FILE_START_OFFSET_ATTRSEND_FILE_WRITE_LEN_ATTRsessionCookieNamesessionManagersessionParsedsubjecttrailersuserPrincipalusingInputStreamusingReader

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
parseSessionId()

Overrides org.glassfish.grizzly.http.server.Request.parseSessionId.

Make method visible for websockets

Inherited from org.glassfish.grizzly.http.server.Request:
addAfterServiceListeneraddCookieaddLocaleaddParameterappendRequestURLappendRequestURLareTrailersAvailablechangeSessionIdclearCookiesclearHeadersclearLocalesclearParametersconfigureSessionCookiecreatecreateInputStreamcreateNotedecrementDispatchDepthdoGetSessiongetAttributegetAttributeNamesgetAuthorizationgetAuthTypegetCharacterEncodinggetConnectiongetContentLengthgetContentLengthLonggetContentTypegetContextgetContextPathgetCookiesgetDateHeadergetDateHeadergetDecodedRequestURIgetHeadergetHeadergetHeaderNamesgetHeadersgetHeadersgetHttpFiltergetHttpHandlerPathgetInputBuffergetInputStreamgetIntHeadergetIntHeadergetJrouteIdgetLocalAddrgetLocalegetLocalesgetLocalNamegetLocalPortgetMaxDispatchDepthgetMethodgetNIOInputStreamgetNIOReadergetNotegetNoteNamesgetParametergetParameterMapgetParameterNamesgetParametersgetParameterValuesgetPathInfogetPostBodygetProtocolgetProtocolRequestIdgetQueryStringgetRawCookiesgetReadergetRemoteAddrgetRemoteHostgetRemotePortgetRemoteUsergetRequestgetRequestedSessionIdgetRequestExecutorgetRequestIdgetRequestURIgetRequestURLgetResponsegetSchemegetServerNamegetServerPortgetSessiongetSessiongetSessionCookieNamegetSessionManagergetTrailersgetUserPrincipalincrementDispatchDepthinitializeisMaxDispatchDepthReachedisPushEnabledisRequestedSessionIdFromCookieisRequestedSessionIdFromURLisRequestedSessionIdValidisSecurenewPushBuilderobtainMappingDataobtainSessionCookieNameonAfterServiceparseCookiesparseLocalesparseLocalesHeaderparseRequestParametersrecycleremoveAfterServiceListenerremoveAttributeremoveNotereplayPayloadrequiresAcknowledgementsetAttributesetCharacterEncodingsetContextPathsetContextPathsetCookiessetHttpHandlerPathsetHttpHandlerPathsetMaxDispatchDepthsetMethodsetNotesetPathInfosetPathInfosetQueryStringsetRequestedSessionCookiesetRequestedSessionIdsetRequestedSessionURLsetRequestExecutorProvidersetRequestParameterssetRequestURIsetServerNamesetServerPortsetSessionCookieNamesetSessionManagersetUserPrincipalskipPostBodyunescape

Constructor Detail

WSRequestImplback to summary
public WSRequestImpl()

Method Detail

parseSessionIdback to summary
protected void parseSessionId()

Overrides org.glassfish.grizzly.http.server.Request.parseSessionId.

Make method visible for websockets

Annotations
@Override
org.glassfish.grizzly.websockets back to summary

private Class DefaultWebSocket.WSResponseImpl

extends Response
Class Inheritance

Field Summary

Inherited from org.glassfish.grizzly.http.server.Response:
appCommittedctxdelayQueueerrorformathttpContextinfooutputBufferredirectURLCCrequestresponseurlEncoderusingOutputStreamusingWriter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from org.glassfish.grizzly.http.server.Response:
addCookieaddDateHeaderaddDateHeaderaddHeaderaddHeaderaddHeaderaddHeaderaddIntHeaderaddIntHeaderaddSessionCookieInternalcancelcontainsHeadercontainsHeadercreateOutputStreamencodeRedirectURLencodeURLfilterfinishflushgetBufferSizegetCharacterEncodinggetContentLengthgetContentLengthLonggetContentTypegetCookiesgetDetailMessagegetErrorPageGeneratorgetHeadergetHeaderNamesgetHeaderValuesgetInfogetLocalegetMessagegetNIOOutputStreamgetNIOWritergetOutputBuffergetOutputStreamgetRequestgetResponsegetStatusgetSuspendContextgetTrailersgetWriterinitializeisCacheEnabledisCommittedisEncodeableisErrorisSendFileEnabledisSuspendedrecycleremoveSessionCookiesresetresetresetBufferresetBufferresumesendAcknowledgementsendEarlyHintssendErrorsendErrorsendRedirectsendRedirectsetBufferSizesetCharacterEncodingsetContentLengthsetContentLengthLongsetContentTypesetContentTypesetDateHeadersetDateHeadersetDetailMessagesetErrorsetErrorPageGeneratorsetHeadersetHeadersetHeadersetHeadersetIntHeadersetIntHeadersetLocalesetStatussetStatussetStatussetTrailerssuspendsuspendsuspendsuspendtoAbsolutetoEncoded

Constructor Detail

WSResponseImplback to summary
public WSResponseImpl()
org.glassfish.grizzly.websockets back to summary

private Class DefaultWebSocket.WSServletRequestImpl

extends HttpServletRequestImpl
Class Inheritance

Field Summary

Modifier and TypeField and Description
private String
private GlassfishSupport
private boolean
private String
private BufferedReader
private String
Inherited from org.glassfish.grizzly.servlet.HttpServletRequestImpl:
requestservletResponseusingInputStreamusingReader

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
public String
getAuthType()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getAuthType.

Implements jakarta.servlet.http.HttpServletRequest.getAuthType.

Returns the name of the authentication scheme used to protect the servlet.

public String
getContextPath()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getContextPath.

Implements jakarta.servlet.http.HttpServletRequest.getContextPath.

Returns the portion of the request URI that indicates the context of the request.

public ServletInputStream
public String
getPathInfo()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getPathInfo.

Implements jakarta.servlet.http.HttpServletRequest.getPathInfo.

Returns any extra path information associated with the URL the client sent when it made this request.

public BufferedReader
getReader()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getReader.

Implements jakarta.servlet.ServletRequest.getReader.

Retrieves the body of the request as character data using a BufferedReader.

public String
getRemoteUser()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getRemoteUser.

Implements jakarta.servlet.http.HttpServletRequest.getRemoteUser.

Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated.

public String
getServletPath()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getServletPath.

Implements jakarta.servlet.http.HttpServletRequest.getServletPath.

Returns the part of this request's URL that calls the servlet.

public HttpSession
getSession(boolean create)

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getSession.

Implements jakarta.servlet.http.HttpServletRequest.getSession.

Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

public Principal
getUserPrincipal()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getUserPrincipal.

Implements jakarta.servlet.http.HttpServletRequest.getUserPrincipal.

Returns a java.security.Principal object containing the name of the current authenticated user.

public void
initialize(final Request request, final HttpServletResponseImpl servletResponse, final WebSocketMappingData mappingData)

public boolean
isUserInRole(String role)

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.isUserInRole.

Implements jakarta.servlet.http.HttpServletRequest.isUserInRole.

Returns a boolean indicating whether the authenticated user is included in the specified logical "role".

private void
updatePaths(final WebSocketMappingData mappingData)

Inherited from org.glassfish.grizzly.servlet.HttpServletRequestImpl:
authenticatechangeSessionIdclonecreatedisableAsyncSupportgetAsyncContextgetAttributegetAttributeNamesgetCharacterEncodinggetContentLengthgetContentLengthLonggetContentTypegetContextImplgetCookiesgetDateHeadergetDispatcherTypegetGrizzlyCookiesgetHeadergetHeaderNamesgetHeadersgetHttpServletMappinggetHttpUpgradeHandlergetInternalRequestgetIntHeadergetLocalAddrgetLocalegetLocalesgetLocalNamegetLocalPortgetMethodgetParametergetParameterMapgetParameterNamesgetParameterValuesgetPartgetPartsgetPathTranslatedgetProtocolgetProtocolRequestIdgetQueryStringgetRemoteAddrgetRemoteHostgetRemotePortgetRequestgetRequestDispatchergetRequestedSessionIdgetRequestIdgetRequestURIgetRequestURLgetSchemegetServerNamegetServerPortgetServletConnectiongetServletContextgetSessiongetTrailerFieldsinitializeisAsyncStartedisAsyncSupportedisRequestedSessionIdFromCookieisRequestedSessionIdFromURLisRequestedSessionIdValidisSecureisTrailerFieldsReadyisUpgradeloginlogoutnewPushBuilderremoveAttributesetAttributesetCharacterEncodingsetContextImplsetContextPathsetPathInfosetServletPathstartAsyncstartAsyncupgrade

Field Detail

contextPathback to summary
private String contextPath

Hides org.glassfish.grizzly.servlet.HttpServletRequestImpl.contextPath.

glassfishSupportback to summary
private GlassfishSupport glassfishSupport
isUserPrincipalUpdatedback to summary
private boolean isUserPrincipalUpdated
pathInfoback to summary
private String pathInfo

Hides org.glassfish.grizzly.servlet.HttpServletRequestImpl.pathInfo.

readerback to summary
private BufferedReader reader

Hides org.glassfish.grizzly.servlet.HttpServletRequestImpl.reader.

servletPathback to summary
private String servletPath

Hides org.glassfish.grizzly.servlet.HttpServletRequestImpl.servletPath.

Constructor Detail

WSServletRequestImplback to summary
private WSServletRequestImpl()

Method Detail

checkGlassfishAuthback to summary
private void checkGlassfishAuth()
getAuthTypeback to summary
public String getAuthType()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getAuthType.

Implements jakarta.servlet.http.HttpServletRequest.getAuthType.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getAuthType.

Returns the name of the authentication scheme used to protect the servlet. All servlet containers support basic, form and client certificate authentication, and may additionally support digest authentication. If the servlet is not authenticated null is returned.

Annotations
@Override
getContextPathback to summary
public String getContextPath()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getContextPath.

Implements jakarta.servlet.http.HttpServletRequest.getContextPath.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getContextPath.

Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string.

It is possible that a servlet container may match a context by more than one context path. In such cases this method will return the actual context path used by the request and it may differ from the path returned by the jakarta.servlet.ServletContext#getContextPath() method. The context path returned by jakarta.servlet.ServletContext#getContextPath() should be considered as the prime or preferred context path of the application.

Annotations
@Override
getInputStreamback to summary
public ServletInputStream getInputStream() throws IOException

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getInputStream.

Implements jakarta.servlet.ServletRequest.getInputStream.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getInputStream.

Retrieves the body of the request as binary data using a ServletInputStream. Either this method or getReader may be called to read the body, not both.

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletRequest.getInputStream.

if an input or output exception occurred

getPathInfoback to summary
public String getPathInfo()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getPathInfo.

Implements jakarta.servlet.http.HttpServletRequest.getPathInfo.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getPathInfo.

Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string and will start with a "/" character.

This method returns null if there was no extra path information.

Annotations
@Override
getReaderback to summary
public BufferedReader getReader() throws IOException

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getReader.

Implements jakarta.servlet.ServletRequest.getReader.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getReader.

Retrieves the body of the request as character data using a BufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method or getInputStream may be called to read the body, not both.

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletRequest.getReader.

if an input or output exception occurred

getRemoteUserback to summary
public String getRemoteUser()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getRemoteUser.

Implements jakarta.servlet.http.HttpServletRequest.getRemoteUser.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getRemoteUser.

Returns the login of the user making this request, if the user has been authenticated, or null if the user has not been authenticated. Whether the user name is sent with each subsequent request depends on the browser and type of authentication.

Annotations
@Override
getServletPathback to summary
public String getServletPath()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getServletPath.

Implements jakarta.servlet.http.HttpServletRequest.getServletPath.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getServletPath.

Returns the part of this request's URL that calls the servlet. This path starts with a "/" character and includes the path to the servlet, but does not include any extra path information or a query string.

This method will return an empty string ("") if the servlet used to process this request was matched using the "/*" pattern.

Annotations
@Override
getSessionback to summary
public HttpSession getSession(boolean create)

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getSession.

Implements jakarta.servlet.http.HttpServletRequest.getSession.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getSession.

Returns the current HttpSession associated with this request or, if there is no current session and create is true, returns a new session.

If create is false and the request has no valid HttpSession, this method returns null.

To make sure the session is properly maintained, you must call this method before the response is committed. If the container is using cookies to maintain session integrity and is asked to create a new session when the response is committed, an IllegalStateException is thrown.

Annotations
@Override
getUserPrincipalback to summary
public Principal getUserPrincipal()

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.getUserPrincipal.

Implements jakarta.servlet.http.HttpServletRequest.getUserPrincipal.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.getUserPrincipal.

Returns a java.security.Principal object containing the name of the current authenticated user. If the user has not been authenticated, the method returns null.

Annotations
@Override
initializeback to summary
public void initialize(final Request request, final HttpServletResponseImpl servletResponse, final WebSocketMappingData mappingData) throws IOException
isUserInRoleback to summary
public boolean isUserInRole(String role)

Overrides org.glassfish.grizzly.servlet.HttpServletRequestImpl.isUserInRole.

Implements jakarta.servlet.http.HttpServletRequest.isUserInRole.

Doc from org.glassfish.grizzly.servlet.HttpServletRequestImpl.isUserInRole.

Returns a boolean indicating whether the authenticated user is included in the specified logical "role". Roles and role membership can be defined using deployment descriptors. If the user has not been authenticated, the method returns false.

The role name "*" should never be used as an argument in calling isUserInRole. Any call to isUserInRole with "*" must return false. If the role-name of the security-role to be tested is "**", and the application has NOT declared an application security-role with role-name "**", isUserInRole must only return true if the user has been authenticated; that is, only when getRemoteUser and getUserPrincipal would both return a non-null value. Otherwise, the container must check the user for membership in the application role.

Annotations
@Override
updatePathsback to summary
private void updatePaths(final WebSocketMappingData mappingData)
org.glassfish.grizzly.websockets back to summary

private Class DefaultWebSocket.WSServletResponseImpl

extends HttpServletResponseImpl
Class Inheritance

Field Summary

Modifier and TypeField and Description
private PrintWriter
Inherited from org.glassfish.grizzly.servlet.HttpServletResponseImpl:
responseservletRequestusingOutputStreamusingWriter

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public ServletOutputStream
public PrintWriter
getWriter()

Overrides org.glassfish.grizzly.servlet.HttpServletResponseImpl.getWriter.

Implements jakarta.servlet.ServletResponse.getWriter.

Returns a PrintWriter object that can send character text to the client.

Inherited from org.glassfish.grizzly.servlet.HttpServletResponseImpl:
addCookieaddDateHeaderaddHeaderaddIntHeaderclonecontainsHeadercreateencodeRedirectURLencodeURLfinishflushBuffergetBufferSizegetCharacterEncodinggetContentTypegetHeadergetHeaderNamesgetHeadersgetInternalResponsegetLocalegetMessagegetResponsegetStatusgetTrailerFieldsinitializeisCommittedisErrorresetresetBuffersendEarlyHintssendErrorsendErrorsendRedirectsendRedirectsetBufferSizesetCharacterEncodingsetContentLengthsetContentLengthLongsetContentTypesetDateHeadersetHeadersetIntHeadersetLocalesetStatussetTrailerFields

Field Detail

writerback to summary
private PrintWriter writer

Hides org.glassfish.grizzly.servlet.HttpServletResponseImpl.writer.

Constructor Detail

WSServletResponseImplback to summary
private WSServletResponseImpl()

Method Detail

getOutputStreamback to summary
public ServletOutputStream getOutputStream() throws IOException

Overrides org.glassfish.grizzly.servlet.HttpServletResponseImpl.getOutputStream.

Implements jakarta.servlet.ServletResponse.getOutputStream.

Doc from org.glassfish.grizzly.servlet.HttpServletResponseImpl.getOutputStream.

Returns a ServletOutputStream suitable for writing binary data in the response. The servlet container does not encode the binary data.

Calling flush() on the ServletOutputStream commits the response. Either this method or getWriter may be called to write the body, not both, except when reset has been called.

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletResponse.getOutputStream.

if an input or output exception occurred

getWriterback to summary
public PrintWriter getWriter() throws IOException

Overrides org.glassfish.grizzly.servlet.HttpServletResponseImpl.getWriter.

Implements jakarta.servlet.ServletResponse.getWriter.

Doc from org.glassfish.grizzly.servlet.HttpServletResponseImpl.getWriter.

Returns a PrintWriter object that can send character text to the client. The PrintWriter uses the character encoding returned by getCharacterEncoding. If the response's character encoding has not been specified as described in getCharacterEncoding (i.e., the method just returns the default value ISO-8859-1), getWriter updates it to ISO-8859-1.

Calling flush() on the PrintWriter commits the response.

Either this method or getOutputStream may be called to write the body, not both, except when reset has been called.

Annotations
@Override
Exceptions
IOException:

Doc from jakarta.servlet.ServletResponse.getWriter.

if an input or output exception occurred