Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
14119 posts
|
Author: jleroux
Date: Sun May 20 17:37:27 2012 New Revision: 1340775 URL: http://svn.apache.org/viewvc?rev=1340775&view=rev Log: "Applied fix from trunk for revision: 1340774" ------------------------------------------------------------------------ r1340774 | jleroux | 2012-05-20 19:36:26 +0200 (dim., 20 mai 2012) | 3 lines Closes "Improve site-conf.xsd" https://issues.apache.org/jira/browse/OFBIZ-4874 I always wondered why the controller syntax was poorly documented. I tried to improve that... ------------------------------------------------------------------------ Modified: ofbiz/branches/release12.04/ (props changed) ofbiz/branches/release12.04/framework/webapp/dtd/site-conf.xsd Propchange: ofbiz/branches/release12.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1340774 Modified: ofbiz/branches/release12.04/framework/webapp/dtd/site-conf.xsd URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/webapp/dtd/site-conf.xsd?rev=1340775&r1=1340774&r2=1340775&view=diff ============================================================================== --- ofbiz/branches/release12.04/framework/webapp/dtd/site-conf.xsd (original) +++ ofbiz/branches/release12.04/framework/webapp/dtd/site-conf.xsd Sun May 20 17:37:27 2012 @@ -26,13 +26,13 @@ under the License. <xs:element minOccurs="0" ref="owner"/> <xs:element minOccurs="0" ref="errorpage"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="handler"/> - <xs:element minOccurs="0" maxOccurs="1" ref="protect"/> + <xs:element minOccurs="0" ref="protect"/> <xs:element minOccurs="0" ref="firstvisit"/> <xs:element minOccurs="0" ref="preprocessor"/> <xs:element minOccurs="0" ref="postprocessor"/> <xs:element minOccurs="0" ref="after-login"/> <xs:element minOccurs="0" ref="before-logout"/> - <xs:element minOccurs="0" maxOccurs="1" ref="default-request"/> + <xs:element minOccurs="0" ref="default-request"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="request-map"/> <xs:element minOccurs="0" maxOccurs="unbounded" ref="view-map"/> </xs:sequence> @@ -59,6 +59,12 @@ under the License. <xs:element name="owner" type="xs:string"/> <xs:element name="errorpage" type="xs:string"/> <xs:element name="handler"> + <xs:annotation> + <xs:documentation> + Defines a Java class which handles a specific named type (either request or view). + This allows different logics for processing input from requests. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.handler"/> </xs:complexType> @@ -66,16 +72,28 @@ under the License. <xs:attributeGroup name="attlist.handler"> <xs:attribute type="xs:string" name="name" use="required"/> <xs:attribute name="type" default="request"> + <xs:annotation> + <xs:documentation> + To keep it short, request is for action when view is for rendering + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> - <xs:enumeration value="view"/> <xs:enumeration value="request"/> + <xs:enumeration value="view"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute type="xs:string" name="class" use="required"/> </xs:attributeGroup> <xs:element name="protect"> + <xs:annotation> + <xs:documentation> + Mechanism used to protect from data leakage (data stolen from a login/password couple compromised). + It works like the grey list anti-spam feature (aka tarpitting). + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.protect"/> </xs:complexType> @@ -84,6 +102,12 @@ under the License. <xs:attribute type="xs:string" name="view" use="required"/> </xs:attributeGroup> <xs:element name="firstvisit"> + <xs:annotation> + <xs:documentation> + Event runs at the 1st visit and only then. + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/> @@ -91,6 +115,12 @@ under the License. </xs:complexType> </xs:element> <xs:element name="preprocessor"> + <xs:annotation> + <xs:documentation> + Event runs before each request. + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/> @@ -98,6 +128,12 @@ under the License. </xs:complexType> </xs:element> <xs:element name="postprocessor"> + <xs:annotation> + <xs:documentation> + Event runs after each request. + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/> @@ -105,6 +141,12 @@ under the License. </xs:complexType> </xs:element> <xs:element name="after-login"> + <xs:annotation> + <xs:documentation> + Event runs after login and only then. + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/> @@ -112,6 +154,12 @@ under the License. </xs:complexType> </xs:element> <xs:element name="before-logout"> + <xs:annotation> + <xs:documentation> + Event runs before logout and only then. + Any error will be ignored and will not affect the requests processing flow. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="event"/> @@ -119,6 +167,11 @@ under the License. </xs:complexType> </xs:element> <xs:element name="default-request"> + <xs:annotation> + <xs:documentation> + If a request cannot be called, or is not defined, the default-request is used + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.default-request"/> </xs:complexType> @@ -127,6 +180,11 @@ under the License. <xs:attribute type="xs:string" name="request-uri" use="required"/> </xs:attributeGroup> <xs:element name="request-map"> + <xs:annotation> + <xs:documentation> + Place where are defined the elements of a request. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" ref="description"/> @@ -138,8 +196,19 @@ under the License. </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.request-map"> - <xs:attribute type="xs:string" name="uri" use="required"/> + <xs:attribute type="xs:string" name="uri" use="required"> + <xs:annotation> + <xs:documentation> + The name of this request. This will be the name used to access the request. + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="edit" default="true"> + <xs:annotation> + <xs:documentation> + Reserved for future use (not used yet). + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -148,23 +217,50 @@ under the License. </xs:simpleType> </xs:attribute> <xs:attribute name="track-visit" default="true"> + <xs:annotation> + <xs:documentation> + Allow or not to track first visit (related to firstvisit preprocessor). + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> - <xs:enumeration value="false"/> + <xs:enumeration value="false"> + <xs:annotation> + <xs:documentation> + Don't track as first visit (related to firstvisit preprocessor). + </xs:documentation> + </xs:annotation> + </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="track-serverhit" default="true"> + <xs:annotation> + <xs:documentation> + Allow or not to track statistics. + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> - <xs:enumeration value="false"/> + <xs:enumeration value="false"> + <xs:annotation> + <xs:documentation> + Don't track in the statistics. + </xs:documentation> + </xs:annotation> + </xs:enumeration> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:attributeGroup> <xs:element name="security"> + <xs:annotation> + <xs:documentation> + Define the security of the request-map, using https and auth boolean attributes. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.security"/> </xs:complexType> @@ -173,12 +269,23 @@ under the License. <xs:attribute name="https" default="false"> <xs:simpleType> <xs:restriction base="xs:token"> - <xs:enumeration value="true"/> + <xs:enumeration value="true"> + <xs:annotation> + <xs:documentation> + Redirects to/uses/generates the secured HTTPS protocol if necessary and possible + </xs:documentation> + </xs:annotation> + </xs:enumeration> <xs:enumeration value="false"/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="auth" default="false"> + <xs:annotation> + <xs:documentation> + If auth=true, when you hit the request if you are not logged in you will be forwarded to the login page. + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -187,6 +294,12 @@ under the License. </xs:simpleType> </xs:attribute> <xs:attribute name="cert" default="false"> + <xs:annotation> + <xs:documentation> + It true, check for HTTPS client (x.509) security. + If the request is not secured throws an exception + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -195,6 +308,13 @@ under the License. </xs:simpleType> </xs:attribute> <xs:attribute name="external-view" default="true"> + <xs:annotation> + <xs:documentation> + If false, prevent to pass a view through the url ("chaining" it after the request, + like control/request/view in an FTL file). + Default to true. + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -203,6 +323,11 @@ under the License. </xs:simpleType> </xs:attribute> <xs:attribute name="direct-request" default="true"> + <xs:annotation> + <xs:documentation> + If false the request can only be accessed in a chained request + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -212,16 +337,61 @@ under the License. </xs:attribute> </xs:attributeGroup> <xs:element name="event"> + <xs:annotation> + <xs:documentation> + Defines a piece of code (see handlers) which will handles the request need. + Return any string which is then used to route to different responses. + Only one event by request-map. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.event"/> </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.event"> - <xs:attribute name="type" type="xs:string" use="required"/> - <xs:attribute name="name" type="xs:string"/> - <xs:attribute name="path" type="xs:string"/> - <xs:attribute name="invoke" type="xs:string"/> + <xs:attribute name="type" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation> + There are as much as types (of type request) as available defined and accessible event handlers. + Most used are java, service, service-multi, simple and bsf (or groovy). + A most comprehensive list can be found in the common-controller. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="name" type="xs:string"> + <xs:annotation> + <xs:documentation> + Event name, mostly used with special events + (firstvisit, + preprocessor, + postprocessor, + after-login, + before-logout) + where the name allows to differentiate them. + Most of the time reques-maps, which have only 1 event, don't use it. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="path" type="xs:string"> + <xs:annotation> + <xs:documentation> + The path to the class or XML file containing this event, leave empty for services. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute name="invoke" type="xs:string"> + <xs:annotation> + <xs:documentation> + The name of the method or service to be run. + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="global-transaction" default="true"> + <xs:annotation> + <xs:documentation> + For service-multi, defines if the event should be wrapped in a transaction, default to true + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> @@ -231,47 +401,144 @@ under the License. </xs:attribute> </xs:attributeGroup> <xs:element name="response"> + <xs:annotation> + <xs:documentation> + You can have one response for each possible return code from the event. + An event can return any string, and that string can be used to route to different responses. + At least one reponse by request-map. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" ref="redirect-parameter"/> + <xs:element minOccurs="0" maxOccurs="unbounded" ref="redirect-parameter"> + <xs:annotation> + <xs:documentation> + Defines a possible parameter to redirect + </xs:documentation> + </xs:annotation> + </xs:element> </xs:sequence> <xs:attributeGroup ref="attlist.response"/> </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.response"> - <xs:attribute name="name" type="xs:string" use="required"/> + <xs:attribute name="name" type="xs:string" use="required"> + <xs:annotation> + <xs:documentation> + The name of the response, wich also matches the string returned by the event + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="type" use="required"> + <xs:annotation> + <xs:documentation> + One of the possible types between: + none, + view, + view-last, + view-last-noparam, + view-home, + request, + request-redirect, + request-redirect-noparam, + url + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> - <xs:enumeration value="none"/> - <xs:enumeration value="view"/> + <xs:enumeration value="none"> + <xs:annotation> + <xs:documentation> + This is used in situations where the event will actually + be generating the response. If you have an event that + returns a binary download for example, you would use + a response of type=none, so that the control servlet + doesn't try to render anything and send it down to the + client. + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="view"> + <xs:annotation> + <xs:documentation> + Send to a view for final rendering + </xs:documentation> + </xs:annotation> + </xs:enumeration> <xs:enumeration value="view-last"> <xs:annotation> - <xs:documentation>Will use the view from the last request unless there + <xs:documentation> + Will use the view from the last request unless there is a saved from some previous request (using the save-last-view attribute). Use the value attribute to specify a default view - in case no previous view can be retrieved.</xs:documentation> + in case no previous view can be retrieved. + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="view-last-noparam"> + <xs:annotation> + <xs:documentation> + Same than view-last but no parameters are redirect + </xs:documentation> </xs:annotation> </xs:enumeration> - <xs:enumeration value="view-last-noparam"/> <xs:enumeration value="view-home"> <xs:annotation> - <xs:documentation>Will use the view from the last saved 'home' position - (using the save-home-view attribute).</xs:documentation> + <xs:documentation> + Will use the view from the last saved 'home' position + (using the save-home-view attribute). + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="request"> + <xs:annotation> + <xs:documentation> + Internally chains to another request + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="request-redirect"> + <xs:annotation> + <xs:documentation> + Send a redirect down to the browser telling it to go to the new request. + Automatically redirect all current request parameters to the new request. + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="request-redirect-noparam"> + <xs:annotation> + <xs:documentation> + Send a redirect down to the browser telling it to go to the new request. + No current request parameters are sent to the new request. + </xs:documentation> + </xs:annotation> + </xs:enumeration> + <xs:enumeration value="url"> + <xs:annotation> + <xs:documentation> + Any URL, relative or absolute + </xs:documentation> </xs:annotation> </xs:enumeration> - <xs:enumeration value="request"/> - <xs:enumeration value="request-redirect"/> - <xs:enumeration value="request-redirect-noparam"/> - <xs:enumeration value="url"/> </xs:restriction> </xs:simpleType> </xs:attribute> - <xs:attribute name="value" type="xs:string"/> + <xs:attribute name="value" type="xs:string"> + <xs:annotation> + <xs:documentation> + Depending on the type of response, will either + be the view or request name (ie view-map-name or request-map URI). + + Can be an URL. + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="save-last-view" default="false"> <xs:annotation> - <xs:documentation>Saves the last (previous) request's view for future use, generally - with the view-last type of response.</xs:documentation> + <xs:documentation> + Saves the last (previous) request's view for future use, generally + with the view-last type of response. + </xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> @@ -282,8 +549,10 @@ under the License. </xs:attribute> <xs:attribute name="save-current-view" default="false"> <xs:annotation> - <xs:documentation>Saves the current request's view for future use, generally with - the view-last type of response.</xs:documentation> + <xs:documentation> + Saves the current request's view for future use, generally with + the view-last type of response. + </xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> @@ -294,8 +563,10 @@ under the License. </xs:attribute> <xs:attribute name="save-home-view" default="false"> <xs:annotation> - <xs:documentation>Saves the current request's view for future use, generally with - the view-home type of response.</xs:documentation> + <xs:documentation> + Saves the current request's view for future use, generally with + the view-home type of response. + </xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> @@ -307,25 +578,39 @@ under the License. </xs:attributeGroup> <xs:element name="redirect-parameter"> <xs:annotation> - <xs:documentation>Adds a parameter with the given name to the redirect. Finds value in a - request attribute if exists, or a request parameter if no attribute is - found.</xs:documentation> + <xs:documentation> + Adds a parameter with the given name to the redirect. Finds value in a + request attribute if exists, or a request parameter if no attribute is found. + </xs:documentation> </xs:annotation> <xs:complexType> <xs:attributeGroup ref="attlist.redirect-parameter"/> </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.redirect-parameter"> - <xs:attribute type="xs:string" name="name" use="required"/> + <xs:attribute type="xs:string" name="name" use="required"> + <xs:annotation> + <xs:documentation> + Name of the parameter to redirect + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute type="xs:string" name="from" use="optional"> <xs:annotation> - <xs:documentation>If specified used instead of the value of name for the key to find - a request attribute or parameter.</xs:documentation> + <xs:documentation> + If specified used instead of the value of name for the key to find + a request attribute or parameter. + </xs:documentation> </xs:annotation> </xs:attribute> <xs:attribute type="xs:string" name="value" use="optional"/> </xs:attributeGroup> <xs:element name="view-map"> + <xs:annotation> + <xs:documentation> + Place where are defined the elements of a view. + </xs:documentation> + </xs:annotation> <xs:complexType> <xs:sequence> <xs:element minOccurs="0" ref="description"/> @@ -334,22 +619,63 @@ under the License. </xs:complexType> </xs:element> <xs:attributeGroup name="attlist.view-map"> - <xs:attribute type="xs:string" name="name" use="required"/> - <xs:attribute type="xs:string" name="page"/> - <xs:attribute type="xs:string" name="type" default="default"/> - <xs:attribute type="xs:string" name="info"/> - <xs:attribute type="xs:string" name="content-type"/> - <xs:attribute type="xs:string" name="encoding"/> + <xs:attribute type="xs:string" name="name" use="required"> + <xs:annotation> + <xs:documentation> + The name of this view. This will be the name used to access the view. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="page"> + <xs:annotation> + <xs:documentation> + The page mapped to this view. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="type" default="default"> + <xs:annotation> + <xs:documentation> + There are as much as types (of type view) as available defined and accessible event handlers. + Most used is screen, others are notably screenxml, screentext, screencsv, screenfop, ftl, http and birt + A most comprehensive list can be found in the common-controller. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="info"> + <xs:annotation> + <xs:documentation> + Extended information passed to the view handler. + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="content-type"> + <xs:annotation> + <xs:documentation> + Content-type in the HTML sense + </xs:documentation> + </xs:annotation> + </xs:attribute> + <xs:attribute type="xs:string" name="encoding"> + <xs:annotation> + <xs:documentation> + Charset in the HTML sense. By default "text/html" is used. + If the encoding is "none" then no charset will be used. + </xs:documentation> + </xs:annotation> + </xs:attribute> <xs:attribute name="no-cache" default="false"> <xs:annotation> - <xs:documentation>Send no-cache headers if set to true.</xs:documentation> - </xs:annotation> + <xs:documentation> + Send no-cache headers if set to true. + </xs:documentation> + </xs:annotation> <xs:simpleType> <xs:restriction base="xs:token"> <xs:enumeration value="true"/> <xs:enumeration value="false"/> </xs:restriction> </xs:simpleType> - </xs:attribute> + </xs:attribute> </xs:attributeGroup> </xs:schema> |
Free forum by Nabble | Edit this page |