improve downloading GPX+KML:
- "Content-Disposition: attachment" header with "filename" - specific mime-types resolves nrenner/brouter-web#6
This commit is contained in:
parent
5fd1e2e734
commit
2528ca67b6
3 changed files with 32 additions and 3 deletions
|
|
@ -26,4 +26,6 @@ public abstract class RequestHandler
|
|||
public abstract String formatTrack(OsmTrack track);
|
||||
|
||||
public abstract String getMimeType();
|
||||
|
||||
public abstract String getFileName();
|
||||
}
|
||||
|
|
@ -133,9 +133,13 @@ public class ServerHandler extends RequestHandler {
|
|||
String format = params.get( "format" );
|
||||
if ( format != null )
|
||||
{
|
||||
if ( "gpx".equals( format ) || "kml".equals( format ) )
|
||||
if ( "gpx".equals( format ) )
|
||||
{
|
||||
result = "text/xml";
|
||||
result = "application/gpx+xml";
|
||||
}
|
||||
else if ( "kml".equals( format ) )
|
||||
{
|
||||
result = "application/vnd.google-earth.kml+xml";
|
||||
}
|
||||
else if ( "csv".equals( format ) )
|
||||
{
|
||||
|
|
@ -146,6 +150,20 @@ public class ServerHandler extends RequestHandler {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName()
|
||||
{
|
||||
String fileName = null;
|
||||
String format = params.get( "format" );
|
||||
|
||||
if ( format != null )
|
||||
{
|
||||
fileName = "brouter." + format;
|
||||
}
|
||||
|
||||
return fileName;
|
||||
}
|
||||
|
||||
private static OsmNodeNamed readPosition( String vlon, String vlat, String name )
|
||||
{
|
||||
if ( vlon == null ) throw new IllegalArgumentException( "lon " + name + " not found in input" );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue