Do Javadoc (my griffin):
The default type is GET.
You can also define a custom type, like if you want to use restful services. In this case, the header will be set to what you store in the httpType String. Note that, to use Another http method, append a space.
Example with the method PUT
:
HttpStream.Options options = new HttpStream.Options();
options.httpType = "PUT ";
Example with a CUSTOMMETHOD
whichever:
HttpStream.Options options = new HttpStream.Options();
options.httpType = "CUSTOMMETHOD ";
Note the spaces between the end of the method name and the end of the string.
If you have a method that is not described in HttpStream
and want to indicate that send data, you need to indicate this in Options
:
HttpStream.Options options = new HttpStream.Options();
options.httpType = "PUT ";
options.setSendData(true);
About the HttpConn
The class HttpConn
is a container/wrapper about the HttpStream
. It provides no more functionality than using the HttpStream
pure. It makes life much easier yes, but it is possible to get the same results using the HttpStream
.
Class HttpConn
undetected?
This class belongs to a library. To import libraries into the project, you need to export them as .tcz
and put in the all.pkg
the name of the generated file.
UPDATE
Automatic management of dependencies
From Totalcross 4, we have supported the automatic generation of .tcz
the intermediaries and their management in the all.pkg
. Even this was cited as one of the highlights release version.
In free translation:
- Want to add your dependencies automatically? Have a look at
tc-compiler-help
- The archive
all.pkg
is dynamically updated with its dependencies, returning to its initial state at the end of the exection
- See examples of build:
- Build for multiple platforms here
- Must compile with dependencies
magical-utils
, tc-utilities
and tc-components
here
To enable the use of tc-compiler-help
, the first step is to add dependency to the project:
<dependency>
<groupId>com.totalcross.utils</groupId>
<artifactId>tc-compiler-help</artifactId>
<version>1.1.0</version>
</dependency>
To properly download this dependency, you need to use the Maven repository from Totalcross OR download the project tc-compiler-help
on your machine
To actually use the build wizard, you should start by creating an object of the type CompilationBuilder
.
The CompilationBuilder
meets (almost) the same demands as the tc.Deploy
answers. In fact, CompilationBuilder
will make calls to tc.Deploy
safely/in sandbox. You can set your key, set what is the main class, parameters build others, define platforms, modify the environment variables before the execution of the tc.Deploy
freely.
The only cases where the tc.Deploy
features that the CompilationBuilder
does not answer is to create the tcz
or the executable from a .class
or a .zip
; but that was not defective, was design choice, so we only allowed so create tcz
and enforceable from .jar
.
Almost all configuration methods of CompilationBuilder
return the object itself. This allows you to perform method call chaining.
In addition to the traditional configurations of a build in Totalcross, you can define which dependencies they find need to be compiled to generate the executable. To do this, just call setMustCompile
with a function that will judge, based on the dependency path, whether it should enter the executable or not.
Internally, the CompilationBuilder
passes all elements of the classpath to be judged by the function.
To spin this CompilationBuilder
in your project:
- create a class with a method
public static void main; nesse método, você deve configurar o
Compilationbuilderdireta ou indiretamente; vamos chamar essa classe de
with.hello.world.Classecompilacao`;
- spin
mvn clean package exec:java -Dexec:mainClass="com.hello.world.ClasseCompilacao"
The language is Java ?
– novic
Yes, it’s Java using the Totalcross platform
– Deivison Cardoso