|
Version 4.10.0
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Objecthirondelle.web4j.request.RequestParser
hirondelle.web4j.request.RequestParserImpl
public class RequestParserImpl
Maps each HTTP request to a concrete Action.
Default implementation of RequestParser.
This implementation extracts the URI Mapping String from the
underlying request, and maps it to a specific Action class, and calls its constructor by passing
a RequestParser. (Here, each Action must have a public constructor
which takes a RequestParser as its single parameter.)
There are two kinds of mapping available :
URI Mapping String
The 'URI Mapping String' is extracted from the underlying request. It is simply the concatention of
HttpServletRequest.getServletPath() and HttpServletRequest.getPathInfo()
(minus the extension - .do, for example).
(The servlet path is the part of the URI which has been mapped to a servlet by the servlet-mapping entries in the web.xml.)
Implicit Mapping
If no explicit mapping exists in an Action, then it will implicitly
map to the URI Mapping String that corresponds to a modified version of its
package-qualified name :
Example of an implicit mapping :
| Class Name: | hirondelle.fish.main.member.MemberEdit |
| ImplicitMappingRemoveBasePackage (web.xml): | hirondelle.fish |
| Implicit Mapping calculated as: | /main/member/MemberEdit |
Which maps to the following requests:
| Request 1: | http://www.blah.com/fish/main/member/MemberEdit.list |
| Request 2: | http://www.blah.com/fish/main/member/MemberEdit.do?Operation=List |
| URI Mapping String calculated as: | /main/member/MemberEdit |
Explicit Mapping
An Action may declare an explicit mapping to a URI Mapping String
simply by declaring a field of the form (for example) :
public static final String EXPLICIT_URI_MAPPING = "/translate/basetext/BaseTextEdit";Explicit mappings override implicit mappings.
| Constructor Summary | |
|---|---|
RequestParserImpl(HttpServletRequest aRequest,
HttpServletResponse aResponse)
Constructor. |
|
| Method Summary | |
|---|---|
static String |
getImplicitMappingRemoveBasePackage()
Return the String configured in web.xml as being the base or root package that is to be ignored by the default Action mapping mechanism. |
Action |
getWebAction()
Map an HTTP request to a concrete implementation of Action. |
static void |
initWebActionMappings()
Scan for Action mappings. |
| Methods inherited from class hirondelle.web4j.request.RequestParser |
|---|
getInstance, getRawParamValue, getRawParamValues, getRequest, getResponse, isFileUploadRequest, toId, toIds, toSafeText, toSafeTexts, toSupportedObject, toSupportedObjects |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RequestParserImpl(HttpServletRequest aRequest,
HttpServletResponse aResponse)
aRequest - passed to the super class.aResponse - passed to the super class.| Method Detail |
|---|
public static void initWebActionMappings()
Action mappings. Called by the framework upon startup. Scans for all classes
that implement Action. Stores either an implicit
or an explicit mapping. Implicit mappings are the recommended style.
If a problem with mapping is detected, then a RuntimeException is thrown, and
the application will not load. This protects the application, by forcing some important
errors to occur during startup, instead of during normal operation. Possible errors include :
Action
public final Action getWebAction()
Action.
Extract the URI Mapping String from the underlying request, and
map it to an Action.
getWebAction in class RequestParserpublic static final String getImplicitMappingRemoveBasePackage()
|
Version 4.10.0
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||