4 changed files with 26 additions and 7 deletions
@ -0,0 +1,21 @@ |
|||||||
|
/* © SRSoftware 2024 */ |
||||||
|
package de.srsoftware.cal; |
||||||
|
|
||||||
|
import static de.srsoftware.tools.Optionals.nullable; |
||||||
|
|
||||||
|
import com.sun.net.httpserver.HttpExchange; |
||||||
|
import de.srsoftware.tools.HttpError; |
||||||
|
import de.srsoftware.tools.PathHandler; |
||||||
|
import java.io.IOException; |
||||||
|
|
||||||
|
public class Forward extends PathHandler { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean doGet(String path, HttpExchange ex) throws IOException { |
||||||
|
var params = queryParam(ex); |
||||||
|
var show = nullable(params.get("show")); |
||||||
|
if (show.isPresent()) return sendRedirect(ex,"/static/event?id="+show.get()); |
||||||
|
LOG.log(System.Logger.Level.WARNING,"Call to {0} with query: {1} – no handler defined",path,params); |
||||||
|
return sendContent(ex, HttpError.of(400,"Unknwon request")); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue