juneau-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamesbog...@apache.org
Subject [1/8] incubator-juneau git commit: Doc updates.
Date Mon, 10 Oct 2016 00:28:22 GMT
Repository: incubator-juneau
Updated Branches:
  refs/heads/master 8dde0c9db -> cc399df57


http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
deleted file mode 100644
index 2b250d7..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestAttrVar.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.
 The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance            *
-// * with the License.  You may obtain a copy of the License at                         
                                    *
-// *                                                                                    
                                    *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                        
                                    *
-// *                                                                                    
                                    *
-// * Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the        *
-// * specific language governing permissions and limitations under the License.         
                                    *
-// ***************************************************************************************************************************
-package org.apache.juneau.server.vars;
-
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Request attribute variable resolver.
- * <p>
- * The format for this var is <js>"$A{key}"</js> or <js>"$A{key,defaultValue}"</js>.
- * <p>
- * This variable resolver requires that a {@link RestRequest} object be set as a context
object on the resolver or a
- * 	session object on the resolver session.
- * <p>
- * Values are pulled from the {@link RestRequest#getAttribute(String)} method.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively
resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are
passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class RequestAttrVar extends DefaultingVar {
-
-	/**
-	 * Constructor.
-	 */
-	public RequestAttrVar() {
-		super("A");
-	}
-
-	@Override /* Var */
-	public String resolve(VarResolverSession session, String key) {
-		RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
-		Object o = req.getAttribute(key);
-		return (o == null ? "" : o.toString());
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
deleted file mode 100644
index 34b888f..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestParamVar.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.
 The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance            *
-// * with the License.  You may obtain a copy of the License at                         
                                    *
-// *                                                                                    
                                    *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                        
                                    *
-// *                                                                                    
                                    *
-// * Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the        *
-// * specific language governing permissions and limitations under the License.         
                                    *
-// ***************************************************************************************************************************
-package org.apache.juneau.server.vars;
-
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Request parameter variable resolver.
- * <p>
- * The format for this var is <js>"$P{key}"</js> or <js>"$P{key,defaultValue}"</js>.
- * <p>
- * This variable resolver requires that a {@link RestRequest} object be set as a context
object on the resolver or a
- * 	session object on the resolver session.
- * <p>
- * Values are pulled from the {@link RestRequest#getParameter(String)} method.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively
resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are
passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class RequestParamVar extends DefaultingVar {
-
-	/**
-	 * Constructor.
-	 */
-	public RequestParamVar() {
-		super("P");
-	}
-
-	@Override /* Var */
-	public String resolve(VarResolverSession session, String key) {
-		return session.getSessionObject(RestRequest.class, RequestVar.SESSION_req).getParameter(key);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
index d4c0150..a5e2d0f 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/RequestVar.java
@@ -12,6 +12,7 @@
 // ***************************************************************************************************************************
 package org.apache.juneau.server.vars;
 
+import org.apache.juneau.internal.*;
 import org.apache.juneau.server.*;
 import org.apache.juneau.svl.*;
 
@@ -58,10 +59,25 @@ public class RequestVar extends SimpleVar {
 		super("R");
 	}
 
-	@Override /* Var */
+	@Override /* Parameter */
 	public String resolve(VarResolverSession session, String key) {
 		RestRequest req = session.getSessionObject(RestRequest.class, SESSION_req);
 		if (key.length() > 0) {
+				String k = key.toString();
+				if (k.indexOf('.') != -1) {
+					String prefix = k.substring(0, k.indexOf('.'));
+					String remainder = k.substring(k.indexOf('.')+1);
+					if ("path".equals(prefix))
+						return req.getPathParameter(remainder);
+					if ("query".equals(prefix))
+						return req.getQueryParameter(remainder);
+					if ("formData".equals(prefix))
+						return req.getFormDataParameter(remainder);
+					if ("header".equals(prefix))
+						return req.getHeader(remainder);
+					if ("attribute".equals(prefix))
+						return StringUtils.toString(req.getAttribute(remainder));
+				}
 				char c = key.charAt(0);
 				if (c == 'c') {
 					if (key.equals("contextPath"))
@@ -69,6 +85,8 @@ public class RequestVar extends SimpleVar {
 				} else if (c == 'm') {
 					if (key.equals("method"))
 						return req.getMethod();
+					if (key.equals("methodSummary"))
+						return req.getMethodSummary();
 					if (key.equals("methodDescription"))
 						return req.getMethodDescription();
 				} else if (c == 'p') {
@@ -99,6 +117,7 @@ public class RequestVar extends SimpleVar {
 				Object o = req.getProperties().get(key);
 				if (o != null)
 					return o.toString();
+				return req.getPathParameter(key);
 			}
 		return null;
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
index dd292ed..37f2c26 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestAttrVar.java
@@ -14,7 +14,6 @@ package org.apache.juneau.server.vars;
 
 import java.io.*;
 
-import org.apache.juneau.annotation.*;
 import org.apache.juneau.internal.*;
 import org.apache.juneau.serializer.*;
 import org.apache.juneau.server.*;
@@ -23,16 +22,13 @@ import org.apache.juneau.svl.*;
 /**
  * Serialized request attribute variable resolver.
  * <p>
- * The format for this var is <js>"$SA{contentType,key}"</js> or <js>"$SA{contentType,key,defaultValue}"</js>.
+ * 	The format for this var is <js>"$SA{contentType,key}"</js> or <js>"$SA{contentType,key,defaultValue}"</js>.
  * <p>
- * This variable resolver requires that a {@link RestRequest} object be set as a context
object on the resolver or a
+ * 	This variable resolver requires that a {@link RestRequest} object be set as a context
object on the resolver or a
  * 	session object on the resolver session.
  * <p>
- * Similar to the {@link RequestAttrVar} class except uses the {@link RestRequest#getAttribute(String)}
object
- * 	and passes the value to the {@link Serializer} whose {@link Produces @Produces} annotation
matches the specified content type.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively
resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are
passed to this var.
+ * 	Since this is a {@link SimpleVar}, any variables contained in the result will be recursively
resolved.
+ * 	Likewise, if the arguments contain any variables, those will be resolved before they
are passed to this var.
  *
  * @see org.apache.juneau.svl
  * @author James Bognar (james.bognar@salesforce.com)
@@ -46,16 +42,16 @@ public class SerializedRequestAttrVar extends StreamedVar {
 		super("SA");
 	}
 
-	@Override /* Var */
+	@Override /* Parameter */
 	public void resolveTo(VarResolverSession session, Writer w, String key) {
 		try {
 			int i = key.indexOf(',');
 			if (i == -1)
-				throw new RuntimeException("Invalid format for $SP var.  Must be of the format $SP{contentType,key[,defaultValue]}");
+				throw new RuntimeException("Invalid format for $SA var.  Must be of the format $SA{contentType,key[,defaultValue]}");
 			String[] s2 = StringUtils.split(key, ',');
 			RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
 			if (req != null) {
-				Object o = req.getParameter(key, Object.class);
+				Object o = req.getAttribute(key);
 				if (o == null)
 					o = key;
 				Serializer s = req.getSerializerGroup().getSerializer(s2[0]);

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
b/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
deleted file mode 100644
index 8e86250..0000000
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/SerializedRequestParamVar.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// ***************************************************************************************************************************
-// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements.  See the NOTICE file *
-// * distributed with this work for additional information regarding copyright ownership.
 The ASF licenses this file        *
-// * to you under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance            *
-// * with the License.  You may obtain a copy of the License at                         
                                    *
-// *                                                                                    
                                    *
-// *  http://www.apache.org/licenses/LICENSE-2.0                                        
                                    *
-// *                                                                                    
                                    *
-// * Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an  *
-// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the        *
-// * specific language governing permissions and limitations under the License.         
                                    *
-// ***************************************************************************************************************************
-package org.apache.juneau.server.vars;
-
-import java.io.*;
-
-import org.apache.juneau.annotation.*;
-import org.apache.juneau.internal.*;
-import org.apache.juneau.serializer.*;
-import org.apache.juneau.server.*;
-import org.apache.juneau.svl.*;
-
-/**
- * Serialized request parameter variable resolver.
- * <p>
- * The format for this var is <js>"$SP{contentType,key}"</js> or <js>"$SP{contentType,key,defaultValue}"</js>.
- * <p>
- * This variable resolver requires that a {@link RestRequest} object be set as a context
object on the resolver or a
- * 	session object on the resolver session.
- * <p>
- * Similar to the {@link RequestParamVar} class except uses the {@link RestRequest#getParameter(String)}
object
- * 	and passes the value to the {@link Serializer} whose {@link Produces @Produces} annotation
matches the specified content type.
- * <p>
- * Since this is a {@link SimpleVar}, any variables contained in the result will be recursively
resolved.
- * Likewise, if the arguments contain any variables, those will be resolved before they are
passed to this var.
- *
- * @see org.apache.juneau.svl
- * @author James Bognar (james.bognar@salesforce.com)
- */
-public class SerializedRequestParamVar extends StreamedVar {
-
-	/**
-	 * Constructor.
-	 */
-	public SerializedRequestParamVar() {
-		super("SP");
-	}
-
-	@Override /* Var */
-	public void resolveTo(VarResolverSession session, Writer w, String key) {
-		try {
-			int i = key.indexOf(',');
-			if (i == -1)
-				throw new RuntimeException("Invalid format for $SP var.  Must be of the format $SP{contentType,key[,defaultValue]}");
-			String[] s2 = StringUtils.split(key, ',');
-			RestRequest req = session.getSessionObject(RestRequest.class, RequestVar.SESSION_req);
-			if (req != null) {
-				Object o = req.getParameter(key, Object.class);
-				if (o == null)
-					o = key;
-				Serializer s = req.getSerializerGroup().getSerializer(s2[0]);
-				if (s != null)
-					s.serialize(w, o);
-			}
-		} catch (Exception e) {
-			throw new RuntimeException(e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
b/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
index 66303d0..de092cf 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/ServletInitParamVar.java
@@ -40,7 +40,7 @@ public class ServletInitParamVar extends DefaultingVar {
 		super("I");
 	}
 
-	@Override /* Var */
+	@Override /* Parameter */
 	public String resolve(VarResolverSession session, String key) {
 		return session.getSessionObject(RestRequest.class, RequestVar.SESSION_req).getServlet().getServletConfig().getInitParameter(key);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java b/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
index 6846aca..35ee8b1 100644
--- a/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
+++ b/juneau-server/src/main/java/org/apache/juneau/server/vars/UrlEncodeVar.java
@@ -37,7 +37,7 @@ public class UrlEncodeVar extends SimpleVar {
 		super("UE");
 	}
 
-	@Override /* Var */
+	@Override /* Parameter */
 	public String resolve(VarResolverSession session, String key) {
 		return RestUtils.encode(key);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-juneau/blob/cc399df5/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
----------------------------------------------------------------------
diff --git a/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css b/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
index d01de24..c0c45b7 100755
--- a/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
+++ b/juneau-server/src/main/resources/org/apache/juneau/server/styles/devops.css
@@ -109,8 +109,8 @@ div.data {
 
 div.data td {
 	vertical-align: top;
-	border-bottom:1px solid #E9EACB;
-	border-right:1px solid #E9EACB;
+	border-bottom:1px solid #d9dcde;
+	border-right:1px solid #d9dcde;
 	padding:0.2em 0.5em;
 	color:#26343F;
 	font-size:12px;
@@ -141,11 +141,11 @@ a:hover {
 }
 
 th, .header {
-	border-top:1px solid #CCCC99;
+	border-top:1px solid #d9dcde;
 	padding: 4px 8px;
 	font-weight: bold;
 	text-align:center;
-	background-color: #e9eacb;
+	background-color: rgb(244,246,249);
 	font-family: sans-serif;
 	font-size: 12px;
 	color: #26343f;


Mime
View raw message