我正在尝试让我的应用响应这些方案:
我的应用程序内://产品/ XXX
和
我的应用程序内://
以下代码有效,但我收到警告:android:host不能为空.它仍然有效,但是 - 是否有正确的方法来指定空主机?
我不想将"*"指定为android-host,因为还有其他活动可以处理不同的操作,然后它们不会直接打开,但我会得到一个选择器对话框来选择应该打开的活动.
<activity android:name=".ui.OpenerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait" >
<intent-filter>
<data android:scheme="my-app" />
<data android:host="product" />
<data android:host="" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)
非常感谢!
我正在使用Spring启动来创建一个安静的api服务.一切正常,除了我不能指定哪些数据作为JSON返回.
我想要的是获得没有字段"content"的输出(在我的例子中用于存储对象).
Spring版本是4.2.5
这就是为什么我定义了3个级别的视图(内部是在数据库中获取/设置对象时使用的视图,Public是要输出到客户端的最小数据):
public class EntityVisibility {
public static class Public { }
public static class Detailed extends Public { }
public static class Internal extends Detailed { }
}
Run Code Online (Sandbox Code Playgroud)
我的控制器:
@RestController
@RequestMapping("/api/photos")
public class PhotoController extends BaseController {
@JsonView(EntityVisibility.Public.class)
@RequestMapping(value="/load", method= RequestMethod.GET)
public Response<Photo> loadFromUrl(@RequestParam("url") String urlAddress) {
Photo photo = ...; // create photo object
return new Response<>(photo);
}
}
Run Code Online (Sandbox Code Playgroud)
对我来说,它看起来@JsonView(EntityVisibility.Public.class)现在正在发挥作用.
响应类(仅限相关部分):
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Response<T> {
private T result;
public Response(T response) {
result …Run Code Online (Sandbox Code Playgroud)