Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2013 butor.com Licensed 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.butor.web.servlet;
 
 
 
 

Author(s):
asawan
 
 public class AjaxControllerServlet extends HttpServlet {

 
 	private static final long serialVersionUID = 5144202269971046027L;
 
 	private Logger _logger = LoggerFactory.getLogger(this.getClass());
 
 //	private File _rootFolder = null;
 	private ServletContext _sctx = null;
 	/*
 	 * (non-Javadoc)
 	 * 
 	 * @see
 	 * javax.servlet.http.HttpServlet#service(javax.servlet.http.HttpServletRequest
 	 * , javax.servlet.http.HttpServletResponse)
 	 */
 	protected void service(HttpServletRequest req_HttpServletResponse resp_)
 		// Log args
 			StringBuffer buff = new StringBuffer("Got HTTP parameters : ");
 			Enumeration<Stringattrs = req_.getParameterNames();
 			while (attrs.hasMoreElements()) {
 				String an = attrs.nextElement();
 				buff.append(an);
 				buff.append("=");
 				buff.append(req_.getParameter(an));
 				if (attrs.hasMoreElements()) {
 					buff.append(", ");
 				}
 			}
 
 			buff.append(". RemoteAdr=").append(req_.getRemoteAddr());
 			buff.append(", user-agent=").append(req_.getHeader("user-agent"));
 			buff.append(", uri=").append(req_.getRequestURL())
 					.append(", query-string=").append(req_.getQueryString())
 					.append(", referer=").append(req_.getHeader("referer"));
 		}
 
 		WebApplicationContext wac = WebApplicationContextUtils.
 		
 		String ctxt = req_.getContextPath();
 		String uri = req_.getRequestURI();
 		String path = uri.substring(ctxt.length() +1);//req_.getPathInfo();
 
 		AjaxComponent ajaxComponent = wac.getBean(pathAjaxComponent.class);
 		if (ajaxComponent == null) {
 			return;
 		}
 		ajaxComponent.process(req_resp_);
 	}
 
 	public void init(ServletConfig config_) {
		 = config_.getServletContext();
//		_rootFolder = new File(_sctx.getRealPath("/"));
	}
New to GrepCode? Check out our FAQ X