You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
package com.fr.plugin.cluster.req.demo.handler; |
|
|
|
import com.fr.decision.fun.impl.BaseHttpHandler; |
|
import com.fr.json.JSONObject; |
|
import com.fr.plugin.cluster.req.demo.URIConstants; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
|
import com.fr.web.core.cluster.ClusterStatusHelper; |
|
import com.fr.web.utils.WebUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
/** |
|
* |
|
*/ |
|
public class ViewAction extends BaseHttpHandler { |
|
@Override |
|
public RequestMethod getMethod() { |
|
return RequestMethod.GET; |
|
} |
|
|
|
@Override |
|
public String getPath() { |
|
return URIConstants.VIEW; |
|
} |
|
|
|
@Override |
|
public boolean isPublic() { |
|
return true; |
|
} |
|
|
|
@Override |
|
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
JSONObject json = new JSONObject(); |
|
boolean isCluster = ClusterStatusHelper.isClusterEnv(); |
|
json.put("isCluster", isCluster); |
|
if (isCluster) { |
|
String clusterNodeId = ClusterStatusHelper.getCurrentNodeId(); |
|
json.put("clusterId", clusterNodeId); |
|
} |
|
WebUtils.printAsJSON(res, json); |
|
} |
|
} |