我的控制器中有一个带有不同参数的 get 函数:
myinterface.java:
public interface MyInterface {
@Get(value = "/bob/{name}/params?surname={surname}")
String getMyParam (
@Parameter(name="name", required=true)
@PathVariable("name") String name,
@NotNull
@Parameter(name="surname", required=true)
@Valid
@RequestAttribute(value="surname") String surname) {
}
}
Run Code Online (Sandbox Code Playgroud)
我的控制器.java :
public class MyController implements MyInterface {
@Override
public String getMyParam(String name, String surname) { return name + surname; }
}
Run Code Online (Sandbox Code Playgroud)
但是当我调用“ http://localhost:8080/bob/marley/params?surname=lion ”时,它会发送一条错误消息:找不到页面。
当我使用可选参数时,/books{?max,offset}它就起作用了。我错过了什么?
执行查询请求时 PathVariable 和 RequestAttribute 是否不可混合?
编辑 1
当我?surname=={surname}从@Get 值中删除 时,它会发生“HttpClientResponseException:需要参数 [String surname] 未指定”。
我在Apache服务器上有一个目录(Linux/Unix),其中有很多子目录包含很多这样的文件:
- Dir
- 2010_01/
- 142_78596_101_322.pdf
- 12_10.pdf
- ...
- 2010_02/
- ...
我怎样才能找到文件名看起来像的所有文件:*_*_*_*.pdf?其中*总是一个数字!!
我试着像这样解决它:
ls -1Rl 2010-01 | grep -i '\(\d)+[_](\d)+[_](\d)+[_](\d)+[.](pdf)$' | wc -l
Run Code Online (Sandbox Code Playgroud)
但正则表达式\(\d)+[_](\d)+[_](\d)+[_](\d)+[.](pdf)$不适用于grep.
编辑1:尝试ls -l 2010-03 | grep -E '(\d+_){3}\d+\.pdf' | wc -l例如只返回null.所以它不完美
我有一堆我想慢慢画的点.我尝试了setTimeOut和本教程的效果.但没有那么多成功.
函数看起来像这样
功能:
var myFunction = function(ctx, grid, points) {
ctx.beginPath();
ctx.moveTo(points[0].x, points[0].y);
ctx.lineWidth = 2;
ctx.strokeStyle = '#2068A8';
ctx.fillStyle = '#2068A8';
var count = 1;
for (count = 1; count < points.length; count++) {
ctx.lineTo(points[count].x , points[count].y);
}
ctx.stroke();
}
Run Code Online (Sandbox Code Playgroud)
围绕这个功能有许多其他绘图功能,但我只想动画一个.
我怎样才能慢慢用画布绘制一个函数?
因为我是开发手表应用程序的新手,以及智能手机存在以下框架的事实:
我想知道手表应用程序是否存在类似的框架?这样你就可以编码一次但整体运行.
谢谢
编辑1:
在有关的nativescript维护者的答案这一天(2015年5月12日)在这里.我将使用nativescript开始为可穿戴设备编写应用程序.
sony-smartwatch samsung-galaxy-gear tizen-wearable-sdk apple-watch watchkit
我正试图在我的应用程序(VSTO)中获取工作簿,如下所示:
ExcelViewModel mb = new ViewModels.ExcelViewModel();
string NameBox = mb.Workbooks.First().Name;
Run Code Online (Sandbox Code Playgroud)
因此,当Excel打开时,它已经拥有默认工作簿:Book1.xlsx我打开例如第二个工作簿(example.xlsx)但我的字符串NameBox返回"Book1".我怎样才能获得活动的工作簿?对于我的例子,"example.xlsx"一个.
ExcelViewModel只返回一个所有工作簿的ObservableCollection.
谢谢.
我的.xhtml数据库看起来像这样:
<p:dataTable var="category" value="#{beanView.categories}" paginator="true" rows="5"
paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
rowsPerPageTemplate="5,10" id="categoryDT" styleClass="categoryClass"
editable="true" lazy="false" rowKey="#{category.id}">
<!-- columns -->
<f:facet name="footer">
<p:commandButton id="btnNewCat"
oncomplete="jQuery('.categoryClass').find('span.ui-icon-pencil').last().click();"
actionListener="#{beanView.onNewCategory}"
update="categoryDT" icon="ui-icon-plus" title="New Category" value="New Category" ></p:commandButton>
</f:facet></p:dataTable>
Run Code Online (Sandbox Code Playgroud)
而我的bean beanView:
public void onNewCategory(final ActionEvent actionEvent) {
try {
int rowCount = dataTable.getRowCount();
int rowsPerPage = dataTable.getRows();
int lastPage = rowCount / rowsPerPage;
int rowFirst = (lastPage * rowsPerPage);
if (rowCount >= rowsPerPage) {
dataTable.setFirst(rowFirst);
dataTable.setPageLinks(lastPage + 1);
dataTable.setRowIndex(rowCount - 1);
} else …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用动态伪装。但是从 RequestMapping 转换响应时我有很多问题。
控制器.java :
@RequestMapping("/users")
public ResponseEntity<List<User>> sendUsers
Run Code Online (Sandbox Code Playgroud)
MyFeignClient.java :
public interface MyFeignClient {
@RequestLine(value="GET /api/users")
ResponseEntity<List<User>> getUsers();}
Run Code Online (Sandbox Code Playgroud)
主类.java :
MyFeignClient callService = Feign.builder()
.encoder(new Encoder.Default())
.decoder(new Decoder.Default())
.requestInterceptor(new FeignConfig(props).getJwtRequestInterceptor())
.target(MyFeignClient.class, "http://localhost:8710");
Run Code Online (Sandbox Code Playgroud)
进而 :
ResponseEntity<List<User>> txnPool = callService.getUsers();
Run Code Online (Sandbox Code Playgroud)
但我有以下错误:
feign.codec.DecodeException User 不是此解码器支持的类型
我该如何解决?
通常在 Spring 中,我们可以通过以下方式检索路径变量:
final Map<String, String> pathVariables = (Map<String, String>) request
.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
Run Code Online (Sandbox Code Playgroud)
这是我到目前为止所做的。
控制器:
@Get(value = "/{variable}/anotherpath")
public Single<HttpResponse<ResponseESQ>> myController(String variable) {}
Run Code Online (Sandbox Code Playgroud)
筛选 :
@Filter("/**")
public class myFilter implements HttpServerFilter {
@Override
public Publisher<MutableHttpResponse<?>> doFilter(HttpRequest<?> request, ServerFilterChain chain) {
// I need here to consume the path variable
request.getAttribute("variable")
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用 :request.getAttributes()但它不起作用。
我们如何在 Micronaut 中做同样的事情?
我有一个使用Raphael 2.0的SVG创建,如下所示:
<div class="stave">
<svg height="342" version="1.1" width="512" xmlns="http://www.w3.org/2000/svg"
style="overflow: hidden; position: relative;" viewBox="0 410 1300 80"
preserveAspectRatio="meet">
........
</svg>
</div>
Run Code Online (Sandbox Code Playgroud)
我只想为svg标签设置一个ID!我该怎么做?JQUERY或RAPHAEL 2.0?我看到很多答案,但没有一个对我有用.
谢谢你的帮忙
javascript ×2
jquery ×2
micronaut ×2
apple-watch ×1
c#-4.0 ×1
canvas ×1
datatable ×1
dom ×1
excel ×1
grep ×1
html5 ×1
html5-canvas ×1
java ×1
jhipster ×1
jsf ×1
jsf-2 ×1
linux ×1
primefaces ×1
raphael ×1
regex ×1
spring-boot ×1
spring-cloud ×1
vsto ×1
watchkit ×1