KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > ajax > AjaxHelper


1 /*
2  * Copyright 1999-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.cocoon.ajax;
17
18 import org.apache.cocoon.environment.Request;
19
20 /**
21  * Helper class to handle Ajax requests
22  *
23  * @version $Id: AjaxHelper.java 292158 2005-09-28 10:24:51Z sylvain $
24  * @since 2.1.8
25  */

26 public class AjaxHelper {
27     
28     private AjaxHelper() {
29         // Forbid instanciation
30
}
31
32     /**
33      * The request parameter that, if set, indicates an Ajax request.
34      */

35     public static final String JavaDoc AJAX_REQUEST_PARAMETER = "cocoon-ajax";
36     
37     /**
38      * The namespace URI of the "browser update" xml dialect
39      */

40     public static final String JavaDoc BROWSER_UPDATE_URI = "http://apache.org/cocoon/browser-update/1.0";
41
42     /**
43      * Is the request an Ajax request?
44      *
45      * @param req the request
46      * @return true if this is an Ajax request
47      */

48     public static boolean isAjaxRequest(Request req) {
49         return req.getParameter(AJAX_REQUEST_PARAMETER) != null;
50     }
51
52 }
53
Popular Tags