我正在运行MySQL 5.0.88和Coldfusion8.
在一个表单中,我从表中获取了一些记录ID并将它们发送到服务器.字符串将如下所示:
9900000002985,9900000003180,9900000003203,9900000003487,9900000003579
Run Code Online (Sandbox Code Playgroud)
然后我将它传递给MySQL,最初是这样的:
SELECT bk.*
FROM header AS bk
WHERE 1
AND bk.iln_kaeufer IN ( #passed_in_string# )
Run Code Online (Sandbox Code Playgroud)
我一直在尝试使用cfqueryparam,如下所示:
<cfqueryparam cfsqltype="cf_sql_longvarchar" value="#passed_in_string#">
Run Code Online (Sandbox Code Playgroud)
但这会导致ColdFusion出错.如果我直接在MySQL中运行查询,它就可以工作.所以它一定是我的cfqueryparam声明的东西.
我从远程位置通过AJAX传递此表单.所以我没有收到任何错误消息,除了AJAX提交错误.
问题:
如果我不能使用,如何保护上述字符串cfqueryparam?
谢谢!
我目前正在试用 Apache 骆驼(作为路由引擎)。我知道 Camel 支持多个 DSL,并且可以使用 Java (Java DSL) 或 Spring (Spring DSL) 进行配置。
问题:
我有以下 Spring DSL 配置。这个想法是,如果传入的请求具有名为“name”的标头参数,它将命中 when 子句,否则将请求路由到谷歌:
<camel:route>
<camel:from uri="servlet:///test" />
<camel:choice>
<camel:when>
<camel:header>name</camel:header>
<camel:transform>
<camel:simple>Hello ${header.name} how are you?</camel:simple>
</camel:transform>
</camel:when>
<camel:otherwise>
<camel:to uri="http://www.google.com?bridgeEndpoint=true" />
</camel:otherwise>
</camel:choice>
</camel:route>
Run Code Online (Sandbox Code Playgroud)
我希望上述配置仅适用于 Header Param。但是,我注意到此配置甚至适用于查询参数,如以下请求所示:
http://localhost:8080/<war-context>/test?name=test
Run Code Online (Sandbox Code Playgroud)
有没有办法确保它仅适用于标题参数?
我正在使用SQL Server Integration Services2008。在我的数据流任务中,我获得了OLEDB源。我选择SQL命令作为数据访问模式,以下是我的sql文本
Select * from table1 where ID=?
Run Code Online (Sandbox Code Playgroud)
从参数选项卡中,我的参数名称为零“ 0”,并且值来自程序包级别变量。
我尝试将参数名称替换为“ Parameter0”,但始终出现相同的错误,
Error: "No Value given for one or more required parameters"
Run Code Online (Sandbox Code Playgroud)
但是我的变量有一个值
请帮助
有没有办法使用spring中的请求将查询参数映射到中间分数?
我没有问题绑定单个措辞参数这样做:
Uri例子: http://localhost:8080/test/?product=hotels
public class CitiesRequest{
private ProductType product;
public ProductType getProduct() {
return this.product;
}
public void setProduct(String product) {
this.product = product;
}
}
Run Code Online (Sandbox Code Playgroud)
但我希望能够接收这样的参数:
http://localhost:8080/test/?product-type=hotels
Run Code Online (Sandbox Code Playgroud) 我有一个场景,其中端点可以接受具有非预定名称和值的'N'个查询参数,即我不知道有人可能传入哪些查询参数,例如
?i=can&pass=anything&in=here
Run Code Online (Sandbox Code Playgroud)
我如何使用Swagger 规范描述上述内容?
在我的urls.py我有:
url(r'^dashboard/users/(?P<user_id>[0-9]+)/products/$', views.UserProductsList.as_view())
Run Code Online (Sandbox Code Playgroud)
在 views.py
class UserProductsList(generics.ListCreateAPIView):
def get_queryset(self):
if self.request.user_id:
return UserProducts.objects.filter(user_id=self.request.user_id).order_by('id')
else:
return UserProducts.objects.all().order_by('id')
Run Code Online (Sandbox Code Playgroud)
我希望能够像这样访问我的api:
http:// localhost:8000 / dashboard / users / 10 / products
应该列出该用户的所有产品,并且
http:// localhost:8000 / dashboard / users / 10 / products / 1
应该返回user_id 10的product_id 1
我如何实现此流程。
注意:我在此设置中使用Django rest框架
python django routing query-parameters django-rest-framework
当我的请求出现问题时,我需要有自己的错误响应正文,并且我试图使用@NotEmpty约束消息属性来返回错误消息,
这是我的类,它使用所需的正文返回错误消息:
package c.m.nanicolina.exceptions;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.WebRequest;
@ControllerAdvice
public class CustomResponseEntityExceptionHandler {
@ExceptionHandler(value = {MissingServletRequestParameterException.class})
public ResponseEntity<ApiError> handleConflict(MissingServletRequestParameterException ex, WebRequest request) {
ApiError apiError = new ApiError(ex.getMessage(), ex.getMessage(), 1000);
return new ResponseEntity<ApiError>(apiError, null, HttpStatus.BAD_REQUEST);
}
}
Run Code Online (Sandbox Code Playgroud)
这样,CustomResponseEntityExceptionHandler我就可以在验证错误的情况下返回自己的响应正文。
我现在正在尝试的是从验证约束中获取消息。
这是我的控制器的NotEmpty约束:
package c.m.nanicolina.controllers;
import c.m.nanicolina.models.Product;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotEmpty;
@RestController
public class MinimumStockController {
@RequestMapping(value = "/minimumstock")
public Product product(
@RequestParam(value = "product.sku") …Run Code Online (Sandbox Code Playgroud) java validation exception-handling query-parameters spring-boot
我试图通过Angular中的queryParam,它由这样的对象数组组成fooArray = [{foo: 'bar', foo: false}, {foo: 'bar', foo: false}]。在URL queryParam中,我收到以下消息:使用时,%255BencodeURI(JSON.stringify(this.fooArray))
我试过使用encodeURI(JSON.stringify())将数组编码为queryParam和JSON.parse(decodeURIComponent())以检索参数
fooArray = [{foo: 'bar', foo: false}, {foo: 'bar', foo: false}]
fooParam: encodeURI(JSON.stringify(this.fooArray))
JSON.parse(decodeURIComponent(params["fooParam"]))
可以URLSearchParams以某种方式找到参数而不区分大小写吗?例如在查询中我有?someParam=paramValue,那么什么时候我
URLSearchParams.get("someparam")会找到paramValue?
我正在尝试Play 2.1.1 的文档化路由示例
路线
# The version parameter is optional. E.g. /api/list-all?version=3.0
GET /api/list-all controllers.Api.list(Option[version])
Run Code Online (Sandbox Code Playgroud)
然后
$ play-2.1.1 compile
[error] /home/paul/server/conf/routes:2: Compilation error[`)' expected but `[' found]
Run Code Online (Sandbox Code Playgroud)
出了什么问题?
routing scala query-parameters playframework playframework-2.1
我在尝试将queryparams放入组件时遇到麻烦。现在,我只想要console.log(...)它。我正在使用ActivatedRoutefrom @angular/router这个任务。
我正在重新开发某个工作平台,因此不幸的是,一些不相关的代码将必须替换为“ ...”
我的Component.ts代码:
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { RelevantReportService } from './../reportServices/relevantReports.service';
import { ActivatedRoute ,Params, Router } from '@angular/router';
@Component({
selector: 'vr-reports',
templateUrl: './reports.component.html',
styleUrls: ['./reports.component.scss'],
providers: [RelevantReportService],
encapsulation: ViewEncapsulation.None
})
export class ReportsComponent implements OnInit {
reportSections: any;
constructor( private relevantReportService: RelevantReportService,
private router: Router,
private activatedRoute : ActivatedRoute
) { }
ngOnInit() {
...
console.log(this.activatedRoute.queryParams.value.reportName)
// console.log(this.activatedRoute.queryParams._value.reportName)
}
...
}
Run Code Online (Sandbox Code Playgroud)
当我这样做时console.log(this.activatedRoute.queryParams.value.reportName),控制台会吐出queryparams(这正是我想要的),但是它也说 …
在我的用例中,我需要将数据发布到 url,但是数据本身是一个查询字符串。例子:
curl -POST -d "username=abc&rememberme=on&authtype=intenal" "https..somemdpoint"
我有一个方法,它接受 3 个值
function makePostRequest(username string, rememberme string, authtype string, endpoint string) {
// post a curl request.
}
Run Code Online (Sandbox Code Playgroud)
如果我为它提供了参数,我正在努力寻找任何可以返回查询字符串的库。
我尝试这样做:
q := req.URL.Query()
q.Add("api_key", "key_from_environment_or_flag")
q.Add("another_thing", "foobar")
fmt.Print(q)
Run Code Online (Sandbox Code Playgroud)
但意识到它实际上返回的是一张地图,所以它没有好处。
golang 中是否有任何方法可以创建 queryString ?
query-parameters ×12
java ×3
javascript ×3
routing ×3
angular ×1
apache-camel ×1
api ×1
coldfusion ×1
django ×1
go ×1
http ×1
http-headers ×1
json ×1
mysql ×1
oledb ×1
python ×1
reactjs ×1
scala ×1
servlets ×1
spring ×1
spring-boot ×1
spring-dsl ×1
spring-mvc ×1
ssis ×1
string ×1
swagger ×1
swashbuckle ×1
typescript ×1
url ×1
urlencode ×1
validation ×1