问题标签 [spring-mobile]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
500 浏览

spring - Spring chaning LiteDeviceDelegatingViewResolver 和 InternalResourceViewResolver

我在使用 Spring Mobile 1.1.2 和 Spring MVC 时遇到问题。我遇到的问题是,在应用程序中,我有桌面的所有视图,对于某些桌面,我有移动替代方案。

我使用LiteDeviceDelegatingViewResolver, 代表InternalResourceViewResolver. 如果桌面和移动视图都存在,则一切正常。在台式机上我看到桌面版,在移动设备上我看到移动版。问题是当移动视图不存在时。

我知道,该回退解决方案仅在委派给视图解析器时才有效,resolveViewName(String, Locale)如果它无法解析视图,则返回 null。例如,InternalResourceViewResolver从不返回 null,因此后备解决方案将不可用。所以我不希望这会奏效。

但是我尝试使用顺序 1 LiteDeviceDelegatingViewResolver(代表InternalResourceViewResolver)和顺序 2 InternalResourceViewResolver(无论在设备上始终指向桌面视图)链接解析器。我的问题是,它永远不会到达 2 号解析器。问题出在哪里?

谢谢

0 投票
1 回答
832 浏览

spring - 如何将 spring-mobile-device 拦截器应用于欢迎文件?

我正在使用 SpringMVC,并且我对每种设备类型桌面/平板电脑/移动设备都有不同的设计

我在每个设备的 /WEB-INF/views/ 文件夹中都有 /m /t 和 / 文件夹视图,一切正常,但此配置不仅适用于欢迎页面,即我用手机打开页面并查看桌面版登录.jsp(/WEB_INF/views/login.jsp 但不是 /WEB-INF/views/m/login.jsp)

我必须做些什么来改变它来修复它。

0 投票
1 回答
448 浏览

spring - Spring Mobile EnableFallback 不起作用

我正在尝试让后备解决方案在移动设备上运行,但遇到了一些问题。

我有以下jsp结构

目前我在移动设备中没有 intermediary.jsp,但我在后备目录中有它。AbstractDeviceDelegatingViewResolver 中的 resolveViewName 仅在视图为空时触发。

我遇到的问题是我找不到任何 viewResolver 来返回 null。InternalResourceViewResolver 不返回 null 并且 UrlBasedViewResolver 始终返回不存在的 /mobile/intermediary.jsp 的视图名称,这又会引发 404。有人知道我应该使用哪个解析器来使后备解决方案工作吗?

谢谢,

0 投票
1 回答
190 浏览

spring - jQuery mobile - 浏览器刷新页面后完全搞砸了

我正在后端开发一个带有spring mobile的jqm应用程序。每当我点击手机上的浏览器刷新按钮时,页面都会被彻底摧毁。浏览器后退按钮正常工作。

刷新后数据仍然可用,因为 prg 模式(Spring 中的 flashAttributes)。只有视图格式不正确。

任何想法如何解决这个问题?

0 投票
1 回答
4603 浏览

spring-boot - 使用 spring-boot 检测移动设备

我试图让我的应用程序检测移动设备并呈现该页面,但我没有得到任何响应,但我的 index.html 页面正在呈现。它完全忽略了我的移动控制器。

pom.xml

在此处输入图像描述

0 投票
1 回答
454 浏览

java - 仅允许移动设备访问 REST API

可以只允许移动设备访问我的服务器端的 REST API(Based on spring framework)吗?

0 投票
0 回答
224 浏览

java - spring-mobile 和 apache-tiles 帮助使用通用元素

您好,在使用 spring mobile 配置 apache 磁贴时遇到问题。当我尝试从移动设备访问 Web 应用程序时,它没有显示移动文件夹中的移动 jsp。以下是应用程序配置文件中的代码

AppConfig.Java

控制器

0 投票
2 回答
905 浏览

java - 如何使用 Spring Mobile (spring-mobile-device) 联合 RestController

我有一个带有设备的 Rest 控制器(设备必须是解析,我使用的是 spring-mobile-device)作为参数。单元测试给了我一个状态 415。

这是代码

单元测试

0 投票
1 回答
80 浏览

spring-boot - Spring Boot Mobile 不使用移动模板

我最近在我的 spring boot 项目中添加了 spring boot mobile LATEST,但不知何故它不会使用移动模板。

这就是我配置它以使用特定模板的方式。默认设置有效,但如果我连接手机,它将不会使用移动模板。启用或禁用回退不会改变这一点。

在我的属性中,我添加了: spring.mobile.devicedelegatingviewresolver.enabled=true

似乎没有任何帮助。为什么这不起作用?

0 投票
0 回答
710 浏览

java - 无法配置 Spring Mobile Spring 2

我有一个 Spring Boot 应用程序,我想(开始)检测我的设备是移动设备还是浏览器。因此,我认为 Spring mobile 是一个好主意。问题是我做不到。

代码:
根据官方文档here,我实现了以下内容:

在我的控制器中

和 pom.xml 添加:

问题:
我可以运行应用程序,但是当我调用此端点时,我收到以下错误:

未找到接口 org.springframework.mobile.device.Device java.lang.IllegalStateException 的主要或默认构造函数:在 org.springframework.web.method.annotation 未找到接口 org.springframework.mobile.device.Device 的主要或默认构造函数.ModelAttributeMethodProcessor.createAttribute(ModelAttributeMethodProcessor.java:219) 在 org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.createAttribute(ServletModelAttributeMethodProcessor.java:84) 在 org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument (ModelAttributeMethodProcessor.java:139) 在 org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:124) 在 org.springframework.web.method.support。InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:165) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at

还有什么要补充的吗?或者有什么东西可以添加到弹簧属性中?