Browse Source

添加日志文件的配置,打印出所有错误信息到后台日志文件。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
41fd0f28ea

+ 3 - 4
jfwAptWeb/src/main/java/org/jfw/apt/web/AptWebHandler.java

@ -35,6 +35,7 @@ import org.jfw.apt.web.handlers.SetSessionHandler;
35 35
import org.jfw.apt.web.handlers.ValidateParamHandler;
36 36
import org.jfw.apt.web.handlers.ViewHandler;
37 37
38
38 39
public class AptWebHandler extends CodeGenHandler {
39 40
40 41
	private static List<Class<? extends RequestHandler>> supportedClass = new ArrayList<Class<? extends RequestHandler>>();
@ -199,6 +200,8 @@ public class AptWebHandler extends CodeGenHandler {
199 200
200 201
	@Override
201 202
	public void proccess() throws AptException {
203
		this.out.bL("private static final  org.apache.log4j.Logger log = org.apache.log4j.Logger.getLogger(");
204
		this.out.w(this.out.getClassname()).el(".class);");
202 205
		this.genInstanceVariable();
203 206
		this.url = genUrl(this.url, ref);
204 207
		this.codes.clear();
@ -207,7 +210,6 @@ public class AptWebHandler extends CodeGenHandler {
207 210
		List<? extends Element> eles = ref.getEnclosedElements();
208 211
		for (Element ele : eles) {
209 212
			if (ele.getKind() == ElementKind.METHOD) {
210
211 213
				Path methodPath = ele.getAnnotation(Path.class);
212 214
				if (methodPath != null) {
213 215
					this.genRequestInfo(ele, methodPath.value());
@ -216,12 +218,10 @@ public class AptWebHandler extends CodeGenHandler {
216 218
					this.params = this.me.getParams();
217 219
					this.genCurrentMethodName();
218 220
					this.cleanConfig();
219
220 221
					this.beginMethod();
221 222
					this.writeMethodContent();
222 223
					this.endMethod();
223 224
				}
224
225 225
			}
226 226
		}
227 227
@ -229,7 +229,6 @@ public class AptWebHandler extends CodeGenHandler {
229 229
			cpg.generate(this.out);
230 230
		}
231 231
		out.overClass();
232
233 232
		ClassBeanDefine cbd = this.jfwProccess.getBeanConfig()
234 233
				.addServiceBeanByClass(this.ref.getQualifiedName().toString(), null);
235 234
		Util.buildAtuowrieProperty(cbd, this.ref);

+ 1 - 2
jfwAptWeb/src/main/java/org/jfw/apt/web/handlers/buildParam/SessionValHandler.java

@ -39,13 +39,12 @@ public final class SessionValHandler implements BuildParameter {
39 39
		} else {
40 40
			cw.bL(mpe.getTypeName()).w(" ").w(mpe.getName()).w(" = (").w(mpe.getTypeName())
41 41
					.w(")session.getAttribute(\"").w(val).el("\");");
42
42
                
43 43
				cw.bL("if(null==").w(mpe.getName()).el("){");
44 44
				if(dv==null &&(null == mpe.getRef().getAnnotation(Nullable.class))){
45 45
					cw.l("throw new IllegalArgumentException(\"not found session value:" + val + "\");");
46 46
				}else{
47 47
					cw.bL(mpe.getName()).w(" = ").w(dv).el(";");
48
			
49 48
				}
50 49
				cw.l("}");
51 50
			}

+ 2 - 0
jfwAptWeb/src/main/java/org/jfw/apt/web/handlers/viewImpl/ViewUtil.java

@ -8,6 +8,8 @@ public abstract class ViewUtil {
8 8
		//e:Exception
9 9
		//res:HttpServletResponse
10 10
		//out: jsp.out
11
		
12
		cw.l("log.error(e);");
11 13
		cw.l("org.jfw.util.json.JsonService.write(e,out);");		
12 14
	}
13 15
	public static void printJSONWithValue(AptWebHandler aptWebHandler, ClassWriter cw){

+ 1 - 1
jfwUtil/src/main/java/org/jfw/util/bean/define/FixedValueDefine.java

@ -26,7 +26,7 @@ public class FixedValueDefine extends ValueDefine{
26 26
		} else if(this.clazz.equals(Float.class)||this.clazz.equals(float.class)){
27 27
			this.value = Float.valueOf(val.trim());
28 28
		} else if(this.clazz.equals(Double.class)||this.clazz.equals(double.class)){
29
			this.value = Double.class;
29
			this.value = Double.valueOf(val.trim());
30 30
		} else if(this.clazz.equals(Boolean.class)||this.clazz.equals(boolean.class)){
31 31
			this.value = Boolean.valueOf(val.trim());
32 32
		} else if(this.clazz.equals(Character.class)||this.clazz.equals(char.class)){