|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SK.gnome.dwarf.GenericService SK.gnome.dwarf.ParametersService SK.gnome.dwarf.http.HTTPParameters
Provides the HTTP parameters.
An instance of this class may be added to the HTTPServer
to provide
a set of the HTTP-related runtime parameters. The parameters are by default available
to the server and all its nested services.
Each parameter is represented by a protected field with its setter and getter methods, which can be used to manipulate the parameter from the outside world. This class provides also a few encoding-related static methods, which are also used by the HTTP server.
Note that some of the parameters are read-only while others may be modified in runtime either via the server console, or programatically.
Field Summary | |
protected boolean |
allowKeepAlive
Enables or disables persistent (keep-alive) connections. |
protected SK.gnome.dwarf.utils.StringProperties |
encodings
Returns mapping between MIME charsets and Java encodings. |
protected SK.gnome.dwarf.utils.StringProperties |
errorCodes
Returns mapping between HTTP error codes and reason-phrases. |
protected boolean |
extendedServerInfo
Enables or disables the extended server information. |
protected boolean |
fileRequestBody
Whether or not to store the request entity body in a temporary file. |
protected SK.gnome.dwarf.utils.StringProperties |
charsets
Returns mapping between Java locales and MIME charsets. |
protected int |
keepAliveTimeout
Number of seconds to wait for the next request from the persistent connection. |
protected int |
maxRequestBodySize
Returns maximum size of the request entity body in kB. |
protected SK.gnome.dwarf.utils.StringProperties |
mimeTypes
Returns mapping between MIME types and file extensions. |
protected int |
requestsPerConnection
Maximum number of requests allowed per one persistent connection. |
protected int |
requestTimeout
Returns the maximum time in seconds to wait for the incoming request data. |
protected boolean |
sendErrors
Enables or disables sending of detailed error messages to the client. |
protected boolean |
sendServerInfo
Enables or disables exposing of the server information to the client. |
protected boolean |
useJikesForJSP
Whether or not to use Jikes compiler to compile the JSP pages. |
Fields inherited from class SK.gnome.dwarf.GenericService |
initParameters, parent |
Fields inherited from interface SK.gnome.dwarf.Service |
INITIALIZED, LOG_DEBUG, LOG_ERROR, LOG_FATAL, LOG_INFO, LOG_TRACE, LOG_WARN, LOG_XFER, SHUTDOWN, STARTED, STOPPED |
Constructor Summary | |
HTTPParameters(java.lang.String name)
Creates a new HTTPParameters. |
Method Summary | |
boolean |
getAllowKeepAlive()
|
SK.gnome.dwarf.utils.StringProperties |
getEncodings()
|
SK.gnome.dwarf.utils.StringProperties |
getErrorCodes()
|
boolean |
getExtendedServerInfo()
|
boolean |
getFileRequestBody()
|
SK.gnome.dwarf.utils.StringProperties |
getCharsets()
|
java.lang.String |
getJavaEncoding(java.lang.String charset)
Returns the Java encoding for the given MIME charset. |
int |
getKeepAliveTimeout()
|
int |
getMaxRequestBodySize()
|
java.lang.String |
getMIMECharset(java.util.Locale locale)
Returns the MIME charset for the given Java locale. |
SK.gnome.dwarf.utils.StringProperties |
getMimeTypes()
|
int |
getRequestsPerConnection()
|
int |
getRequestTimeout()
|
boolean |
getSendErrors()
|
boolean |
getSendServerInfo()
|
java.lang.String |
getStatusPhrase(int code)
Returns the string phrase for the given status code. |
boolean |
getUseJikesForJSP()
|
void |
init(SK.gnome.dwarf.Server parent)
|
void |
setAllowKeepAlive(boolean value)
|
void |
setEncodings(SK.gnome.dwarf.utils.StringProperties value)
|
void |
setErrorCodes(SK.gnome.dwarf.utils.StringProperties value)
|
void |
setExtendedServerInfo(boolean enable)
|
void |
setFileRequestBody(boolean enable)
|
void |
setCharsets(SK.gnome.dwarf.utils.StringProperties value)
|
void |
setKeepAliveTimeout(int value)
|
void |
setMaxRequestBodySize(int value)
|
void |
setMimeTypes(SK.gnome.dwarf.utils.StringProperties value)
|
void |
setRequestsPerConnection(int value)
|
void |
setRequestTimeout(int value)
|
void |
setSendErrors(boolean value)
|
void |
setSendServerInfo(boolean enable)
|
void |
setUseJikesForJSP(boolean enable)
|
Methods inherited from class SK.gnome.dwarf.ParametersService |
readOnly, report |
Methods inherited from class SK.gnome.dwarf.GenericService |
getAuthenticator, getAuthFacility, getFullName, getInitParameter, getInitParameterNames, getLogFacility, getLogger, getName, getParameters, getPrincipal, getShutdownTimeout, getState, log, log, login, logout, setAuthFacility, setInitParameters, setLogFacility, shutdown, start, stop, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected boolean sendServerInfo
If enabled, the server will send the server identification in the Server: header of each HTTP response as well as in the server-generated HTML error messages.
The HTTP/1.1 specification encourages the servers to make this feature configurable since it can reveal some sensitive information to a possible attacker.
This parameter is read-only.
Default value: true
protected boolean extendedServerInfo
If enabled, an extended server information will be sent to the client in the HTTP reponse headers as well as the error messages generated by the server. The extended information includes details of the system platform and the JRE version.
This parameter is read-only.
Default value: false
sendServerInfo
protected boolean sendErrors
If enabled, errors will be sent to the client with a detailed information about the current request, including the exception stack trace listing. Do not turn on this option in a production environment; use it for the debugging purposes only.
This parameter is modifiable.
Default value: false
protected int requestTimeout
Each single attempt to read from the underlying socket while receiving the request is blocked just for this specified amount of time. It prevents the possible DOS attacks when client opens a connection to the server and starts sending the request data without finishing it.
This parameter is read-only.
Default value: 60
protected boolean allowKeepAlive
Connection is persistent if it can be used to send and receive more than one HTTP request/response pair.
This parameter is read-only.
Default value: true
protected int keepAliveTimeout
Zero means no timeout, i.e. the server will wait forever. Basically, if there are more incoming requests than the available handlers, decreasing this value should help to eliminate possible delays between processing the particular requests.
This parameter is read-only.
Value: 15
protected int requestsPerConnection
Increasing this value may increase the server performance as well as the efficiency of using the memory resources.
This parameter is read-only.
Value: 10
protected int maxRequestBodySize
This limits the size of the request entity body thus preventing the possible DOS attacks by frequent sending a huge amount of data by the malicious client.
Zero value means no limit.
This parameter is modifiable.
Default value: 0
protected boolean fileRequestBody
The request entity body may be stored in a temporary file instead of the operational memory if its total length exceeds a specified size. This may optimize usage of the memory resources when large amounts of data are being sent via HTTP requests to the server. A typical example of this is the file uploading process.
This parameter is read-only.
Default value: true
HTTPConstants.HTTP_REQUEST_BODY_LIMIT
protected boolean useJikesForJSP
The Jikes compiler may be used instead of the default Sun's compiler, which requires the Java SDK to be installed. The compiler executable must be included in the current command path, i.e. one must be able to invoke it from the command line.
This parameter is read-only.
Default value: false
protected SK.gnome.dwarf.utils.StringProperties mimeTypes
This parameter is read-only.
Default value: file:conf/samples/http/mimetypes.properties
protected SK.gnome.dwarf.utils.StringProperties encodings
This parameter is read-only.
Default value: file:conf/samples/http/encodings.properties
getJavaEncoding(String)
protected SK.gnome.dwarf.utils.StringProperties charsets
This parameter is read-only.
Default value: file:conf/samples/http/charsets.properties
getMIMECharset(Locale)
protected SK.gnome.dwarf.utils.StringProperties errorCodes
This parameter is read-only.
Default value: file:conf/samples/http/errcodes.properties
getStatusPhrase(int)
Constructor Detail |
public HTTPParameters(java.lang.String name)
Method Detail |
public void init(SK.gnome.dwarf.Server parent) throws SK.gnome.dwarf.ServiceException
SK.gnome.dwarf.ServiceException
public java.lang.String getJavaEncoding(java.lang.String charset)
This method maps MIME charsets to Java encoding identifiers. If no Java encoding can be found for the given charset, the null is returned.
charset
- the charset
public java.lang.String getMIMECharset(java.util.Locale locale)
This method maps Java locales to MIME charsets. Either the locale string representation or the locale language is used to obtain the charset. The string representation is checked before the language string.
locale
- the locale
public java.lang.String getStatusPhrase(int code)
This method maps numerical HTTP status codes to their string phrases.
code
- the numerical status code
public boolean getSendServerInfo()
public void setSendServerInfo(boolean enable)
public boolean getExtendedServerInfo()
public void setExtendedServerInfo(boolean enable)
public boolean getSendErrors()
public void setSendErrors(boolean value)
public int getRequestTimeout()
public void setRequestTimeout(int value)
public boolean getAllowKeepAlive()
public void setAllowKeepAlive(boolean value)
public int getKeepAliveTimeout()
public void setKeepAliveTimeout(int value)
public int getRequestsPerConnection()
public void setRequestsPerConnection(int value)
public int getMaxRequestBodySize()
public void setMaxRequestBodySize(int value)
public boolean getFileRequestBody()
public void setFileRequestBody(boolean enable)
public boolean getUseJikesForJSP()
public void setUseJikesForJSP(boolean enable)
public SK.gnome.dwarf.utils.StringProperties getMimeTypes()
public void setMimeTypes(SK.gnome.dwarf.utils.StringProperties value)
public SK.gnome.dwarf.utils.StringProperties getEncodings()
public void setEncodings(SK.gnome.dwarf.utils.StringProperties value)
public SK.gnome.dwarf.utils.StringProperties getCharsets()
public void setCharsets(SK.gnome.dwarf.utils.StringProperties value)
public SK.gnome.dwarf.utils.StringProperties getErrorCodes()
public void setErrorCodes(SK.gnome.dwarf.utils.StringProperties value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |