|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.pajes.servlet.Browser
The Browser class is an abstraction of a Web browser.
| Field Summary | |
static java.lang.String |
DEFAULT_CONTENT_TYPE_ATTRIBUTE
Context attribute to set the default Content-Type header on the servlet response, if one has not already been set on the response when the Browser is instantiated. |
static java.lang.String |
MAX_FILE_UPLOAD_SIZE_ATTRIBUTE
Context attribute to set the default maximum number of bytes that can be uploaded to a servlet. |
static java.lang.String |
USE_CLIENT_VALIDATION_ATTRIBUTE
Context attribute to set whether JavaScript client validation will be generated or not. |
static java.lang.String |
USE_COMPRESSION_ATTRIBUTE
Context attribute to set whether compression of HTML documents is turned on or off by default. |
static java.lang.String |
USE_DEFAULT_BASE_HREF_ATTRIBUTE
Context attribute to set whether the base tag
href= attribute in the document Head will be automatically
generated or not. |
static java.lang.String |
USE_ENCRYPTED_QUERY_PARAMETERS_ATTRIBUTE
Context attribute to set whether automatic encryption of query parameters is turned on or off by default. |
static java.lang.String |
USE_URL_ENCODING_ATTRIBUTE
Context attribute to set whether URLs should be automatically encoded using HttpServletResponse.encodeURL by those objects that
contain or represent a URL, such as Anchor or Form. |
static java.lang.String |
USE_XHTML_ATTRIBUTE
Context attribute to set whether the document written back to the browser should be XHTML compliant or not. |
| Constructor Summary | |
Browser()
Creates a logical browser object. |
|
Browser(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates a browser object. |
|
Browser(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpSession session)
Creates a browser object. |
|
| Method Summary | |
void |
close()
Closes the output stream to complete sending the results back to the browser. |
java.lang.String |
getAppName()
Returns the browser application name. |
javax.servlet.ServletContext |
getContext()
Returns the ServletContext object. |
static int |
getDefaultMaxFileUploadSize(javax.servlet.ServletContext context)
Returns the default maximum number of bytes that can be uploaded to a servlet. |
double |
getIEVersion()
Returns the version of Internet Explorer. |
double |
getNavigatorVersion()
Returns the version of Netscape Navigator |
javax.servlet.ServletOutputStream |
getOutputStream()
Returns the output stream to the browser. |
java.lang.String |
getPlatform()
Returns the operating system platform the on which the browser is running. |
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the HttpServletRequest object that this Browser object wrappers. |
java.lang.String |
getRequestURL()
Returns the HttpServletRequest URL. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the HttpServletResponse object that this Browser object wrappers. |
javax.servlet.http.HttpSession |
getSession()
Returns the HttpSession object that this Browser object wrappers. |
UploadedFile |
getUploadedFile(java.lang.String sourceFileName)
Returns the specified uploaded file instance. |
java.util.Enumeration |
getUploadedFileNames()
Returns an Enumeration of String objects
containing the names of the files uploaded in this request. |
java.lang.String |
getUserAgent()
Returns the HTTP_USER_AGENT HTTP header. |
java.lang.String |
getVersion()
Returns the full browser version string. |
boolean |
isClientValidationEnabled()
Determines whether JavaScript client validation will be generated or not. |
boolean |
isDefaultBaseHREFEnabled()
Returns whether or not automatic generation of the base tag
href= attribute in the document Head is enabled. |
boolean |
isIE()
Returns whether or not the browser is Internet Explorer. |
boolean |
isNavigator()
Returns whether or not the browser is Netscape Navigator. |
boolean |
isQueryParameterEncryptionEnabled()
Returns whether or not query parameter encryption is enabled. |
boolean |
isURLEncodingEnabled()
Returns whether or not automatic URL encoding is enabled. |
boolean |
isXHTMLEnabled()
Returns whether or not XHTML encoding is enabled. |
void |
parseUserAgent(java.lang.String userAgentHeader)
Parses the USER-AGENT header and sets the associated internal variables. |
Browser |
setExpirationDate(long date)
Sets the expiration date of the content to be returned to the browser. |
Browser |
setFilename(java.lang.String name)
Sets the suggested filename of a downloadable attachment. |
Browser |
setLastModifiedDate(long date)
Sets the last modified date of the content to be returned to the browser. |
Browser |
setNoCacheHeaders()
Sets the appropriate headers to ensure the response will not be cached by the browser. |
Browser |
useClientValidation(boolean on)
Determines whether JavaScript client validation will be generated or not. |
Browser |
useCompression(boolean compress)
Determines whether the document should be written back to the browser using compression if the browser supports it. |
Browser |
useDefaultBaseHREF(boolean on)
Determines whether the base tag href=
attribute in the document Head will be automatically generated or not. |
Browser |
useEncryptedQueryParameters(boolean encrypt)
Determines whether query parameters in, for example, anchors should be encrypted before being returned to the browser. |
Browser |
usePersistentConnection(boolean keepAlive)
Deprecated. 2.3.2 |
Browser |
useURLEncoding(boolean encode)
Determines whether URLs should be automatically encoded using HttpServletResponse.encodeURL by those objects that
contain or represent a URL, such as Anchor or Form. |
Browser |
useXHTML(boolean compliant)
Determines whether the document written back to the browser should be XHTML compliant or not. |
Browser |
write(byte[] bytes)
Sends an array of bytes to the browser. |
Browser |
write(java.lang.String text)
Prints a line of formatted HTML to the browser, without a carriage return-line feed (CRLF) character. |
Browser |
writeln()
Prints a carriage return-line feed (CRLF) character to the browser. |
Browser |
writeln(java.lang.String text)
Prints a line of formatted HTML to the browser, followed by a carriage return-line feed (CRLF) character. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String DEFAULT_CONTENT_TYPE_ATTRIBUTE
The value of this parameter defaults to "text/html" if not specified.
public static final java.lang.String MAX_FILE_UPLOAD_SIZE_ATTRIBUTE
getDefaultMaxFileUploadSize(javax.servlet.ServletContext),
Constant Field Valuespublic static final java.lang.String USE_COMPRESSION_ATTRIBUTE
useCompression(boolean),
Constant Field Valuespublic static final java.lang.String USE_ENCRYPTED_QUERY_PARAMETERS_ATTRIBUTE
useEncryptedQueryParameters(boolean),
Constant Field Valuespublic static final java.lang.String USE_URL_ENCODING_ATTRIBUTE
HttpServletResponse.encodeURL by those objects that
contain or represent a URL, such as Anchor or Form.
useURLEncoding(boolean),
Constant Field Valuespublic static final java.lang.String USE_XHTML_ATTRIBUTE
useXHTML(boolean),
Constant Field Valuespublic static final java.lang.String USE_DEFAULT_BASE_HREF_ATTRIBUTE
base tag
href= attribute in the document Head will be automatically
generated or not.
useDefaultBaseHREF(boolean),
Constant Field Valuespublic static final java.lang.String USE_CLIENT_VALIDATION_ATTRIBUTE
useClientValidation(boolean),
Constant Field Values| Constructor Detail |
public Browser()
This constructor is only used when the formatted HTML is required to be returned in a string or character array, rather then sent back to a physical browser.
public Browser(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws java.io.IOException,
javax.servlet.ServletException
context - the servlet context.request - the servlet request object.response - the servlet response object.
java.io.IOException - if an I/O error occurs.
javax.servlet.ServletException - if an unrecoverable exception occurs.
public Browser(javax.servlet.ServletContext context,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpSession session)
throws java.io.IOException,
javax.servlet.ServletException
context - the servlet context.request - the servlet request object.response - the servlet response object.session - the session object.
java.io.IOException - if an I/O error occurs.
javax.servlet.ServletException - if an unrecoverable exception occurs.| Method Detail |
public java.lang.String getAppName()
public boolean isClientValidationEnabled()
public javax.servlet.ServletContext getContext()
public boolean isDefaultBaseHREFEnabled()
base tag
href= attribute in the document Head is enabled.
useDefaultBaseHREF(boolean)public static int getDefaultMaxFileUploadSize(javax.servlet.ServletContext context)
This default value is determined from the web application deployment
descriptor. To set the default value, create a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.maxFileUploadSize, and a
<param-value> containing the maximum number of
bytes. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.maxFileUploadSize</param-name>
<param-value>1048510</param-value>
</context-param>
If the <context-param> does not exist, or the
<param-value> does not contain a valid number, the
default value of 1048510 will be used.
context - the servlet context from which the default value can be
determined
PajeServlet.setMaxFileUploadSize(int)public Browser setExpirationDate(long date)
date - the expiration date.
public Browser setFilename(java.lang.String name)
name - the suggested file name.
public boolean isIE()
public double getIEVersion()
getVersion()public Browser setLastModifiedDate(long date)
date - the last modified date.
public boolean isNavigator()
public double getNavigatorVersion()
getVersion()public Browser setNoCacheHeaders()
public javax.servlet.ServletOutputStream getOutputStream()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.public java.lang.String getPlatform()
public boolean isQueryParameterEncryptionEnabled()
useEncryptedQueryParameters(boolean)public javax.servlet.http.HttpServletRequest getRequest()
public java.lang.String getRequestURL()
public javax.servlet.http.HttpServletResponse getResponse()
public javax.servlet.http.HttpSession getSession()
public boolean isURLEncodingEnabled()
useURLEncoding(boolean)public UploadedFile getUploadedFile(java.lang.String sourceFileName)
sourceFileName - the file name of the uploaded file to be
retrieved.
getUploadedFileNames()public java.util.Enumeration getUploadedFileNames()
Enumeration of String objects
containing the names of the files uploaded in this request. If the
request has no uploaded files, returns an empty
Enumeration.
Enumeration of String objects,
each String containing the source file name of an
uploaded file; or an empty Enumeration if the
request has no uploaded files.getUploadedFile(java.lang.String)public java.lang.String getUserAgent()
public java.lang.String getVersion()
getIEVersion(),
getNavigatorVersion()public boolean isXHTMLEnabled()
useXHTML(boolean)
public void close()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.public void parseUserAgent(java.lang.String userAgentHeader)
userAgentHeader - the USER-AGENT header string.public Browser useClientValidation(boolean on)
By default, generation is enabled. To disable it as the default, the web
application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useClientValidation, and a
<param-value> of false. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useClientValidation</param-name>
<param-value>false</param-value>
</context-param>
on - if false, suppreses the generation of JavaScript client
validation.
public Browser useCompression(boolean compress)
OutputStream has already been opened.
By default, compression is disabled. To enable it as the default, the
web application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useCompression, and a
<param-value> of true. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useCompression</param-name>
<param-value>true</param-value>
</context-param>
WARNING! If compression is enabled, the output stream MUST be closed to correctly write the compression trailer.
compress - if true, the document will be written to the browser
using an appropriate compression encoding, based on the
"Accept-Encoding" HTTP header.
public Browser useDefaultBaseHREF(boolean on)
base tag href=
attribute in the document Head will be automatically generated or not.
By default, automatic generation is enabled. To disable it as the
default, the web application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useDefaultBaseHREF, and a
<param-value> of false. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useDefaultBaseHREF</param-name>
<param-value>false</param-value>
</context-param>
on - if false, suppreses the automatic generation of
thebase tag href= attribute in the
document Head.
public Browser useEncryptedQueryParameters(boolean encrypt)
OutputStream has already been opened.
By default, query parameter encryption is disabled. To enable it as the
default, the web application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useEncryptedQueryParameters, and
a <param-value> of true. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useEncryptedQueryParameters</param-name>
<param-value>true</param-value>
</context-param>
encrypt - if true, an URL encoded with Browser.getResponse().encodeURL(String) or Browser.getResponse().encodeRedirectURL(String) will have the
any query parameters encrypted.
public Browser usePersistentConnection(boolean keepAlive)
keepAlive - the keep alive setting.
public Browser useURLEncoding(boolean encode)
HttpServletResponse.encodeURL by those objects that
contain or represent a URL, such as Anchor or Form.
By default, encoding is disabled. To enable it as the default, the web
application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useURLEncoding, and a
<param-value> of true. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useURLEncoding</param-name>
<param-value>true</param-value>
</context-param>
encode - if true, those objects that contain or represent a URL,
such as Anchor or Form, will automatically call
HttpServletResponse.encodeURL.
public Browser useXHTML(boolean compliant)
By default, XHTML compliance is enabled. To disable it as the default,
the web application deployment descriptor must have a
<context-param> with a
<param-name> of
org.pajes.servlet.Browser.useXHTML, and a
<param-value> of false. For example:
<context-param>
<param-name>org.pajes.servlet.Browser.useXHTML</param-name>
<param-value>false</param-value>
</context-param>
compliant - if true, adds XHTML compliant headers to the document
and does some basic XHTML compliance checking.
public Browser write(java.lang.String text)
throws java.io.IOException
text - the text to be sent to the browser.
java.io.IOException - if an I/O error occurs.
public Browser write(byte[] bytes)
throws java.io.IOException
bytes - an array of bytes to be written to the output stream.
java.io.IOException - if an I/O error occurs.
public Browser writeln()
throws java.io.IOException
java.io.IOException - if an I/O error occurs.
public Browser writeln(java.lang.String text)
throws java.io.IOException
text - the text to be sent to the browser.
java.io.IOException - if an I/O error occurs.
|
PAJES 2.3.9 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||