001 package railo.commons.net.http.httpclient4; 002 003 import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; 004 005 import railo.commons.lang.ClassUtil; 006 import railo.runtime.exp.ApplicationException; 007 import railo.runtime.exp.PageException; 008 import railo.runtime.op.Caster; 009 010 public class HTTPPatchFactory { 011 012 public static HttpEntityEnclosingRequestBase getHTTPPatch(String url) throws PageException { 013 // try to load the class, perhaps class does not exists with older jars 014 Class clazz = ClassUtil.loadClass( 015 HttpEntityEnclosingRequestBase.class.getClassLoader(), 016 "org.apache.http.client.methods.HttpPatch",null); 017 if(clazz==null) throw new ApplicationException("cannot load class [org.apache.http.client.methods.HttpPatch], you have to update your apache-commons-http*** jars"); 018 try { 019 return (HttpEntityEnclosingRequestBase) ClassUtil.loadInstance(clazz,new Object[]{url}); 020 } 021 catch (Throwable t) { 022 throw Caster.toPageException(t); 023 } 024 025 026 //FUTURE if we have the new jar for sure return new HttpPatch(url); 027 } 028 }