diff --git a/flyfish-common/src/main/java/com/flyfish/framework/compiler/core/MemoryJavaFileManager.java b/flyfish-common/src/main/java/com/flyfish/framework/compiler/core/MemoryJavaFileManager.java index 60887dd..bf6bab4 100644 --- a/flyfish-common/src/main/java/com/flyfish/framework/compiler/core/MemoryJavaFileManager.java +++ b/flyfish-common/src/main/java/com/flyfish/framework/compiler/core/MemoryJavaFileManager.java @@ -9,6 +9,7 @@ import java.net.URI; import java.nio.CharBuffer; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; /** * In-memory java file manager. @@ -18,7 +19,7 @@ import java.util.Map; class MemoryJavaFileManager extends ForwardingJavaFileManager { // compiled classes in bytes: - final Map classBytes = new HashMap<>(); + final Map classBytes = new ConcurrentHashMap<>(); MemoryJavaFileManager(JavaFileManager fileManager) { super(fileManager); diff --git a/flyfish-user/src/main/java/com/flyfish/framework/config/WebSecurityConfig.java b/flyfish-user/src/main/java/com/flyfish/framework/config/WebSecurityConfig.java index aa0aa0f..45265fe 100644 --- a/flyfish-user/src/main/java/com/flyfish/framework/config/WebSecurityConfig.java +++ b/flyfish-user/src/main/java/com/flyfish/framework/config/WebSecurityConfig.java @@ -2,11 +2,13 @@ package com.flyfish.framework.config; import com.flyfish.framework.config.properties.JwtProperties; import com.flyfish.framework.config.properties.SecurityProperties; +import com.flyfish.framework.configuration.jwt.JwtSecurityContextRepository; import com.flyfish.framework.configuration.jwt.TokenProvider; import com.flyfish.framework.handler.JsonAuthenticationFailureHandler; import com.flyfish.framework.handler.JsonAuthenticationSuccessHandler; import com.flyfish.framework.handler.JsonLogoutSuccessHandler; import com.flyfish.framework.transform.ResultDataTransformer; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.core.annotation.Order; @@ -46,6 +48,14 @@ public class WebSecurityConfig { return delegatingPasswordEncoder; } + + @ConditionalOnProperty(value = "jwt.enable", havingValue = "true") + @Bean("contextRepository") + public JwtSecurityContextRepository jwtSecurityContextRepository() { + return new JwtSecurityContextRepository(); + } + + @ConditionalOnProperty(value = "jwt.enable", havingValue = "false") @Bean public ServerSecurityContextRepository contextRepository() { return new WebSessionServerSecurityContextRepository(); @@ -53,7 +63,9 @@ public class WebSecurityConfig { @Bean public TokenProvider tokenProvider(JwtProperties properties) { - return new TokenProvider(properties.getBase64Secret(), properties.getTokenValidityInSeconds(), + return new TokenProvider( + properties.getBase64Secret(), + properties.getTokenValidityInSeconds(), properties.getTokenValidityInSecondsForRememberMe()); } diff --git a/flyfish-user/src/main/java/com/flyfish/framework/config/properties/JwtProperties.java b/flyfish-user/src/main/java/com/flyfish/framework/config/properties/JwtProperties.java index 412e069..4ad2d14 100644 --- a/flyfish-user/src/main/java/com/flyfish/framework/config/properties/JwtProperties.java +++ b/flyfish-user/src/main/java/com/flyfish/framework/config/properties/JwtProperties.java @@ -14,6 +14,9 @@ import java.util.Map; @Data public class JwtProperties { + // 是否启用 + private boolean enable = false; + // 头部 private String header = "Authorization"; // This token must be encoded using Base64 with mininum 88 Bits (you can type `echo 'secret-key'|base64` on your command line) private String base64Secret = "ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI="; diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/Info.plist b/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/Info.plist deleted file mode 100755 index 740a0d3..0000000 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/Info.plist +++ /dev/null @@ -1,620 +0,0 @@ - - - - - BuildMachineOSBuild - 19H15 - CFBundleExecutable - VoodooPS2Keyboard - CFBundleGetInfoString - 2.2.0, Copyright Apple Computer, Inc. 2000-2003, RehabMan 2012-2013 - CFBundleIdentifier - as.acidanthera.voodoo.driver.PS2Keyboard - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Voodoo PS/2 Keyboard - CFBundlePackageType - KEXT - CFBundleShortVersionString - 2.2.0 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 2.2.0 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 12B45b - DTPlatformName - macosx - DTPlatformVersion - 11.0 - DTSDKBuild - 20A2408 - DTSDKName - macosx11.0 - DTXcode - 1220 - DTXcodeBuild - 12B45b - IOKitPersonalities - - ApplePS2Keyboard - - CFBundleIdentifier - as.acidanthera.voodoo.driver.PS2Keyboard - IOClass - ApplePS2Keyboard - IOProviderClass - ApplePS2KeyboardDevice - Platform Profile - - DELL - - Dell-Keys - - Breakless PS2 - - e005 - e006 - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e020=3b - e02e=3c - e030=3d - e022=3e - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - e005=57 - e006=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e020 - 3c=e02e - 3d=e030 - 3e=e022 - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - 57=e005 - 58=e006 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e020=e020 - e02e=e02e - e030=e030 - e022=e022 - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - e005=e005 - e006=e006 - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - - HSW-LPT - Dell-Keys - SNB-CPT - - ActionSwipeDown - 63 d, 63 u - ActionSwipeUp - 61 d, 61 u - Breakless PS2 - - e01e;Touchpad Fn+f3 is breakless - e06e;REVIEW: temporary for case that macro inversion does not work... - - Custom ADB Map - - e009=83;Dell Support to Launchpad - e0f1=71;Call brightens up w RKA1 for special mode (was =90) - e0f2=6b;Call brightens down w RKA2 for special mode (was =91) - e06e=70;Map vidmirror key for special mode default is adb90 - - Custom PS2 Map - - e01e=e037;Map tp disable to Fn+f3 - e037=e01e;Prevent PrntScr from triggering tp disable - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e06e=3b - e008=3c - e01e=3d - e005=3e - e006=3f - e00c=40 - ;Fn+f7 no dedicated macro - e010=42 - e022=43 - e019=44 - e02e=57 - e030=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e06e;Map vidmirror key to f1 - 3c=e0f0;Map radio toggle action from EC query to f2 - 3d=e037;Map touchpad toggle button to f3 - 3e=e0f2;Map acpi RKA2 to f4 brightness down - 3f=e0f1;Map acpi RKA1 to f5 brightness up - 40=e0f3;Map acpi RKA3 to f6 keyboard backlight - ;Fn+f7 no macro - 42=e010 - 43=e022 - 44=e019 - 57=e02e - 58=e030 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e06e=e06e;Fn+f1 macro translated - e008=e008;Fn+f2 regular scancode and EC query call q8c - e01e=e037;Fn+f3 regular scancode and EC controls LED - e005=e005;Fn+f4 no ps2scancode and EC query call q81 - e006=e006;Fn+f5 no ps2scancode and EC query call q80 - e00c=e00c;Fn+f6 no ps2scancode and EC query call q8a - ;Fn+f7 no macro just regular f key - e010=e010; Fn+f8 regular scancode - e022=e022; Fn+f9 regular scancode - e019=e019;Fn+f10 regular scancode - e02e=e02e;Fn+f11 regular scancode - e030=e030;Fn+f12 regular scancode - ;Fn+f13 is mute dedicated button that always produces e020 regardless of Fn - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - Macro Inversion - - ;This section maps ps2 codes (packet format) received quickly (macros) into fake ps2 codes (packet format) - ;Fn+F1 - - //8CbgAAAAACWwEZ - - - //8C7gAAAAAC2wGZ - - - //8C7gAAAAABmQLb - - - MaximumMacroTime - 35000000 - Note-Author - TimeWalker aka TimeWalker75a - Note-Comment - Keyboard Profile for DELL SandyBridge SecureCore Tiano based laptops (Vostro 3450 & 3750, Inspiron N4110, XPS L502x & L702x & L511z) - - WN09 - - Breakless PS2 - - e01b - e008 - e01e - e005 - e06e - e006 - - Custom ADB Map - - e01b=70 - e06e=83 - - Custom PS2 Map - - 56=2b - 29=56 - 2b=29 - e01e=e037 - e037=e01e - - - WN09a - - Breakless PS2 - - e01b - e008 - e01e - e005 - e06e - e006 - - Custom ADB Map - - e01b=70 - e06e=83 - - Custom PS2 Map - - e01e=e037 - e037=e01e - - - - Default - - Breakless PS2 - - ;Items must be strings in the form of breaklessscan (in hex) - - Custom ADB Map - - ;Items must be strings in the form of scanfrom=adbto (in hex) - - Custom PS2 Map - - ;Items must be strings in the form of scanfrom=scanto (in hex) - e027=0;disable discrete fnkeys toggle - e028=0;disable discrete trackpad toggle - - HIDF12EjectDelay - 250 - LogScanCodes - 0 - Make Application key into Apple Fn key - - Make Application key into right windows - - Make right modifier keys into Hangul and Hanja - - SleepPressTime - 0 - Swap capslock and left control - - Swap command and option - - Use ISO layout keyboard - - alt_handler_id - 3 - - HPQOEM - - 1411 - ProBook-102;ProBook 4520s - 1619 - ProBook-87;ProBook 6560b - 161C - ProBook-87;ProBook 8460p - 164F - ProBook-87;ProBook 5330m - 167C - ProBook-102;ProBook 4530s - 167E - ProBook-102;ProBook 4330s - 1680 - ProBook-102;ProBook 4230s - 179B - ProBook-87;ProBook 6470b - 179C - ProBook-87;ProBook 6470b - 17A9 - ProBook-87;ProBook 8570b - 17F0 - ProBook-102;ProBook 4340s - 17F3 - ProBook-102;ProBook 4440s - 17F6 - ProBook-102;ProBook 4540s - 1942 - ProBook-87;ProBook 450s G1 - 1949 - ProBook-87;ProBook 450s G1 - 1962 - Haswell-Envy;HP Envy 15-j063cl - 1963 - Haswell-Envy;HP Envy 15-j063cl - 1965 - Haswell-Envy;HP Envy 17t-j100 - 1966 - Haswell-Envy;HP Envy 17t-j000 - 198F - ProBook-87;ProBook 450s G0 - Haswell-Envy - - Custom ADB Map - - e019=42;next - e010=4d;previous - - Custom PS2 Map - - e045=e037 - e0ab=0;bogus Fn+F2/F3 - - - ProBook-102 - - Custom PS2 Map - - e005=0 - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e05f=3b - e012=3c - e017=3d - e06e=3e - e00a=3f - e009=40 - e020=41 - e02e=42 - e030=43 - e010=44 - e022=57 - e019=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e05f - 3c=e012 - 3d=e017 - 3e=e06e - 3f=e00a - 40=e009 - 41=e020 - 42=e02e - 43=e030 - 44=e010 - 57=e022 - 58=e019 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e05f=e05f - e012=e012 - e017=e017 - e06e=e06e - e00a=e00a - e009=e009 - e020=e020 - e02e=e02e - e030=e030 - e010=e010 - e022=e022 - e019=e019 - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - SleepPressTime - 3000 - - ProBook-87 - - Custom ADB Map - - 46=4d;scroll => Previous-track - e045=34;pause => Play-Pause - e052=42;insert => Next-track - e046=92;break => Eject - - Custom PS2 Map - - e005=0 - - Function Keys Special - - ;The following 8 items map Fn+fkeys to fkeys - e05f=3d - e06e=3e - e02e=40 - e030=41 - e009=42 - e012=43 - e017=44 - e033=57 - ;The following 8 items map fkeys to Fn+fkeys - 3d=e05f - 3e=e06e - 40=e02e - 41=e030 - 42=e037 - 43=e012 - 44=e017 - - Function Keys Standard - - ;The following 8 items map Fn+fkeys to Fn+fkeys - e05f=e05f - e06e=e06e - e02e=e02e - e030=e030 - e009=e009 - e012=e012 - e017=e017 - e033=e033 - ;The following 8 items map fkeys to fkeys - 3d=3d - 3e=3e - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - - SleepPressTime - 3000 - - - Intel - - CALPELLA - SamsungKeys - SamsungKeys - - Breakless PS2 - - e003 - e002 - e004 - e020 - ;e031 - e033 - e006 - e077 - e079 - e008 - e009 - - Custom ADB Map - - e002=70 - e006=80 - e008=71 (was =90) - e009=6b (was =91) - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - ;fn+f1 no code - e003=3c - ;fn+f3 weird code - e002=3e - e004=3f - e020=40 - e031=41 - e033=42 - e006=43 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - ;The following 12 items map fkeys to Fn+fkeys - ;fn+f1 no code - 3c=e003 - ;fn+f3 weird code - 3e=e002 - 3f=e004 - 40=e020 - 41=e031 - 42=e033 - 43=e006 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - ;fn+f1 no code - e003=e003 - ;fn+f3 weird code - e002=e002 - e004=e004 - e020=e020 - e031=e031 - e033=e033 - e006=e006 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - - - SECCSD - - LH43STAR - SamsungKeys - SamsungKeys - - Breakless PS2 - - e020 - e02e - e030 - - - - - - - LSMinimumSystemVersion - 10.11 - OSBundleLibraries - - as.acidanthera.voodoo.driver.PS2Controller - 2.2.0 - com.apple.iokit.IOHIDFamily - 1.0.0b1 - com.apple.kpi.bsd - 8.0.0 - com.apple.kpi.iokit - 8.0.0 - com.apple.kpi.libkern - 8.0.0 - com.apple.kpi.mach - 8.0.0 - com.apple.kpi.unsupported - 8.0.0 - - OSBundleRequired - Console - - diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/RestBeanCandidate.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/RestBeanCandidate.java index 8e8dc1d..e550ab9 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/RestBeanCandidate.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/enums/RestBeanCandidate.java @@ -1,6 +1,18 @@ package com.flyfish.framework.beans.enums; -public enum RestBeanCandidate { +import com.flyfish.framework.enums.NamedEnum; +import lombok.AllArgsConstructor; +import lombok.Getter; - REPOSITORY, SERVICE, CONTROLLER +/** + * rest-bean生成的类型 + * @author wangyu + */ +@Getter +@AllArgsConstructor +public enum RestBeanCandidate implements NamedEnum { + + REPOSITORY("Repository"), SERVICE("Service"), CONTROLLER("Controller"); + + private final String name; } diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanController.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanController.java index ca72067..1ef8cd3 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanController.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanController.java @@ -1,16 +1,18 @@ package com.flyfish.framework.beans.meta; import com.flyfish.framework.bean.Result; +import com.flyfish.framework.beans.resolver.DynamicRestBeanResolver; +import com.flyfish.framework.utils.StringFormats; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ClassUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.BeanUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.util.Collections; +import javax.annotation.Resource; import java.util.List; +import java.util.stream.Collectors; /** * bean控制器,可以通过类直接返回bean信息 @@ -22,21 +24,42 @@ import java.util.List; @Slf4j public class BeanController { + @Resource + private DynamicRestBeanResolver dynamicRestBeanResolver; + /** * 通过类标识返回bean信息 * * @return 结果 */ @GetMapping("") - public Result> beanInfo(String className) { + public Result beanInfo(String className) { if (StringUtils.isBlank(className)) { - return Result.ok(Collections.emptyList()); + return Result.empty(); } try { - return Result.ok(BeanProperty.from(ClassUtils.getClass(className))); + Class clazz = ClassUtils.getClass(className); + BeanInfo info = new BeanInfo(); + info.setCode(StringFormats.camel2Line(ClassUtils.getShortClassName(clazz))); + if (clazz.isAnnotationPresent(RestBean.class)) { + info.setName(clazz.getAnnotation(RestBean.class).name()); + } + info.setProperties(BeanProperty.from(clazz)); + return Result.ok(info); } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); return Result.error(e.getMessage()); } } + + /** + * 列出自动注册的bean,快速接入 + * + * @return 结果 + */ + @GetMapping("list") + public Result> beanList() { + return Result.accept(dynamicRestBeanResolver.getClasses().stream().map(ClassUtils::getCanonicalName) + .collect(Collectors.toList())); + } } diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanInfo.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanInfo.java new file mode 100644 index 0000000..5b4a2d9 --- /dev/null +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanInfo.java @@ -0,0 +1,22 @@ +package com.flyfish.framework.beans.meta; + +import lombok.Data; + +import java.util.List; + +/** + * bean的属性们 + * @author wangyu + */ +@Data +public class BeanInfo { + + // bean的编码 + private String code; + + // bean的显示名 + private String name; + + // bean的属性们 + private List properties; +} diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java index 19c9a8f..eeca7da 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanProperty.java @@ -1,15 +1,14 @@ package com.flyfish.framework.beans.meta; +import com.flyfish.framework.annotations.Property; import lombok.Data; import org.apache.commons.lang3.reflect.FieldUtils; import org.springframework.beans.BeanUtils; +import org.springframework.core.annotation.AnnotationUtils; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -24,6 +23,12 @@ public class BeanProperty { // 属性名称 private String name; + // 属性标题 + private String title; + + // 描述信息 + private String description; + // bean属性的类型,js类型 private BeanPropertyType type; @@ -54,12 +59,22 @@ public class BeanProperty { * @return 结果 */ public static BeanProperty form(PropertyDescriptor descriptor, Class beanClass) { + // 尝试获取field + Field field = FieldUtils.getDeclaredField(beanClass, descriptor.getName(), true); + // 存在field,可以干一些坏事 BeanProperty property = new BeanProperty(); property.setName(descriptor.getName()); property.setType(BeanPropertyType.of(descriptor, beanClass)); + if (null != field) { + Property props = AnnotationUtils.findAnnotation(field, Property.class); + if (null != props) { + String parentName = Optional.ofNullable(beanClass.getAnnotation(RestBean.class)).map(RestBean::name).orElse(""); + property.setTitle(props.inherited() ? parentName + props.title() : props.title()); + property.setDescription(props.description()); + } + } Class clazz = descriptor.getPropertyType(); if (property.getType() == BeanPropertyType.OBJECT) { - Field field = FieldUtils.getDeclaredField(beanClass, property.getName(), true); // 有子bean注解才处理 if (null != field && field.isAnnotationPresent(SubBean.class)) { property.setChildren(from(clazz)); diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java index 49e17dd..fcc3444 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/BeanPropertyType.java @@ -1,12 +1,9 @@ package com.flyfish.framework.beans.meta; -import com.flyfish.framework.domain.base.Domain; +import com.flyfish.framework.domain.base.Po; import lombok.Getter; -import org.apache.commons.lang3.reflect.FieldUtils; -import org.springframework.data.mongodb.core.mapping.DBRef; import java.beans.PropertyDescriptor; -import java.lang.reflect.Field; import java.util.Arrays; import java.util.Collection; import java.util.Date; @@ -28,12 +25,7 @@ public enum BeanPropertyType { DATE("Date", Date.class), ENUM("Enum", Enum.class), LIST("Array", Collection.class), - DB_REF("Ref", (descriptor, beanClass) -> { - Class clazz = descriptor.getPropertyType(); - Field field = FieldUtils.getDeclaredField(beanClass, descriptor.getName()); - return null != field && field.isAnnotationPresent(DBRef.class) && - Domain.class.isAssignableFrom(clazz) && clazz.isAnnotationPresent(RestBean.class); - }), + DB_REF("Ref", Po.class), OBJECT("Object", Object.class); private final BiPredicate> acceptor; diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/Info.plist b/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/Info.plist deleted file mode 100755 index c55b849..0000000 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/meta/Info.plist +++ /dev/null @@ -1,616 +0,0 @@ - - - - - BuildMachineOSBuild - 19G2021 - CFBundleExecutable - VoodooPS2Keyboard - CFBundleGetInfoString - 2.1.7, Copyright Apple Computer, Inc. 2000-2003, RehabMan 2012-2013 - CFBundleIdentifier - as.acidanthera.voodoo.driver.PS2Keyboard - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Voodoo PS/2 Keyboard - CFBundlePackageType - KEXT - CFBundleShortVersionString - 2.1.7 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 2.1.7 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 10G8 - DTPlatformVersion - GM - DTSDKBuild - 18G74 - DTSDKName - macosx10.14 - DTXcode - 1030 - DTXcodeBuild - 10G8 - IOKitPersonalities - - ApplePS2Keyboard - - CFBundleIdentifier - as.acidanthera.voodoo.driver.PS2Keyboard - IOClass - ApplePS2Keyboard - IOProviderClass - ApplePS2KeyboardDevice - Platform Profile - - DELL - - Dell-Keys - - Breakless PS2 - - e005 - e006 - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e020=3b - e02e=3c - e030=3d - e022=3e - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - e005=57 - e006=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e020 - 3c=e02e - 3d=e030 - 3e=e022 - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - 57=e005 - 58=e006 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e020=e020 - e02e=e02e - e030=e030 - e022=e022 - ;Fn+f5 macro - ;Fn+f6 macro - ;Fn+f7 macro - ;Fn+f8 macro - ;Fn+f9 macro - ;Fn+f10 no code - e005=e005 - e006=e006 - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - - HSW-LPT - Dell-Keys - SNB-CPT - - ActionSwipeDown - 63 d, 63 u - ActionSwipeUp - 61 d, 61 u - Breakless PS2 - - e01e;Touchpad Fn+f3 is breakless - e06e;REVIEW: temporary for case that macro inversion does not work... - - Custom ADB Map - - e009=83;Dell Support to Launchpad - e0f1=71;Call brightens up w RKA1 for special mode (was =90) - e0f2=6b;Call brightens down w RKA2 for special mode (was =91) - e06e=70;Map vidmirror key for special mode default is adb90 - - Custom PS2 Map - - e01e=e037;Map tp disable to Fn+f3 - e037=e01e;Prevent PrntScr from triggering tp disable - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e06e=3b - e008=3c - e01e=3d - e005=3e - e006=3f - e00c=40 - ;Fn+f7 no dedicated macro - e010=42 - e022=43 - e019=44 - e02e=57 - e030=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e06e;Map vidmirror key to f1 - 3c=e0f0;Map radio toggle action from EC query to f2 - 3d=e037;Map touchpad toggle button to f3 - 3e=e0f2;Map acpi RKA2 to f4 brightness down - 3f=e0f1;Map acpi RKA1 to f5 brightness up - 40=e0f3;Map acpi RKA3 to f6 keyboard backlight - ;Fn+f7 no macro - 42=e010 - 43=e022 - 44=e019 - 57=e02e - 58=e030 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e06e=e06e;Fn+f1 macro translated - e008=e008;Fn+f2 regular scancode and EC query call q8c - e01e=e037;Fn+f3 regular scancode and EC controls LED - e005=e005;Fn+f4 no ps2scancode and EC query call q81 - e006=e006;Fn+f5 no ps2scancode and EC query call q80 - e00c=e00c;Fn+f6 no ps2scancode and EC query call q8a - ;Fn+f7 no macro just regular f key - e010=e010; Fn+f8 regular scancode - e022=e022; Fn+f9 regular scancode - e019=e019;Fn+f10 regular scancode - e02e=e02e;Fn+f11 regular scancode - e030=e030;Fn+f12 regular scancode - ;Fn+f13 is mute dedicated button that always produces e020 regardless of Fn - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - Macro Inversion - - ;This section maps ps2 codes (packet format) received quickly (macros) into fake ps2 codes (packet format) - ;Fn+F1 - - //8CbgAAAAACWwEZ - - - //8C7gAAAAAC2wGZ - - - //8C7gAAAAABmQLb - - - MaximumMacroTime - 35000000 - Note-Author - TimeWalker aka TimeWalker75a - Note-Comment - Keyboard Profile for DELL SandyBridge SecureCore Tiano based laptops (Vostro 3450 & 3750, Inspiron N4110, XPS L502x & L702x & L511z) - - WN09 - - Breakless PS2 - - e01b - e008 - e01e - e005 - e06e - e006 - - Custom ADB Map - - e01b=70 - e06e=83 - - Custom PS2 Map - - 56=2b - 29=56 - 2b=29 - e01e=e037 - e037=e01e - - - WN09a - - Breakless PS2 - - e01b - e008 - e01e - e005 - e06e - e006 - - Custom ADB Map - - e01b=70 - e06e=83 - - Custom PS2 Map - - e01e=e037 - e037=e01e - - - - Default - - Breakless PS2 - - ;Items must be strings in the form of breaklessscan (in hex) - - Custom ADB Map - - ;Items must be strings in the form of scanfrom=adbto (in hex) - - Custom PS2 Map - - ;Items must be strings in the form of scanfrom=scanto (in hex) - e027=0;disable discrete fnkeys toggle - e028=0;disable discrete trackpad toggle - - HIDF12EjectDelay - 250 - LogScanCodes - 0 - Make Application key into Apple Fn key - - Make Application key into right windows - - Make right modifier keys into Hangul and Hanja - - SleepPressTime - 0 - Swap capslock and left control - - Swap command and option - - Use ISO layout keyboard - - alt_handler_id - 3 - - HPQOEM - - 1411 - ProBook-102;ProBook 4520s - 1619 - ProBook-87;ProBook 6560b - 161C - ProBook-87;ProBook 8460p - 164F - ProBook-87;ProBook 5330m - 167C - ProBook-102;ProBook 4530s - 167E - ProBook-102;ProBook 4330s - 1680 - ProBook-102;ProBook 4230s - 179B - ProBook-87;ProBook 6470b - 179C - ProBook-87;ProBook 6470b - 17A9 - ProBook-87;ProBook 8570b - 17F0 - ProBook-102;ProBook 4340s - 17F3 - ProBook-102;ProBook 4440s - 17F6 - ProBook-102;ProBook 4540s - 1942 - ProBook-87;ProBook 450s G1 - 1949 - ProBook-87;ProBook 450s G1 - 1962 - Haswell-Envy;HP Envy 15-j063cl - 1963 - Haswell-Envy;HP Envy 15-j063cl - 1965 - Haswell-Envy;HP Envy 17t-j100 - 1966 - Haswell-Envy;HP Envy 17t-j000 - 198F - ProBook-87;ProBook 450s G0 - Haswell-Envy - - Custom ADB Map - - e019=42;next - e010=4d;previous - - Custom PS2 Map - - e045=e037 - e0ab=0;bogus Fn+F2/F3 - - - ProBook-102 - - Custom PS2 Map - - e005=0 - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - e05f=3b - e012=3c - e017=3d - e06e=3e - e00a=3f - e009=40 - e020=41 - e02e=42 - e030=43 - e010=44 - e022=57 - e019=58 - ;The following 12 items map fkeys to Fn+fkeys - 3b=e05f - 3c=e012 - 3d=e017 - 3e=e06e - 3f=e00a - 40=e009 - 41=e020 - 42=e02e - 43=e030 - 44=e010 - 57=e022 - 58=e019 - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - e05f=e05f - e012=e012 - e017=e017 - e06e=e06e - e00a=e00a - e009=e009 - e020=e020 - e02e=e02e - e030=e030 - e010=e010 - e022=e022 - e019=e019 - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - SleepPressTime - 3000 - - ProBook-87 - - Custom ADB Map - - 46=4d;scroll => Previous-track - e045=34;pause => Play-Pause - e052=42;insert => Next-track - e046=92;break => Eject - - Custom PS2 Map - - e005=0 - - Function Keys Special - - ;The following 8 items map Fn+fkeys to fkeys - e05f=3d - e06e=3e - e02e=40 - e030=41 - e009=42 - e012=43 - e017=44 - e033=57 - ;The following 8 items map fkeys to Fn+fkeys - 3d=e05f - 3e=e06e - 40=e02e - 41=e030 - 42=e037 - 43=e012 - 44=e017 - - Function Keys Standard - - ;The following 8 items map Fn+fkeys to Fn+fkeys - e05f=e05f - e06e=e06e - e02e=e02e - e030=e030 - e009=e009 - e012=e012 - e017=e017 - e033=e033 - ;The following 8 items map fkeys to fkeys - 3d=3d - 3e=3e - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - - SleepPressTime - 3000 - - - Intel - - CALPELLA - SamsungKeys - SamsungKeys - - Breakless PS2 - - e003 - e002 - e004 - e020 - ;e031 - e033 - e006 - e077 - e079 - e008 - e009 - - Custom ADB Map - - e002=70 - e006=80 - e008=71 (was =90) - e009=6b (was =91) - - Function Keys Special - - ;The following 12 items map Fn+fkeys to fkeys - ;fn+f1 no code - e003=3c - ;fn+f3 weird code - e002=3e - e004=3f - e020=40 - e031=41 - e033=42 - e006=43 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - ;The following 12 items map fkeys to Fn+fkeys - ;fn+f1 no code - 3c=e003 - ;fn+f3 weird code - 3e=e002 - 3f=e004 - 40=e020 - 41=e031 - 42=e033 - 43=e006 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - - Function Keys Standard - - ;The following 12 items map Fn+fkeys to Fn+fkeys - ;fn+f1 no code - e003=e003 - ;fn+f3 weird code - e002=e002 - e004=e004 - e020=e020 - e031=e031 - e033=e033 - e006=e006 - ;fn+f10 weird code - ;fn+f11 no code - ;fn+f12 scrolllock - ;The following 12 items map fkeys to fkeys - 3b=3b - 3c=3c - 3d=3d - 3e=3e - 3f=3f - 40=40 - 41=41 - 42=42 - 43=43 - 44=44 - 57=57 - 58=58 - - - - SECCSD - - LH43STAR - SamsungKeys - SamsungKeys - - Breakless PS2 - - e020 - e02e - e030 - - - - - - - OSBundleLibraries - - as.acidanthera.voodoo.driver.PS2Controller - 2.1.7 - com.apple.iokit.IOHIDFamily - 1.0.0b1 - com.apple.kpi.bsd - 8.0.0 - com.apple.kpi.iokit - 8.0.0 - com.apple.kpi.libkern - 8.0.0 - com.apple.kpi.mach - 8.0.0 - com.apple.kpi.unsupported - 8.0.0 - - OSBundleRequired - Console - - diff --git a/flyfish-web/src/main/java/com/flyfish/framework/beans/resolver/DynamicRestBeanResolver.java b/flyfish-web/src/main/java/com/flyfish/framework/beans/resolver/DynamicRestBeanResolver.java index db770c9..836c3ac 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/beans/resolver/DynamicRestBeanResolver.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/beans/resolver/DynamicRestBeanResolver.java @@ -10,7 +10,9 @@ import org.springframework.web.reactive.result.method.annotation.RequestMappingH import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; /** * 动态Bean生成解析器 @@ -22,6 +24,7 @@ import java.util.List; public class DynamicRestBeanResolver implements InitializingBean, DisposableBean { private static final List controllers = new ArrayList<>(); + private static final Set> classes = new HashSet<>(); private final Method handlerRegister; private final RequestMappingHandlerMapping mapping; @@ -34,6 +37,14 @@ public class DynamicRestBeanResolver implements InitializingBean, DisposableBean controllers.add(controller); } + public static void setClasses(Set> classSet) { + classes.addAll(classSet); + } + + public Set> getClasses() { + return classes; + } + @Override public void destroy() throws Exception { log.info("正在销毁rest自动配置器"); diff --git a/flyfish-web/src/main/java/com/flyfish/framework/config/RestBeanAutoConfigure.java b/flyfish-web/src/main/java/com/flyfish/framework/config/RestBeanAutoConfigure.java index 587f266..a99cda9 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/config/RestBeanAutoConfigure.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/config/RestBeanAutoConfigure.java @@ -1,6 +1,7 @@ package com.flyfish.framework.config; import com.flyfish.framework.beans.annotations.EnableRestBeanDetect; +import com.flyfish.framework.beans.enums.RestBeanCandidate; import com.flyfish.framework.beans.meta.RestBean; import com.flyfish.framework.beans.repository.CustomRepositoryRegistrar; import com.flyfish.framework.beans.resolver.DynamicRestBeanResolver; @@ -31,6 +32,8 @@ import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; +import static com.flyfish.framework.beans.enums.RestBeanCandidate.*; + /** * rest bean的自动配置 * @@ -40,10 +43,10 @@ import java.util.stream.Stream; public class RestBeanAutoConfigure implements ImportBeanDefinitionRegistrar, ResourceLoaderAware, EnvironmentAware { // 预编译模板 - private final Map> templates = Stream.of("Repository", "Service", "Controller") - .collect(Collectors.toMap(key -> key, filename -> TemplateCompiler.compile("/templates/" + filename + ".tpl"))); + private final Map> templates = Arrays.stream(values()) + .collect(Collectors.toMap(key -> key, key -> TemplateCompiler.compile("/templates/" + key.getName() + ".tpl"))); // 存放父类值的映射 - private final Map>> superClasses; + private final Map>> superClasses; // 编译器引用 private final DynamicJavaCompiler compiler = DynamicJavaCompiler.delegate(); @@ -54,9 +57,9 @@ public class RestBeanAutoConfigure implements ImportBeanDefinitionRegistrar, Res public RestBeanAutoConfigure() { superClasses = new HashMap<>(); - superClasses.put("Controller", RestBean::controllerClass); - superClasses.put("Repository", RestBean::repoClass); - superClasses.put("Service", RestBean::serviceClass); + superClasses.put(CONTROLLER, RestBean::controllerClass); + superClasses.put(REPOSITORY, RestBean::repoClass); + superClasses.put(SERVICE, RestBean::serviceClass); } /** @@ -76,9 +79,12 @@ public class RestBeanAutoConfigure implements ImportBeanDefinitionRegistrar, Res CustomRepositoryRegistrar repositoryRegistrar = new CustomRepositoryRegistrar(metadata, resourceLoader, environment, registry, beanNameGenerator); // 准备注册的repo - Map>> loadedClasses = new ConcurrentHashMap<>(); + Map>> loadedClasses = new ConcurrentHashMap<>(); // 获取被注解的类,开始编译 - reflections.getTypesAnnotatedWith(RestBean.class).parallelStream().forEach(clazz -> { + Set> classes = reflections.getTypesAnnotatedWith(RestBean.class); + DynamicRestBeanResolver.setClasses(classes); + // 并发编译,快速接入 + classes.parallelStream().forEach(clazz -> { RestBean restBean = clazz.getDeclaredAnnotation(RestBean.class); if (null != restBean) { // 创建java source信息 @@ -88,13 +94,13 @@ public class RestBeanAutoConfigure implements ImportBeanDefinitionRegistrar, Res .setPackageName(basePackages.stream().findFirst().orElse("com.flyfish.project")) .setUri(makePath(clazz.getSimpleName(), restBean.value())); // 分别生成实现类,从repo到controller - templates.forEach((key, template) -> { - source.setSuperClass(superClasses.get(key).apply(restBean).getCanonicalName()); - source.setClassName(clazz.getSimpleName() + key); + templates.forEach((type, template) -> { + source.setSuperClass(superClasses.get(type).apply(restBean).getCanonicalName()); + source.setClassName(clazz.getSimpleName() + type.getName()); try { log.info("尝试注册{}", source.getClassName()); Class compiled = compiler.compile(source.getClassName() + ".java", template.apply(source)); - loadedClasses.computeIfAbsent(key, k -> new ArrayList<>()).add(compiled); + loadedClasses.computeIfAbsent(type, k -> new ArrayList<>()).add(compiled); // IllegalAccessException | InvocationTargetException } catch (ClassNotFoundException | IOException e) { log.error("注册{}时发生异常!", source.getClassName(), e); @@ -103,11 +109,11 @@ public class RestBeanAutoConfigure implements ImportBeanDefinitionRegistrar, Res } }); // 从repo开始,注册bean - loadedClasses.getOrDefault("Repository", Collections.emptyList()) + loadedClasses.getOrDefault(REPOSITORY, Collections.emptyList()) .forEach(repositoryRegistrar::register); - loadedClasses.getOrDefault("Service", Collections.emptyList()) + loadedClasses.getOrDefault(SERVICE, Collections.emptyList()) .forEach(clazz -> registerBean(clazz, registry)); - loadedClasses.getOrDefault("Controller", Collections.emptyList()) + loadedClasses.getOrDefault(CONTROLLER, Collections.emptyList()) .forEach(clazz -> registerBean(clazz, registry)); log.info("结束注册rest bean..."); } diff --git a/flyfish-web/src/main/java/com/flyfish/framework/controller/EnumController.java b/flyfish-web/src/main/java/com/flyfish/framework/controller/EnumController.java index f277e0b..99a884a 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/controller/EnumController.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/controller/EnumController.java @@ -64,7 +64,10 @@ public class EnumController { * @return 结果 */ @GetMapping - public Result> values(@PathVariable("code") String code) { + public Result values(@PathVariable("code") String code) { + if ("all".equals(code)) { + return Result.ok(values); + } return Result.ok(values.getOrDefault(code, Collections.emptyList())); } -} \ No newline at end of file +} diff --git a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationFailureHandler.java b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationFailureHandler.java index d714c4b..840dfbd 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationFailureHandler.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationFailureHandler.java @@ -22,11 +22,11 @@ public class JsonAuthenticationFailureHandler implements ServerAuthenticationFai private final String defaultMessage = "用户登录异常!"; // 数据块工厂 - private final DataBufferTransformer dataBufferTransformer; + private final DataBufferTransformer> dataBufferTransformer; - private Map, String> descriptionMap = new HashMap<>(); + private final Map, String> descriptionMap = new HashMap<>(); - public JsonAuthenticationFailureHandler(DataBufferTransformer dataBufferTransformer) { + public JsonAuthenticationFailureHandler(DataBufferTransformer> dataBufferTransformer) { this.dataBufferTransformer = dataBufferTransformer; descriptionMap.put(BadCredentialsException.class, "用户名密码不正确!"); // todo 剩下的都在userDetailsService diff --git a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationSuccessHandler.java b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationSuccessHandler.java index 3775b39..bbb29fa 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationSuccessHandler.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonAuthenticationSuccessHandler.java @@ -21,7 +21,7 @@ import reactor.core.publisher.Mono; public class JsonAuthenticationSuccessHandler implements ServerAuthenticationSuccessHandler { // 数据块工厂 - private final DataBufferTransformer dataBufferTransformer; + private final DataBufferTransformer> dataBufferTransformer; /** * 登录成功后要返回用户的基本信息,节省带宽 diff --git a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonLogoutSuccessHandler.java b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonLogoutSuccessHandler.java index 100917f..6d41ab8 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonLogoutSuccessHandler.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/handler/JsonLogoutSuccessHandler.java @@ -20,7 +20,7 @@ import reactor.core.publisher.Mono; public class JsonLogoutSuccessHandler implements ServerLogoutSuccessHandler { // 数据块工厂 - private final DataBufferTransformer dataBufferTransformer; + private final DataBufferTransformer> dataBufferTransformer; private final TokenProvider tokenProvider; diff --git a/flyfish-web/src/main/java/com/flyfish/framework/transform/ResultDataTransformer.java b/flyfish-web/src/main/java/com/flyfish/framework/transform/ResultDataTransformer.java index c84443c..cd2b84b 100644 --- a/flyfish-web/src/main/java/com/flyfish/framework/transform/ResultDataTransformer.java +++ b/flyfish-web/src/main/java/com/flyfish/framework/transform/ResultDataTransformer.java @@ -12,16 +12,16 @@ import java.nio.charset.Charset; * * @author wangyu */ -public class ResultDataTransformer implements DataBufferTransformer { +public class ResultDataTransformer implements DataBufferTransformer> { - private DataBufferFactory factory; + private final DataBufferFactory factory; public ResultDataTransformer() { this.factory = SharedDataBufferFactory.getDefaultFactory(); } @Override - public DataBuffer transform(Result source) { + public DataBuffer transform(Result source) { return JacksonUtil.toJson(source) .map(result -> result.getBytes(Charset.defaultCharset())) .map(factory::wrap)