java - Is it portable to reference the request parameter map after a request-cycle? -
I want to know if your Java servlet specification corresponds to the referring value of the reference / value of .
returns : unchangeable
Code> java.util.Map
parameter names are included in the form of map values as keys and parameter values. The parameters used in the parameter map are the string type. Value is string array in parameter map.
But this is not clear to me:
-
If the map is irrevocable for the application server only, the application server
-
If it is allowed that the application server can reuse an example of any other request (for example, if the parameters and their values are similar to the previous request
Edit: The reason for this: I want to save it and one more request Request map in case of errors to print them out for clinical purposes.
After the
If the map is simply unchanged for the application, not the application server
< / Blockquote>This API is irreversible, yes. It also makes sense, what does it mean to change the request parameter map? In turn, the implementation of the servlet container can be a temporary map of "behind the scenes". But you should not worry about implementation specific details.
This is that the application server could allow for example another request (for example to re-use, if the parameters and their values are only allowed, then according to the previous request )
No, the server does not do this. It just creates a new parameter that is bound to a specific request.
If you want to collect the parameters of each request during a session, then you have to do it yourself, the best place for this will be a
filter
. Public Zero doFilter (ServletRequest request, ServletResponse response, FilterChain series) throws ServiceletException, IOException {HttpServletRequest hsr = (HttpServletRequest) Request; List & lt; Maps & lt; String, string []> & Gt; AllParameters = (& lt; Map & LT; string; String [] & gt; & gt;) hsr.getSession () getAttribute ("allParameters");. If (allParameters == faucet) {allParameters = New Arreelist & lt; Maps & lt; String, string []> & Gt; (); Hsr.getSession (). SetAttribute ("All Parameters", All Parameters); } AllParameters.add (hsr.getParameterMap ()); Chain.doFilter (request, response); }
Comments
Post a Comment