Resolve the address
Otherwise in some systems a IPv6 was returned and CutyCapt couldn't handle it. FEA: ItEr62S05BugFixing
This commit is contained in:
parent
355f24f276
commit
3fe0a1466f
1 changed files with 13 additions and 2 deletions
|
|
@ -29,6 +29,8 @@ import java.io.FileOutputStream;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
|
|
@ -158,9 +160,9 @@ public class CutyPrint {
|
|||
}));
|
||||
|
||||
// Add capture destination callback URL
|
||||
captureString += " --url=http://" + request.getLocalName() + ":"
|
||||
String hostName = resolveLocalHost(request);
|
||||
captureString += " --url=http://" + hostName + ":"
|
||||
+ request.getLocalPort() + url;
|
||||
|
||||
if (parameters != null) {
|
||||
captureString += "?";
|
||||
for (String key : parameters.keySet()) {
|
||||
|
|
@ -237,6 +239,15 @@ public class CutyPrint {
|
|||
}
|
||||
}
|
||||
|
||||
private static String resolveLocalHost(HttpServletRequest request) {
|
||||
try {
|
||||
InetAddress host = InetAddress.getByName(request.getLocalName());
|
||||
return host.getHostName();
|
||||
} catch (UnknownHostException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static int calculatePlannerWidthForPrintingScreen(Planner planner,
|
||||
int minWidthForTaskNameColumn) {
|
||||
if (planner != null && planner.getTimeTracker() != null) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue