001
014
015 package com.liferay.portal.action;
016
017 import com.liferay.portal.kernel.util.HttpUtil;
018 import com.liferay.portal.kernel.util.ParamUtil;
019 import com.liferay.portal.kernel.util.Validator;
020 import com.liferay.util.servlet.ServletResponseUtil;
021
022 import javax.servlet.http.HttpServletRequest;
023 import javax.servlet.http.HttpServletResponse;
024
025 import org.apache.struts.action.Action;
026 import org.apache.struts.action.ActionForm;
027 import org.apache.struts.action.ActionForward;
028 import org.apache.struts.action.ActionMapping;
029
030
034 public class RESTProxyAction extends Action {
035
036 public ActionForward execute(
037 ActionMapping mapping, ActionForm form, HttpServletRequest request,
038 HttpServletResponse response)
039 throws Exception {
040
041 String url = ParamUtil.getString(request, "url");
042
043 if (Validator.isNotNull(url)) {
044 String content = HttpUtil.URLtoString(url, true);
045
046 ServletResponseUtil.write(response, content);
047 }
048
049 return null;
050 }
051
052 }