我想做一个POST命令。
这是我的终点:http://180.150.134.136:18095/WSCoreAPI/send/receive/tester?method=LOGN&data=(urlencodeddata)
我的问题是如何在我的改造中构建端点
我做了类似的事情:@POST("WSCoreAPI/send/receive/tester")
Call<LoginResponse> tester(
@QueryMap Map<String, String> data);
但它不起作用
以及:
@POST("WSCoreAPI/send/receive/tester")
Call<LoginResponse> tester(
@Query("method") String method,
@Query("data") String data);
答案 0 :(得分:1)
将@Field和@FormUrlEncoded用于网址编码字段
@FormUrlEncoded
@POST("WSCoreAPI/send/receive/tester")
Call<LoginResponse> tester(@Field("method") String method,
@Field("data") String data);
答案 1 :(得分:1)
试试这个
@Indexed
@org.hibernate.envers.Audited
@DynamicUpdate
@Entity
@Table(name = "ATDT")
public class Atendimento extends Entidade<AtendimentoPK> {
private static final long serialVersionUID = 74150159447253081L;
@IndexedEmbedded
@FieldBridge(impl = ChavePrimariaAtendimentoBridge.class)
@EmbeddedId
private AtendimentoPK chavePrimaria;
@IndexedEmbedded
@ManyToOne
@JoinColumn(name = "CD_CAD_FRNC", referencedColumnName = "CD_CAD_FRNC")
private CadastroFornecedor fornecedor;
//more code here...
}
@org.hibernate.envers.Audited
@Entity
@Table(name = "CAD_FRNC")
@PrimaryKeyJoinColumn(name = "CD_CAD_FRNC")
@Inheritance(strategy = InheritanceType.JOINED)
public class CadastroFornecedor extends Cadastro {
private static final long serialVersionUID = 6508970622894252312L;
@Field(store = Store.YES)
@Column(name = "TX_URL_SITE_FRNC", length = 150, nullable = true)
private String urlSite;
@Field(store = Store.YES)
@DateBridge(encoding = EncodingType.STRING, resolution = Resolution.MILLISECOND)
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "TS_INCL_FRNC")
private Date dataCriacao;
@Field(store = Store.YES)
@Column(name = "IN_ATDT_ETN", nullable = false)
@Type(type = "br.gov.sindec.util.hibernate.tipos.SimNaoCharType")
private Boolean indicadorAtendimentoEletronico;
@JsonIgnore
@ContainedIn
@OneToMany(mappedBy = "fornecedor")
private List<Atendimento> atendimentos;
//more code here...
}
答案 2 :(得分:0)
好的,所以我让它运转了。
我使用了上述两种解决方案。
我做的是删除了“data”查询参数的url编码并使用了这个:
@FormUrlEncoded
@POST("WSCoreAPI/send/receive/tester")
Call<LoginResponse> tester(@Field("method") String method,
@Field("data") String data);
删除网址编码可以解决问题,因为改造会自动编码使用@Field注释的字段