小编Vik*_*ram的帖子

将 Bash 变量传递给 CURL

当我给出这样的值时,它会起作用:

curl --silent \ --insecure \ -X POST \ -d '{"Name" : "Vikram"}' \ -H "Content-Type: application/json" \ $restUrl
Run Code Online (Sandbox Code Playgroud)

但是当我这样给它时:

post="'{\"Name\" : \"Vikram\"}'"    
echo $post   // Prints '{"Name" : "Vikram"}'
echo ${post} // Prints '{"Name" : "Vikram"}'
Run Code Online (Sandbox Code Playgroud)

但以下不起作用并引发 400 错误:

curl --silent \ --insecure \ -X POST \ -d ${post} \ -H "Content-Type: application/json" \ $restUrl
Run Code Online (Sandbox Code Playgroud)

bash shell curl

7
推荐指数
1
解决办法
1万
查看次数

Camel + marklogic不使用Marklogic Content Pump

我正在尝试从文件系统中获取JSON文件,并尝试将文件插入MarkLogic数据库.

<route id="file_upload">
  <!-- incoming requests from the file is routed -->
  <from uri="file:/E:/camel/input"/>
  <to uri="http://localhost:8005/v1/documents?uri/patents/test.json"/>
</route>
Run Code Online (Sandbox Code Playgroud)

用户名和密码为:admin/admin,用于在8005上运行的MarkLogic REST实例

rest apache-camel marklogic spring-dsl

4
推荐指数
1
解决办法
166
查看次数

Camel Rest DSL 检索 HTTP POST 多部分文件

我的路由器类如下所示,我正在尝试上传视频文件并将其存储到文件位置。

SpringBootRouter.java

package com.camelrest;

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.component.restlet.RestletComponent;
import org.apache.camel.spring.boot.FatJarRouter;
import org.restlet.Component;
import org.restlet.ext.spring.SpringServerServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class MySpringBootRouter extends FatJarRouter {

    @Autowired
    private MultipartProcessor multipartProcessor;

    @Override
    public void configure() {

        restConfiguration().component("restlet");

        rest("/upload").post().to("direct:upload");

        from("direct:upload")
        .to("file://E:/RestTest");

    }

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {

        SpringServerServlet serverServlet = new SpringServerServlet();
        ServletRegistrationBean regBean = new ServletRegistrationBean(
                serverServlet, "/rest/*");

        Map<String, String> params = new HashMap<String, String>();

        params.put("org.restlet.component", "restletComponent");

        regBean.setInitParameters(params);

        return regBean;
    }

    @Bean
    public Component restletComponent() { …
Run Code Online (Sandbox Code Playgroud)

rest http apache-camel spring-boot postman

4
推荐指数
1
解决办法
3406
查看次数

标签 统计

apache-camel ×2

rest ×2

bash ×1

curl ×1

http ×1

marklogic ×1

postman ×1

shell ×1

spring-boot ×1

spring-dsl ×1