Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.wadpam.open.web;
 

Author(s):
os
@RequestMapping(value={"monitor""{domain}/monitor"})
public class MonitorController extends AbstractRestController {
    static final Logger LOG = LoggerFactory.getLogger(MonitorController.class);
    
    static final String PREFIX = "Current IP Address: ";
    
    @RequestMapping(value={"""v10"}, method=.)
    public ResponseEntity<JMonitorgetV10() {
        final JMonitor body = new JMonitor();
        body.setCurrentTimeMillis(System.currentTimeMillis());
        body.setMavenVersion(System.getProperty("maven.application.version""N/A"));
        body.setNamespace(NamespaceManager.get());
        return new ResponseEntity<JMonitor>(body.);
    }
    
    @RequestMapping(value="v11", method=.)
    public ResponseEntity<JMonitorgetV11() {
        final ResponseEntity<JMonitorreturnValue = getV10();
        RestTemplate template = new RestTemplate();
        final ResponseEntity<StringresponseEntity = template.getForEntity("http://dns.loopia.se/checkip/checkip.php"String.class);
        if (..equals(responseEntity.getStatusCode())) {
            String response = responseEntity.getBody();
            if (null != response && -1 < response.lastIndexOf()) {
                int beginIndex = response.lastIndexOf() + .length();
                int endIndex = response.indexOf("</body>"beginIndex);
                final JMonitor body = returnValue.getBody();
                body.setIpAddress(response.substring(beginIndexendIndex));
            }
        }
        return returnValue;
    }
    
New to GrepCode? Check out our FAQ X