Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve document formattings using source-listing, making list and tables #1523

Merged
merged 69 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
8768121
Remove chapter number from Preface
kasabuta4 Jul 21, 2020
9839120
Add JCP JSR-372 spec leads to Acknowledgements
kasabuta4 Jul 21, 2020
14373c4
Improve formattings of Overview and RequestProcessingLifeCycle
kasabuta4 Jul 22, 2020
cfb28bd
Improve formattings of UserInterfaceComponentModel : source listing
kasabuta4 Jul 23, 2020
e84598c
Improve formattings of UserInterfaceComponentModel : tables
kasabuta4 Jul 23, 2020
14d7c84
Improve formattings of UserInterfaceComponentModel : making lists
kasabuta4 Jul 23, 2020
c0d421d
Improve formattings of UserInterfaceComponentModel : description lists
kasabuta4 Jul 23, 2020
1a38ddb
Improve formattings of UserInterfaceComponentModel : de-dup See
kasabuta4 Jul 23, 2020
d8aea2f
Improve formattings of UserInterfaceComponentModel : emphasis
kasabuta4 Jul 23, 2020
e7ff25b
Improve formattings of UserInterfaceComponentModel : error correction
kasabuta4 Jul 23, 2020
3e5cf9b
Improve formattings of UserInterfaceComponentModel : de-dup See 2
kasabuta4 Jul 23, 2020
a086798
Improve formattings of StandardUserInterfaceComponents : source listing
kasabuta4 Jul 23, 2020
93aca36
Improve formattings of StandardUserInterfaceComponents : tables
kasabuta4 Jul 23, 2020
9ad1a9c
Improve formattings of StandardUserInterfaceComponents : making lists
kasabuta4 Jul 23, 2020
18c55ae
Improve formattings of StandardUserInterfaceComponents : de-dup See
kasabuta4 Jul 23, 2020
e5ecb39
Improve formattings of StandardUserInterfaceComponents : emphasis
kasabuta4 Jul 23, 2020
8c58c36
Improve formattings of StandardUserInterfaceComponents : error correc…
kasabuta4 Jul 23, 2020
5917496
Improve formattings of ExpressionLanguage... : source listing
kasabuta4 Jul 24, 2020
9f176cf
Improve formattings of ExpressionLanguage... : tables
kasabuta4 Jul 24, 2020
480eba5
Improve formattings of ExpressionLanguage... : making lists
kasabuta4 Jul 24, 2020
a40100b
Improve formattings of ExpressionLanguage... : de-dup See
kasabuta4 Jul 24, 2020
906c1c2
Improve formattings of ExpressionLanguage... : emphasis
kasabuta4 Jul 24, 2020
c0f38e5
Improve formattings of Per-RequestStateInfo... : source listing
kasabuta4 Jul 24, 2020
3644ed7
Improve formattings of Per-RequestStateInfo... : tables
kasabuta4 Jul 24, 2020
c8d55e9
Improve formattings of Per-RequestStateInfo... : making lists
kasabuta4 Jul 24, 2020
f6df8a0
Improve formattings of Per-RequestStateInfo... : de-dup See
kasabuta4 Jul 24, 2020
e4425e9
Improve formattings of Per-RequestStateInfo... : emphasis
kasabuta4 Jul 24, 2020
f524c90
Improve formattings of Application Integration : source listing
kasabuta4 Jul 25, 2020
58f8f2a
Improve formattings of Application Integration : making lists
kasabuta4 Jul 25, 2020
6a0df33
Improve formattings of Application Integration : de-dup See
kasabuta4 Jul 25, 2020
b00d409
Improve formattings of Application Integration : emphasis
kasabuta4 Jul 25, 2020
d3fba29
Improve formattings of Rendering Model : source listing
kasabuta4 Jul 25, 2020
e155d90
Improve formattings of Rendering Model : tables
kasabuta4 Jul 25, 2020
52e678d
Improve formattings of Rendering Model : de-dup See
kasabuta4 Jul 25, 2020
b50473b
Improve formattings of Rendering Model : emphasis
kasabuta4 Jul 25, 2020
c860613
Improve formattings of Integration With JSP : source listing
kasabuta4 Jul 25, 2020
9a36fbc
Improve formattings of Integration With JSP : tables
kasabuta4 Jul 25, 2020
6bb8153
Improve formattings of Integration With JSP : making lists
kasabuta4 Jul 25, 2020
ff38534
Improve formattings of Integration With JSP : de-dup See
kasabuta4 Jul 25, 2020
89ee2c9
Improve formattings of Integration With JSP : emphasis
kasabuta4 Jul 25, 2020
7c3f100
Improve formattings of Integration With JSP : tag syntax
kasabuta4 Jul 25, 2020
16920bd
Improve formattings of Facelets And WebApp : source listing
kasabuta4 Jul 25, 2020
39d3c56
Improve formattings of Facelets And WebApp : tables
kasabuta4 Jul 25, 2020
2c637c0
Improve formattings of Facelets And WebApp : making lists
kasabuta4 Jul 25, 2020
ab643ff
Improve formattings of Facelets And WebApp : de-dup See
kasabuta4 Jul 25, 2020
3c1875d
Improve formattings of Facelets And WebApp : emphasis
kasabuta4 Jul 25, 2020
3e3e9c1
Improve formattings of Facelets And WebApp : tag syntax
kasabuta4 Jul 26, 2020
f440fdb
Improve formattings of Using JSF In WebApp : source listing
kasabuta4 Jul 26, 2020
412556e
Improve formattings of Using JSF In WebApp : making lists
kasabuta4 Jul 26, 2020
ad52a88
Improve formattings of Using JSF In WebApp : de-dup See
kasabuta4 Jul 26, 2020
a7d7d7c
Improve formattings of Using JSF In WebApp : emphasis
kasabuta4 Jul 26, 2020
4c7ff24
Improve formattings of Using JSF In WebApp : error correction
kasabuta4 Jul 26, 2020
fdcc6c9
Improve formattings of Lifecycle Management : source listing
kasabuta4 Jul 26, 2020
599e4b3
Improve formattings of Lifecycle Management : making lists
kasabuta4 Jul 26, 2020
b14d5cc
Improve formattings of Lifecycle Management : emphasis
kasabuta4 Jul 26, 2020
5a56222
Improve formattings of Ajax Integration : source listing
kasabuta4 Jul 26, 2020
dff0616
Improve formattings of Ajax Integration : making lists
kasabuta4 Jul 26, 2020
03f3cfa
Improve formattings of Ajax Integration : de-dup See
kasabuta4 Jul 26, 2020
97a1522
Improve formattings of Ajax Integration : emphasis
kasabuta4 Jul 26, 2020
d2e390e
Improve formattings of JavaScript API : source listing
kasabuta4 Jul 26, 2020
2d9dd13
Improve formattings of JavaScript API : tables
kasabuta4 Jul 26, 2020
e10001d
Improve formattings of JavaScript API : making lists
kasabuta4 Jul 26, 2020
cd282ff
Improve formattings of JSF Metadata
kasabuta4 Jul 26, 2020
398f27c
Improve formattings of Change Log : section correction
kasabuta4 Jul 27, 2020
b75e3ce
Improve formattings of Change Log : source listing
kasabuta4 Jul 27, 2020
5d65a3d
Improve formattings of Change Log : tables
kasabuta4 Jul 27, 2020
360017d
Improve formattings of Change Log : making lists
kasabuta4 Jul 28, 2020
b72c93f
Inprove formattings
kasabuta4 Jul 28, 2020
8ce2151
Resolve some build warnings
kasabuta4 Jul 28, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
220 changes: 75 additions & 145 deletions spec/src/main/asciidoc/AjaxIntegration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ constant
_jakarta.faces.application.ResourceHandler.JSF_SCRIPT_RESOURCE_NAME_ and
it must exist under the resource library given by the value of the
constant
_jakarta.faces.application.ResourceHandler.JSF_SCRIPT_LIBRARY_NAME,_
_jakarta.faces.application.ResourceHandler.JSF_SCRIPT_LIBRARY_NAME_,
following the conventions in _<<a746, Resource
Handling>>._ This resource contains the JavaScript APIs that facilitate
Handling>>_. This resource contains the JavaScript APIs that facilitate
Ajax interaction with Jakarta Server Faces.

[[a6704]]
Expand All @@ -39,15 +39,11 @@ Component authors can specify that a custom
component or renderer requires the Ajax resource with the use of the
ResourceDependency annotation.

[width="100%",cols="100%",]
|===
a|
@ResourceDependency (name="jsf.js",
library="jakarta.faces", target="head")

[source,java]
----
@ResourceDependency (name="jsf.js", library="jakarta.faces", target="head")
public class MyComponent extends UIOutput...

|===
----

For more information on this approach refer
to <<a847, Relocatable Resources>> and
Expand All @@ -61,78 +57,47 @@ custom component or renderer requires the JavaScript resource by using
the resource APIs. For example, a component or renderer’s encode method
may contain:

[width="100%",cols="100%",]
|===
a|
Resource resource =
context.getApplication().getResourceHandler()

.createResource(“jsf.js”, “jakarta.faces”);

[source,java]
----
Resource resource = context.getApplication().getResourceHandler()
.createResource(“jsf.js”, “jakarta.faces”);
...

writer.startElement("script", component);

writer.writeAttribute("type",
"text/javascript", "type");

writer.writeAttribute("src",((resource !=
null)? resource.getRequestPath(): "RES_NOT_FOUND"),”src”);

writer.writeAttribute("type", "text/javascript", "type");
writer.writeAttribute("src",
((resource != null)? resource.getRequestPath(): "RES_NOT_FOUND"), ”src”);
writer.endElement(“script”);

|===
----

Script resources are relocatable resources
(see <<a847, Relocatable
Resources>>) which means you can control the rendering location for these
resources by setting the “target” attribute on the resource component:

[width="100%",cols="100%",]
|===
a|
public class MyComponent extends UIOutput \{

[source,java]
----
public class MyComponent extends UIOutput {
...

getAttributes().put(“target”, “head”);

getAttributes().put(“target”, “head”);
...

}

|===
----

This attribute must be set before the
component is added to the view. The component or renderer must also
implement the event processing method:

[width="100%",cols="100%",]
|===
a|
[source,java]
----
public void processEvent(SystemEvent event)
throws AbortProcessingException \{

UIComponent component = (UIComponent)
event.getSource();

FacesContext context =
FacesContext.getCurrentInstance();

if (component.getAttributes().get("target")
!= null) \{

context.getViewRoot().addComponentResource(context,

component);

}

throws AbortProcessingException {
UIComponent component = (UIComponent) event.getSource();
FacesContext context = FacesContext.getCurrentInstance();
if (component.getAttributes().get("target") != null) {
context.getViewRoot().addComponentResource(context, component);
}
}



|===
----

When the component is added to the view, an
event will be published. This event handling method will add the
Expand All @@ -145,37 +110,20 @@ root so it will be in place before rendering.
Page authors can make the Ajax resource
available to the current view using the outputScript tag. For example:

[width="100%",cols="100%",]
|===
a|
[source,xml]
----
<f:view contentType=”text/html”/>

<h:head>

<meta...

<title...

</h:head>

<h:body>

...

<h:outputScript name=”jsf.js”
library=”jakarta.faces”

target=”body”/>

...

</h:body>

...



|===
<h:head>
<meta...
<title...
</h:head>
<h:body>
...
<h:outputScript name=”jsf.js” library=”jakarta.faces” target=”body”/>
...
</h:body>
...
----

[[a6754]]
=== JavaScript Namespacing
Expand All @@ -192,26 +140,15 @@ API must define a top level JavaScript object name jsf, whose type is a
JavaScript associative array. Within that top level JavaScript object,
there must be a property named ajax..

[width="100%",cols="100%",]
|===
a|
if (jsf == null || typeof jsf == "undefined")
\{

var jsf = new Object();

[source,javascript]
----
if (jsf == null || typeof jsf == "undefined") {
var jsf = new Object();
}

if (jsf.ajax == null || typeof jsf.ajax ==
"undefined") \{

jsf["ajax"] = new Object();

if (jsf.ajax == null || typeof jsf.ajax == "undefined") {
jsf["ajax"] = new Object();
}



|===
----

{empty}[P1-end]

Expand Down Expand Up @@ -263,27 +200,27 @@ The Ajax request callback function is called
when the Ajax request/response interaction is complete.
[P1-start-callback]This function must perform the following actions:

If the return status is >= 200 and < 300,
* If the return status is >= 200 and < 300,
send a “complete” event following
<<a6792, Sending Events>>. Call
jsf.ajax.response passing the Ajax request object (for example the
XMLHttpRequest instance) and the request context (containing the source
DOM element, onevent event function callback and onerror error function
callback).

If the return status is outside the range
* If the return status is outside the range
mentioned above, send a “complete” event following
<<a6792, Sending Events>>. Send an
“httpError” error following <<a6806, Signaling Errors>>.

Regardless of whether the request completed
* Regardless of whether the request completed
successfully or not:

remove the completed requests (Ajax
** remove the completed requests (Ajax
readystate 4) from the request queue (dequeue) - specifically the
requests that have been on the queue the longest.

{empty}find the next oldest unprocessed (Ajax
** {empty}find the next oldest unprocessed (Ajax
readystate 0) request on the queue, and send it. The implementation must
ensure that the request that is sent does not enter the queue
again.[P1-end]
Expand Down Expand Up @@ -319,10 +256,10 @@ functions can also be set up to monitor all Ajax requests.
There are two ways to monitor events for a
single Ajax request by registering an event callback function:

By using the <f:ajax> tag with the onevent
* By using the <f:ajax> tag with the onevent
attribute.

By using the JavaScript API function
* By using the JavaScript API function
jsf.ajax.request with onevent as an option.

{empty}Refer to
Expand Down Expand Up @@ -356,17 +293,17 @@ must be called in accordance with the events outlined in
[P1-start-event-send]The implementation must
send events to the runtime as follows:

Construct a data payload for events using the
* Construct a data payload for events using the
properties described in <<a6947,
Event Data Payload>>.

If an event handler function was registered
* If an event handler function was registered
with the “onevent” attribute
(<<a6785,
Monitoring Events For An Ajax Request>>) call it passing the data
payload.

{empty}If any event handling functions were
* {empty}If any event handling functions were
registered with the “addOnEvent” function
(<<a6790,
Monitoring Events For All Ajax Requests>>) call them passing the data
Expand All @@ -387,10 +324,10 @@ functions can be setup to handle errors for all Ajax requests.
There are two ways to handle errors for a
single Ajax request by registering an error callback function:

By using the <f:ajax> tag with the onerror
* By using the <f:ajax> tag with the onerror
attribute.

By using the JavaScript API function
* By using the JavaScript API function
jsf.ajax.request with onerror as an option.

{empty}Refer to
Expand All @@ -410,7 +347,7 @@ outlined in <<a6976, Errors>>.[P1-end]
jsf.ajax.addOnError function that can be used to register a JavaScript
function that will be notified when an error occurs for any Ajax
request/response. Refer to
<<a6931, See Registering
<<a6931, Registering
Callback Functions>> for more details. The jsf.ajax.addOnError function
accepts a JavaScript function argument that will be notified when errors
occur during any Ajax request/response cycle. [P1-start-event] The
Expand All @@ -424,22 +361,22 @@ must be called in accordance with the errors outlined in
[P1-start-error-signal]The implementation
must signal errors to the runtime as follows:

Construct a data payload for errors using the
* Construct a data payload for errors using the
properties described in <<a6988,
Error Data Payload>>.

If an error handler function was registered
* If an error handler function was registered
with the “onerror” attribute
(<<a6799,
Handling Errors For An Ajax Request>>) call it passing the data payload.

If any error handling functions were
* If any error handling functions were
registered with the “addOnError” function
(<<a6804,
Handling Errors For All Ajax Requests>>) call them passing the data
payload.

{empty}If the project stage is “development”
* {empty}If the project stage is “development”
(see
<<a7017,
Determining An Application’s Project Stage>>) use JavaScript “alert” to
Expand All @@ -453,27 +390,20 @@ server as outlined in <<a3253, ExceptionHandler>>.
[P1-start-error-server]Jakarta Server Faces Ajax frameworks must ensure
exception information is written to the response in the format:

[width="100%",cols="100%",]
|===
a|
[source,xml]
----
<partial-response id="j_id1">

<error>

<error-name>...</error-name>

<error-message>...</error-message>

</error>

<error>
<error-name>...</error-name>
<error-message>...</error-message>
</error>
</partial-response>
----

|===

Extract the “class” from the “Throwable”
* Extract the “class” from the “Throwable”
object and write that as the contents of error-name in the response.

Extract the “cause” from the “Throwable”
* Extract the “cause” from the “Throwable”
object if it is available and write that as the contents of
error-message in the response. If “cause” is not available, write the
string returned from “Throwable.getMessage()”.
Expand Down Expand Up @@ -618,7 +548,7 @@ sent back to the client, it must contain the view state.
[P1-start-sending-response]Implementations must adhere to the response
format as specified in the JavaScript docs for
jsf.ajax.response.[P1-end] Refer to the XML schema definition in the
<<a7162,See XML Schema Definition for Composite
<<a7162,XML Schema Definition for Composite
Components>> section. This XML schema is another important area for
component library compatability.

Expand Down
Loading