@@ -64,14 +64,14 @@ Run with `Maven`:
6464<dependency >
6565 <groupId >com.hellokaton</groupId >
6666 <artifactId >blade-core</artifactId >
67- <version >2.1.1.BETA </version >
67+ <version >2.1.1.RELEASE </version >
6868</dependency >
6969```
7070
7171or ` Gradle ` :
7272
7373``` sh
74- compile ' com.hellokaton:blade-core:2.1.1.BETA '
74+ compile ' com.hellokaton:blade-core:2.1.1.RELEASE '
7575```
7676
7777Write the ` main ` method and the ` Hello World ` :
@@ -99,6 +99,7 @@ Open http://localhost:9000 in your browser to see your first `Blade` application
9999- [ ** ` Get Cookie ` ** ] ( #get-cookie )
100100- [ ** ` Static Resource ` ** ] ( #static-resource )
101101- [ ** ` Upload File ` ** ] ( #upload-file )
102+ - [ ** ` Download File ` ** ] ( #download-file )
102103- [ ** ` Set Session ` ** ] ( #set-session )
103104- [ ** ` Render To Browser ` ** ] ( #render-to-browser )
104105 - [ ** ` Render Response ` ** ] ( #render-json )
@@ -397,8 +398,36 @@ public void upload(@Multipart FileItem fileItem){
397398}
398399```
399400
401+ ## Download File
402+
403+ ``` java
404+ @GET (value = " /download" , responseType = ResponseType . STREAM )
405+ public void download(Response response) throws IOException {
406+ response. write(" abcd.pdf" , new File (" 146373013842336153820220427172437.pdf" ));
407+ }
408+ ```
409+
410+ ** If you want to preview certain files in your browser**
411+
412+ ``` java
413+ @GET (value = " /preview" , responseType = ResponseType . PREVIEW )
414+ public void preview(Response response) throws IOException {
415+ response. write(new File (" 146373013842336153820220427172437.pdf" ));
416+ }
417+ ```
418+
400419## Set Session
401420
421+ The session is disabled by default, you must enable the session.
422+
423+ ``` java
424+ Blade . create()
425+ .http(HttpOptions :: enableSession)
426+ .start(Application . class, args);
427+ ```
428+
429+ > 💡 It can also be enabled using a configuration file,` http.session.enabled=true `
430+
402431``` java
403432public void login(Session session){
404433 // if login success
@@ -554,7 +583,7 @@ The `hello.html` template
554583</html >
555584```
556585
557- [ Render API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.BETA /com/hellokaton/blade/mvc/http/Response.html#render-com.ModelAndView- )
586+ [ Render API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.RELEASE /com/hellokaton/blade/mvc/http/Response.html#render-com.ModelAndView- )
558587
559588## Redirects
560589
@@ -565,7 +594,7 @@ public void redirectToGithub(RouteContext ctx){
565594}
566595```
567596
568- [ Redirect API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.BETA /com/hellokaton/blade/mvc/http/Response.html#redirect-java.lang.String- )
597+ [ Redirect API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.RELEASE /com/hellokaton/blade/mvc/http/Response.html#redirect-java.lang.String- )
569598
570599## Write Cookie
571600
@@ -577,7 +606,7 @@ public void writeCookie(RouteContext ctx){
577606}
578607```
579608
580- [ Cookie API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.BETA /com/hellokaton/blade/mvc/http/Response.html#cookie-java.lang.String-java.lang.String- )
609+ [ Cookie API] ( http://static.javadoc.io/com.hellokaton/blade-core/2.1.1.RELEASE /com/hellokaton/blade/mvc/http/Response.html#cookie-java.lang.String-java.lang.String- )
581610
582611## Web Hook
583612
0 commit comments