Comments (10)
@JunyiYi Above code is coming from Azure Functions Java templates. Could you help explain more about this issue?
from azure-maven-plugins.
We are upgrading to BETA-2 runtime now, so the sample above is somehow out-of-dated, we will update the templates soon. But for your questions:
"req"
is the name of HttpTrigger that represents the whole http request message, while"name"
is the query parameter within that http request message; which is to say,"req"
contains a query parameter called"name"
. So the URL to trigger it should be "curl http://localhost:7071/api/hello?name=world".- This should work. At least in BETA-2.
from azure-maven-plugins.
@JunyiYi thanks.
but it still cannot work well in version 2.0.1-beta.21.
below I restate the steps:
change the default templates line 21 the "name" string to "param" :
String name = request.getQueryParameters().get("param");
then execute the command: curl http://localhost:7071/api/hello?param=a
it get 400 response,while execute curl http://localhost:7071/api/hello?name=a, it get "right" response (the content) : hello, a
from azure-maven-plugins.
Did you run mvn clean package
and then mvn azure-functions:run
after you changed the code from "name" to "param"?
from azure-maven-plugins.
@JunyiYi yes. I have rerun the command.and today it work well while date 11-12 can not work.
Now,I still confuse the code: name="req" in @HttpTrigger .
As you say:
"req" is the name of HttpTrigger that represents the whole http request message
But what is the "req" use for? Since there is a HttpRequestMessage parameter named "request".
Would you mind show me an example? thanks.
from azure-maven-plugins.
Sure. So first let me explain about the whole maven plugin:
- You write *.java code as functions
- After you run
mvn clean package
, it will generate 3 things in target/azure-functions/**/*.*:
- *.jar which contains your logic
- function.json which is used to declare all bindings
- host.json which is used to declare the host configuration
mvn azure-functions:run
will invoke NodeJS Azure Functions Runtime you installed globally, which only recognizes host.json and function.json, it doesn't care about anything in Java.
So "req"
is used as the binding name in function.json mentioned above. You do not directly use it, but Azure Functions Runtime cares about it. And the HTTP parameters are metadata in the "req"
binding. You may also refer to the analogy of HttpRequest class and its Params property.
from azure-maven-plugins.
@JunyiYi thank you for you reply
from azure-maven-plugins.
@JunyiYi Can you please let me know how to update azure-functions-java-core to the latest. My current version in the POM shows [1.0.0-beta-1,1.0.0)
from azure-maven-plugins.
Just update <version>1.0.0-beta-2</version>
section of the azure-functions-java-core
dependency in your POM.xml
.
from azure-maven-plugins.
Close it since the problem looks to have been solved.
from azure-maven-plugins.
Related Issues (20)
- mvn com.microsoft.azure:azure-spring-apps-maven-plugin:1.14.0:config returns error when work with Java 17 HOT 10
- Improve logic of getting java version
- All Trigger Types Not Available in IntelliJ IDEA IDE while adding the additional function to existing Java Azure Functions Project HOT 2
- Feature request: add configuration option to enable app service easy auth
- Does not support the API version '2022-09-01-preview HOT 2
- A lot of error logs about AcquireTokenSilentSupplier HOT 1
- azure-webapp-maven-plugin:2.9.0 seems to have errors
- [FEATURE_REQ] Spring apps plugin does not support defining the order of apps when deploying aggregate projects HOT 1
- [FEATURE_REQ] Use Spring Apps plugin to configure a more accurate app name
- [FEATURE_REQ] Support pre-definition for Spring Apps maven plugin HOT 1
- Plugin should declare these Maven artifacts in `provided` scope
- Remove or suppress the message: "default messager has already been registered" HOT 1
- Ability to set property values from azure-maven-plugin ? HOT 1
- Ie
- azure-webapp-maven-plugin deploy fails with version >= 2.11.0 HOT 2
- Usage of func start options HOT 1
- Unable to deploy to Tomcat 10.0 using azure-webapp-maven-plugin 2.12.0 HOT 1
- Azure deployment is failing Warning: 'Content-Type' not found. Returning default encoding: JSON Error: Status code 400, (empty body) HOT 5
- functions plugin does not redeploy app HOT 3
- Unable to deploy from devcontainer HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-maven-plugins.