ugo 2003/08/04 14:07:47
Modified: src/java/org/apache/cocoon/components/flow/javascript/fom
FOM_Cocoon.java
Log:
Added missing methods to FOM implementation.
PR: 21925
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.8 +59 -2
cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java
Index: FOM_Cocoon.java
===================================================================
RCS file:
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/flow/javascript/fom/FOM_Cocoon.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- FOM_Cocoon.java 28 Jul 2003 11:07:31 -0000 1.7
+++ FOM_Cocoon.java 4 Aug 2003 21:07:47 -0000 1.8
@@ -51,10 +51,12 @@
package org.apache.cocoon.components.flow.javascript.fom;
import java.io.OutputStream;
+import java.security.Principal;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import org.apache.avalon.framework.component.Component;
@@ -274,7 +276,7 @@
public FOM_Request(Object request) {
this.request = (Request)unwrap(request);
}
-
+
public String getClassName() {
return "FOM_Request";
}
@@ -371,6 +373,10 @@
return request.getRemoteAddr();
}
+ public String jsFunction_getRemoteHost() {
+ return request.getRemoteHost();
+ }
+
public int jsFunction_getServerPort() {
return request.getServerPort();
}
@@ -378,6 +384,51 @@
public String jsFunction_getScheme() {
return request.getScheme();
}
+
+ public String jsFunction_getMethod() {
+ return request.getMethod();
+ }
+
+ public boolean jsFunction_isSecure() {
+ return request.isSecure();
+ }
+
+ public Locale jsFunction_getLocale() {
+ return request.getLocale();
+ }
+
+ public Enumeration jsFunction_getLocales() {
+ return request.getLocales();
+ }
+
+ public FOM_Cookie[] jsFunction_getCookies() {
+ Cookie[] cookies = request.getCookies();
+ FOM_Cookie[] FOM_cookies = new FOM_Cookie[cookies.length];
+ for (int i = 0 ; i < cookies.length ; ++i) {
+ FOM_cookies[i] = new FOM_Cookie(cookies[i]);
+ }
+ return FOM_cookies;
+ }
+
+ public String jsFunction_getHeader(String name) {
+ return request.getHeader(name);
+ }
+
+ public Enumeration jsFunction_getHeaders(String name) {
+ return request.getHeaders(name);
+ }
+
+ public Enumeration jsFunction_getHeaderNames() {
+ return request.getHeaderNames();
+ }
+
+ public Principal jsFunction_getUserPrincipal() {
+ return request.getUserPrincipal();
+ }
+
+ public boolean jsFunction_isUserInRole(String role) {
+ return request.isUserInRole(role);
+ }
}
public static class FOM_Cookie extends ScriptableObject {
@@ -649,6 +700,12 @@
}
return value;
}
+
+ /* TODO: Vote on the inclusion of this method
+ public String jsFunction_getRealPath(String path) {
+ return context.getRealPath(path);
+ }
+ */
}
public static class FOM_Log extends ScriptableObject {