11package io .jooby .internal .mvc ;
22
33import io .jooby .Context ;
4+ import io .jooby .FileUpload ;
45import io .jooby .ProvisioningException ;
56import io .jooby .QueryString ;
67import io .jooby .Reified ;
@@ -33,8 +34,8 @@ class Poc {
3334
3435 @ POST
3536 @ Path (("/body/json" ))
36- public String getIt (@ PathParam Integer p1 ) {
37- return p1 .toString ();
37+ public String getIt (java . nio . file . Path file ) {
38+ return file .toString ();
3839 }
3940
4041 @ GET
@@ -53,22 +54,27 @@ public MvcHandlerImpl(Provider<Poc> provider) {
5354 this .provider = provider ;
5455 }
5556
56- // private double tryParam0(Context ctx, String desc) {
57- // try {
58- // return ctx.path("l").doubleValue();
59- // } catch (ProvisioningException x) {
60- // throw x;
61- // } catch (Exception x) {
62- // throw new ProvisioningException(desc, x);
63- // }
64- // }
65- //
57+ // private double tryParam0(Context ctx, String desc) {
58+ // try {
59+ // return ctx.path("l").doubleValue();
60+ // } catch (ProvisioningException x) {
61+ // throw x;
62+ // } catch (Exception x) {
63+ // throw new ProvisioningException(desc, x);
64+ // }
65+ // }
66+ //
6667 public final Object [] arguments (Context ctx ) {
6768 return null ;
6869 }
6970
7071 @ Nonnull @ Override public Object apply (@ Nonnull Context ctx ) throws Exception {
71- return provider .get ().getIt (ctx .path ("p1" ).to (Integer .class ));
72+ return provider .get ().getIt (ctx .file ("xxx" ).path ());
73+ }
74+
75+ private static java .nio .file .Path path (Context ctx ) {
76+ FileUpload upload = ctx .file ("xxx" );
77+ return upload .path ();
7278 }
7379}
7480
@@ -78,9 +84,9 @@ public class MvcHandlerASM {
7884 public void compare () throws IOException , NoSuchMethodException , ClassNotFoundException {
7985 // Lio/jooby/SneakyThrows$Supplier<Lio/jooby/mvc/NoTopLevelPath;>;
8086 // ASMifier.main(new String[] {"-debug",MvcHandler.class.getName()});
81- //public String mix(@PathParam String s, @PathParam Integer i, @PathParam double d, Context ctx,
87+ //public String mix(@PathParam String s, @PathParam Integer i, @PathParam double d, Context ctx,
8288 // @PathParam long j, @PathParam double f, @PathParam boolean b) {
83- Method handler = Poc .class .getDeclaredMethod ("getIt" , Integer .class );
89+ Method handler = Poc .class .getDeclaredMethod ("getIt" , java . nio . file . Path .class );
8490 Class runtime = MvcCompiler .compileClass (mvc (handler ));
8591
8692 System .out .println ("Loaded: " + runtime );
0 commit comments