01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.ajax;
18:
19: import org.apache.cocoon.environment.Request;
20:
21: /**
22: * Helper class to handle Ajax requests
23: *
24: * @version $Id: AjaxHelper.java 448479 2006-09-21 07:33:36Z crossley $
25: * @since 2.1.8
26: */
27: public class AjaxHelper {
28:
29: private AjaxHelper() {
30: // Forbid instanciation
31: }
32:
33: /**
34: * The request parameter that, if set, indicates an Ajax request.
35: */
36: public static final String AJAX_REQUEST_PARAMETER = "cocoon-ajax";
37:
38: /**
39: * The namespace URI of the "browser update" xml dialect
40: */
41: public static final String BROWSER_UPDATE_URI = "http://apache.org/cocoon/browser-update/1.0";
42:
43: /**
44: * Is the request an Ajax request?
45: *
46: * @param req the request
47: * @return true if this is an Ajax request
48: */
49: public static boolean isAjaxRequest(Request req) {
50: return req.getParameter(AJAX_REQUEST_PARAMETER) != null;
51: }
52:
53: }
|