use of com.opensymphony.xwork2.ActionContext in project bamboobsc by billchen198318.
the class ActionInfoSupportInterceptor method intercept.
@Override
public String intercept(ActionInvocation actionInvocation) throws Exception {
/*
ActionInvocation ai=(ActionInvocation)ActionContext.getContext().get(ActionContext.ACTION_INVOCATION);
String action=ai.getProxy().getActionName();
String namespace=ai.getProxy().getNamespace();
*/
HttpServletRequest request = ServletActionContext.getRequest();
ActionContext context = actionInvocation.getInvocationContext();
String action = actionInvocation.getProxy().getActionName();
String namespace = actionInvocation.getProxy().getNamespace();
String remoteAddr = request.getRemoteAddr();
String referer = request.getHeader("referer");
context.getSession().put(Constants.SESS_PAGE_INFO_ACTION_ByInterceptor, action);
context.getSession().put(Constants.SESS_PAGE_INFO_NAMESPACE_ByInterceptor, namespace);
context.getSession().put(Constants.SESS_PAGE_INFO_RemoteAddr_ByInterceptor, remoteAddr);
context.getSession().put(Constants.SESS_PAGE_INFO_Referer_ByInterceptor, referer);
return actionInvocation.invoke();
}
use of com.opensymphony.xwork2.ActionContext in project bamboobsc by billchen198318.
the class JsonOutermostBracketsInterceptor method intercept.
@Override
public String intercept(ActionInvocation actionInvocation) throws Exception {
ActionContext context = actionInvocation.getInvocationContext();
HttpServletResponse response = (HttpServletResponse) context.get(StrutsStatics.HTTP_RESPONSE);
response.setCharacterEncoding("utf8");
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer.print("[");
writer.flush();
String forward = actionInvocation.invoke();
writer.print("]");
writer.flush();
return forward;
}
Aggregations