|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectpt.moredata.dataentry.util.http.DataEntryServletRequest
Esta classe permite manipular pedidos que venham com diferentes tipos de encode. Company MoreData
| Field Summary |
| Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
| Constructor Summary | |
DataEntryServletRequest(javax.servlet.http.HttpServletRequest request)
Construtor para fazer o file upload directamente para a memoria. |
|
DataEntryServletRequest(javax.servlet.http.HttpServletRequest request,
java.lang.String saveDirectory)
Construtor para fazer o file upload directamente para a memoria e para gurdar uma copia dos ficheiro numa dada directoria. |
|
| Method Summary | |
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the named attribute as an Object.
|
java.util.Enumeration |
getAttributeNames()
Returns an Enumeration containing the
names of the attributes available to this request.
|
java.lang.String |
getAuthType()
Returns the name of the authentication scheme the server uses, for example, "BASIC" or "SSL," or null
if the server does not have an authentication scheme.
|
java.lang.String |
getCharacterEncoding()
Returns the name of the character encoding style used in this request. |
int |
getContentLength()
Returns the length, in bytes, of the content contained in the request and sent by way of the input stream or -1 if the length is not known. |
java.lang.String |
getContentType()
Returns the MIME type of the content of the request, or null if the type is not known. |
java.lang.String |
getContentType(java.lang.String name)
Returns the content type of the specified file (as supplied by the client browser), or null if the file was not included in the upload. |
java.lang.String |
getContextPath()
|
javax.servlet.http.Cookie[] |
getCookies()
Returns an array containing all of the Cookie
objects the browser sent with this request.
|
long |
getDateHeader(java.lang.String name)
Returns the value of the specified request header as a long value that represents a
Date object. |
int |
getEncodeType()
|
java.io.File |
getFile(java.lang.String name)
Returns a File object for the specified file saved on the server's filesystem, or null if the file was not included in the upload. |
byte[] |
getFileData(java.lang.String fileName)
Returns a byte array object for the specified file saved on the server's filesystem, or null if the file was not included in the upload. |
java.util.Enumeration |
getFileNames()
Returns the names of all the uploaded files as an Enumeration of Strings. |
java.lang.String |
getFilesystemName(java.lang.String name)
Returns the filesystem name of the specified file, or null if the file was not included in the upload. |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specified request header as a String. |
java.util.Enumeration |
getHeaderNames()
Returns an enumeration of all the header names this request contains. |
java.util.Enumeration |
getHeaders(java.lang.String name)
|
javax.servlet.ServletInputStream |
getInputStream()
Retrieves binary data from the body of the request as a ServletInputStream, which
gives you the ability to read one line at a time. |
int |
getIntHeader(java.lang.String name)
Returns the value of the specified request header as an integer. |
java.lang.String |
getLocalAddr()
|
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getLocalName()
|
int |
getLocalPort()
|
java.lang.String |
getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value of a request parameter as a String,
or null if the parameter does not exist. |
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
Returns an Enumeration of String
objects containing the names of the parameters contained
in this request. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Returns an array of String objects containing
all of the values the
given request parameter has, or null if the
parameter does not exist. |
java.lang.String |
getPathInfo()
Returns any extra path information associated with the URL the client sent when it made this request. |
java.lang.String |
getPathTranslated()
Returns any extra path information after the servlet name but before the query string, and translates it to a real path. |
java.lang.String |
getProtocol()
Returns the name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1. |
java.lang.String |
getQueryString()
Returns the query string that is contained in the request URL after the path. |
java.io.BufferedReader |
getReader()
Returns the body of the request as a BufferedReader
that translates character set encodings. |
java.lang.String |
getRealPath(java.lang.String path)
Deprecated. As of Version 2.1 of the Java Servlet API, use ServletContext#getRealPath instead. |
java.lang.String |
getRemoteAddr()
Returns the Internet Protocol (IP) address of the client that sent the request. |
java.lang.String |
getRemoteHost()
Returns the fully qualified name of the client that sent the request. |
int |
getRemotePort()
|
java.lang.String |
getRemoteUser()
Returns the name of the user making this request, if the user has logged in using HTTP authentication. |
javax.servlet.RequestDispatcher |
getRequestDispatcher(java.lang.String path)
|
java.lang.String |
getRequestedSessionId()
Returns the session ID specified by the client. |
java.lang.String |
getRequestURI()
Returns the part of this request's URL from the protocol name up to the query string in the first line of the HTTP request. |
java.lang.StringBuffer |
getRequestURL()
|
java.lang.String |
getScheme()
Returns the name of the scheme used to make this request, for example, http, https, or ftp.
|
java.lang.String |
getServerName()
Returns the host name of the server that received the request. |
int |
getServerPort()
Returns the port number on which this request was received. |
java.lang.String |
getServletPath()
Returns the part of this request's URL that calls the servlet. |
javax.servlet.http.HttpSession |
getSession()
Returns the current session associated with this request, or if the request does not have a session, creates one. |
javax.servlet.http.HttpSession |
getSession(boolean create)
Returns the current HttpSession
associated with this request or, if necessary, creates
a new session for the request. |
java.security.Principal |
getUserPrincipal()
|
boolean |
isRequestedSessionIdFromCookie()
Checks whether the session ID this request submitted came in as a cookie, rather than from the getSession(boolean)
method. |
boolean |
isRequestedSessionIdFromUrl()
Deprecated. As of Version 2.1 of the Java Servlet API, use isRequestedSessionIdFromURL()
instead. |
boolean |
isRequestedSessionIdFromURL()
Checks whether the session ID this request submitted came in as part of the request URL, rather than from the getSession(boolean) method. |
boolean |
isRequestedSessionIdValid()
Checks whether this request has a valid session in the current session context (which is a HttpSessionContext).
|
boolean |
isSecure()
|
boolean |
isUserInRole(java.lang.String role)
|
void |
removeAttribute(java.lang.String name)
|
void |
setAttribute(java.lang.String key,
java.lang.Object o)
Stores an attribute in the context of this request. |
void |
setCharacterEncoding(java.lang.String aa)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DataEntryServletRequest(javax.servlet.http.HttpServletRequest request,
java.lang.String saveDirectory)
throws java.lang.RuntimeException
request - Pedido HttpServletRequest.saveDirectory - Nome da directoria onde deveram ser guardados os
ficheiros.
public DataEntryServletRequest(javax.servlet.http.HttpServletRequest request)
throws java.lang.RuntimeException
request - Pedido HttpServletRequest.| Method Detail |
public byte[] getFileData(java.lang.String fileName)
public int getEncodeType()
public java.lang.String toString()
public java.lang.Object getAttribute(java.lang.String name)
Object.
This method allows the servlet engine to give the servlet
custom information about a request. This method returns
null if no attribute of the given name exists.
Attribute names should follow the same conventions as package
names. This specification reserves names matching java.*,
javax.*, and sun.*.
getAttribute in interface javax.servlet.ServletRequestname - a String specifying the name of
the attribute
Object containing the value
of the attribute, or null if
the attribute does not existpublic java.util.Enumeration getAttributeNames()
Enumeration containing the
names of the attributes available to this request.
This method returns an empty Enumeration
if the request has no attributes available to it.
getAttributeNames in interface javax.servlet.ServletRequestEnumeration of strings
containing the names
of the request's attributespublic java.lang.String getCharacterEncoding()
null if the request
does not use character encoding.
getCharacterEncoding in interface javax.servlet.ServletRequestString containing the name of
the chararacter encoding style, or null
if the request does not use character encodingpublic int getContentLength()
getContentLength in interface javax.servlet.ServletRequestpublic java.lang.String getContentType()
null if the type is not known. Same as the value
of the CGI variable CONTENT_TYPE.
getContentType in interface javax.servlet.ServletRequestString containing the name
of the MIME type of
the request, or -1 if the type is not known
public javax.servlet.ServletInputStream getInputStream()
throws java.io.IOException
ServletInputStream, which
gives you the ability to read one line at a time.
getInputStream in interface javax.servlet.ServletRequestServletInputStream object containing
the body of the request
java.lang.IllegalStateException - if the getReader() method
has already been called for this request
java.io.IOException - if an input or output exception occurredpublic java.util.Locale getLocale()
getLocale in interface javax.servlet.ServletRequestpublic java.util.Enumeration getLocales()
getLocales in interface javax.servlet.ServletRequestpublic java.lang.String getParameter(java.lang.String name)
String,
or null if the parameter does not exist. Request parameters
are extra information sent with the request.
You should only use this method when you are sure the
parameter has only one value. If the parameter might have
more than one value, use getParameterValues(java.lang.String).
If you use this method with a multivalued parameter, the servlet engine determines the return value.
getParameter in interface javax.servlet.ServletRequestname - a String specifying the
name of the parameter
String representing the
single value of the parametergetParameterValues(java.lang.String)public java.util.Enumeration getParameterNames()
Enumeration of String
objects containing the names of the parameters contained
in this request. If the request has
no parameters or if the input stream is empty, returns an
empty Enumeration. The input stream is empty
when all the data returned by getInputStream() has
been read.
getParameterNames in interface javax.servlet.ServletRequestEnumeration of String
objects, each String containing
the name of a request parameter; or an
empty Enumeration if the
request has no parameterspublic java.lang.String[] getParameterValues(java.lang.String name)
String objects containing
all of the values the
given request parameter has, or null if the
parameter does not exist. For example, in an HTTP servlet,
this method returns an array of String objects
containing the values of a query string or posted form.
If the parameter has a single value, the array has a length of 1.
getParameterValues in interface javax.servlet.ServletRequestname - a String containing the name of
the parameter whose value is requested
String objects
containing the parameter's valuesgetParameter(java.lang.String)public java.lang.String getProtocol()
SERVER_PROTOCOL.
getProtocol in interface javax.servlet.ServletRequestString containing the protocol
name and version numberpublic java.lang.String getScheme()
http, https, or ftp.
Different schemes have different rules for constructing URLs,
as noted in RFC 1738.
You can reconstruct the URL used to make this request by using this scheme, the server name and port, the pathname to the Web page on the server (also known as the Universal Resource Identifier), and the query string..
getScheme in interface javax.servlet.ServletRequestString containing the name
of the scheme used to make this requestpublic java.lang.String getServerName()
SERVER_NAME.
getServerName in interface javax.servlet.ServletRequestString containing the name
of the server to which the request was sentpublic int getServerPort()
SERVER_PORT.
getServerPort in interface javax.servlet.ServletRequest
public java.io.BufferedReader getReader()
throws java.io.IOException
BufferedReader
that translates character set encodings.
getReader in interface javax.servlet.ServletRequestBufferedReader
containing the body of the request
java.io.UnsupportedEncodingException - if the character set encoding
used is not supported and the
text cannot be decoded
java.lang.IllegalStateException - if getInputStream() method
has been called on this request
java.io.IOException - if an input or output exception occurredgetInputStream()public java.lang.String getRemoteAddr()
REMOTE_ADDR.
getRemoteAddr in interface javax.servlet.ServletRequestString containing the
IP address of the client that sent the requestpublic java.lang.String getRemoteHost()
REMOTE_HOST.
getRemoteHost in interface javax.servlet.ServletRequestString containing the fully qualified name
of the client
public void setAttribute(java.lang.String key,
java.lang.Object o)
Attribute names should follow the same conventions as
package names. Names beginning with java.*,
javax.*, and com.sun.*, are
reserved for use by Sun Microsystems.
setAttribute in interface javax.servlet.ServletRequestkey - a String specifying
the name of the attributeo - an Object containing
the context of the request
java.lang.IllegalStateException - if the specified attribute already has a valuepublic java.lang.String getRealPath(java.lang.String path)
ServletContext#getRealPath instead.
getRealPath in interface javax.servlet.ServletRequestpublic javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
getRequestDispatcher in interface javax.servlet.ServletRequestpublic boolean isSecure()
isSecure in interface javax.servlet.ServletRequestpublic void removeAttribute(java.lang.String name)
removeAttribute in interface javax.servlet.ServletRequest
public void setCharacterEncoding(java.lang.String aa)
throws java.io.UnsupportedEncodingException
setCharacterEncoding in interface javax.servlet.ServletRequestjava.io.UnsupportedEncodingExceptionpublic java.util.Map getParameterMap()
getParameterMap in interface javax.servlet.ServletRequestpublic int getRemotePort()
getRemotePort in interface javax.servlet.ServletRequestpublic int getLocalPort()
getLocalPort in interface javax.servlet.ServletRequestpublic java.lang.String getLocalName()
getLocalName in interface javax.servlet.ServletRequestpublic java.lang.String getLocalAddr()
getLocalAddr in interface javax.servlet.ServletRequestpublic java.lang.String getAuthType()
null
if the server does not have an authentication scheme.
The authentication scheme provides a challenge-response model in which the server challenges the client, and the client provides authentication information. Same as the value of the CGI variable AUTH_TYPE.
getAuthType in interface javax.servlet.http.HttpServletRequestString specifying the name of
the authentication scheme, or
null if the server
does not have an authentication
schemepublic javax.servlet.http.Cookie[] getCookies()
Cookie
objects the browser sent with this request.
This method returns null if the browser did
not send any cookies.
getCookies in interface javax.servlet.http.HttpServletRequestCookies
included with this request, or null
if the request has no cookiespublic java.lang.String getContextPath()
getContextPath in interface javax.servlet.http.HttpServletRequestpublic long getDateHeader(java.lang.String name)
long value that represents a
Date object. Use this method with
headers that contain dates, such as
If-Modified-Since.
The date is returned as the number of milliseconds since January 1, 1970 GMT. The header name is case insensitive.
If the request did not have a header of the
specified name, this method returns -1. If the header
can't be converted to a date, the method returns
an IllegalArgumentException.
getDateHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the
name of the header
long value
representing the date specified
in the header expressed as
the number of milliseconds
since January 1, 1970 GMT,
or -1 if the named header
was not included with the
reqestpublic java.util.Enumeration getHeaders(java.lang.String name)
getHeaders in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getHeader(java.lang.String name)
String. If the named header wasn't
sent with
the request, this method returns null.
The header name is case insensitive. You can use
this method with any request header.
getHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the
header name
String containing the
value of the requested
header, or null
if the request does not
have a header of that namepublic java.util.Enumeration getHeaderNames()
Some servlet engines do not allow do not allow
servlets to access headers using this method, in
which case this method returns null
getHeaderNames in interface javax.servlet.http.HttpServletRequestnullpublic int getIntHeader(java.lang.String name)
NumberFormatException.
The header name is case insensitive.
getIntHeader in interface javax.servlet.http.HttpServletRequestname - a String specifying the name
of a request header
public java.lang.String getMethod()
String is the same as
the value of the CGI variable REQUEST_METHOD.
getMethod in interface javax.servlet.http.HttpServletRequestString
specifying the name
of the method with which
this request was madepublic java.lang.String getPathInfo()
null if there
was no extra path information.
The information this method returns is the same as the value of the CGI variable PATH_INFO.
getPathInfo in interface javax.servlet.http.HttpServletRequestString specifying
extra path information that comes
after the servlet path but before
the query string in the request URL;
or null if the URL does not have
any extra path informationpublic java.lang.String getPathTranslated()
If the URL does not have any extra path information,
this method returns null.
getPathTranslated in interface javax.servlet.http.HttpServletRequestString specifying the
real path, or null if
the URL does not have any extra path
informationpublic java.lang.String getQueryString()
null
if the URL does not have a query string. Same as the value
of the CGI variable QUERY_STRING.
getQueryString in interface javax.servlet.http.HttpServletRequestString containing the query
string or null if the URL
contains no query stringpublic java.lang.String getRemoteUser()
null if the user login is not authenticated.
Whether the user name is sent with each subsequent request
depends on the browser. Same as the value of the CGI variable
REMOTE_USER.
getRemoteUser in interface javax.servlet.http.HttpServletRequestString specifying the name
of the user making this request, or null
public java.lang.String getRequestedSessionId()
null.
getRequestedSessionId in interface javax.servlet.http.HttpServletRequestString specifying the session
ID, or null if the request did
not specify a session IDisRequestedSessionIdValid()public java.lang.String getRequestURI()
First line of HTTP request Returned Value POST /some/path.html HTTP/1.1 /some/path.html GET http://foo.bar/a.html HTTP/1.0 http://foo.bar/a.html HEAD /xyz?a=b HTTP/1.1 /xyz
To reconstruct an URL with a scheme and host, use
HttpUtils#getRequestURL, which
returns a StringBuffer.
getRequestURI in interface javax.servlet.http.HttpServletRequestString containing
the part of the URL from the
protocol name up to the query stringHttpUtils#getRequestURLpublic java.security.Principal getUserPrincipal()
getUserPrincipal in interface javax.servlet.http.HttpServletRequestpublic java.lang.String getServletPath()
getServletPath in interface javax.servlet.http.HttpServletRequestString containing
the name or path of the servlet being
called, as it is specified in
the request URLpublic javax.servlet.http.HttpSession getSession(boolean create)
HttpSession
associated with this request or, if necessary, creates
a new session for the request. Use true
for create to create a new session,
or false to return the current
HttpSession.
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 at least once before
you write any output to the response. Newly created
sessions (that is, sessions for which
HttpSession.isNew returns true)
do not have any application-specific state.
getSession in interface javax.servlet.http.HttpServletRequestHttpSession associated
with this request or null if
create is false
and the request has no valid sessionpublic javax.servlet.http.HttpSession getSession()
getSession in interface javax.servlet.http.HttpServletRequestHttpSession associated
with this requestpublic boolean isRequestedSessionIdValid()
HttpSessionContext).
If the session is not valid,
the getSession(boolean) method never returns it.
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequesttrue if this
request has a valid session
in the current session context;
otherwise, falsegetRequestedSessionId(),
getSession(boolean),
HttpSessionContextpublic boolean isRequestedSessionIdFromCookie()
getSession(boolean)
method.
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequesttrue if the session ID
came in as a
cookie; otherwise, falsegetSession(boolean)public boolean isRequestedSessionIdFromURL()
getSession(boolean) method.
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequesttrue if the session ID
came in as part of an URL; otherwise,
falsegetSession(boolean)public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromURL()
instead.
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequestpublic boolean isUserInRole(java.lang.String role)
isUserInRole in interface javax.servlet.http.HttpServletRequestpublic java.lang.StringBuffer getRequestURL()
getRequestURL in interface javax.servlet.http.HttpServletRequestpublic java.util.Enumeration getFileNames()
public java.lang.String getFilesystemName(java.lang.String name)
name - the file name.
public java.lang.String getContentType(java.lang.String name)
name - the file name.
public java.io.File getFile(java.lang.String name)
name - the file name.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||