Skip to content

Commit d4a9ce8

Browse files
Merge pull request #4 from contentstack/development
URL encoding bug fix
2 parents a181d97 + 001bb03 commit d4a9ce8

File tree

10 files changed

+54
-30
lines changed

10 files changed

+54
-30
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11

22
## CHANGELOG
3-
3+
4+
5+
## Version 1.3.1
6+
### Date: May-02-2019
7+
Change: include reference bug fixed
8+
added testcase report for v1.3.1
9+
10+
11+
------------------------------------------------
12+
13+
414
## Version 1.3.0
515
### Date: Apr-12-2019
616
Change: Added support of below methods in SDK

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ To use the Contentstack Java SDK to your existing project, perform the steps giv
2020
<dependency>
2121
<groupId>com.contentstack.sdk</groupId>
2222
<artifactId>java</artifactId>
23-
<version>1.2.1</version>
23+
<version>1.3.1</version>
2424
</dependency>
2525
```
2626

2727
2. **Gradle**
2828
```
29-
implementation 'com.contentstack.sdk:java:1.2.1'
29+
implementation 'com.contentstack.sdk:java:1.3.1'
3030
```
3131

3232
### Key Concepts for using Contentstack

pom.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Written manually.
2-
version=1.2.0
2+
version=1.3.1
33
groupId=com.contentstack.sdk
44
artifactId=java

pom.xml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.contentstack.sdk</groupId>
88
<artifactId>java</artifactId>
9-
<version>1.3.0-SNAPSHOT</version>
9+
<version>1.3.1-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

1212
<name>contentstack-java</name>
@@ -116,6 +116,9 @@
116116
<groupId>org.apache.maven.plugins</groupId>
117117
<artifactId>maven-javadoc-plugin</artifactId>
118118
<version>2.9.1</version>
119+
<configuration>
120+
<additionalparam>-Xdoclint:none</additionalparam>
121+
</configuration>
119122
<executions>
120123
<execution>
121124
<id>attach-javadocs</id>
@@ -152,15 +155,15 @@
152155
</plugin>
153156

154157
<plugin>
155-
<groupId>org.sonatype.plugins</groupId>
156-
<artifactId>nexus-staging-maven-plugin</artifactId>
157-
<version>1.6.7</version>
158-
<extensions>true</extensions>
159-
<configuration>
160-
<serverId>ossrh</serverId>
161-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
162-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
163-
</configuration>
158+
<groupId>org.sonatype.plugins</groupId>
159+
<artifactId>nexus-staging-maven-plugin</artifactId>
160+
<version>1.6.7</version>
161+
<extensions>true</extensions>
162+
<configuration>
163+
<serverId>ossrh</serverId>
164+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
165+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
166+
</configuration>
164167
</plugin>
165168

166169
<plugin>

src/main/java/com/contentstack/sdk/CSHttpConnection.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,16 @@ public JSONObject getResponse() {
120120
public String setFormParamsGET(HashMap<String, java.lang.Object> params){
121121
if(params != null && params.size() > 0){
122122
String urlParams = null;
123-
for (Map.Entry<String, Object> e : params.entrySet()) {
124-
if (urlParams == null) {
125-
urlParams = "?" + e.getKey() + "=" + e.getValue();
126-
}else {
127-
urlParams += "&" + e.getKey() + "=" + e.getValue();
123+
124+
urlParams = info.equalsIgnoreCase(CSAppConstants.callController.QUERY.name()) || info.equalsIgnoreCase(CSAppConstants.callController.ENTRY.name()) ? getParams(params) : null;
125+
if(urlParams==null) {
126+
for (Map.Entry<String, Object> e : params.entrySet()) {
127+
128+
if (urlParams == null) {
129+
urlParams = "?" + e.getKey() + "=" + e.getValue();
130+
} else {
131+
urlParams += "&" + e.getKey() + "=" + e.getValue();
132+
}
128133
}
129134
}
130135
return urlParams;
@@ -136,6 +141,7 @@ public String setFormParamsGET(HashMap<String, java.lang.Object> params){
136141

137142

138143

144+
139145
private String getParams(HashMap<String, Object> params) {
140146
String urlParams = "?";
141147
for (Map.Entry<String, Object> e : params.entrySet()) {
@@ -234,6 +240,10 @@ public void send() {
234240
url = urlPath;
235241
}
236242

243+
if(url.contains(CSAppConstants.URLSCHEMA_HTTPS)){
244+
httpsORhttp = CSAppConstants.URLSCHEMA_HTTPS;
245+
}
246+
237247
for (Map.Entry<String, Object> entry : this.headers.entrySet())
238248
{
239249
String key = entry.getKey();

src/main/java/com/contentstack/sdk/Config.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Config {
2323
public Config(){}
2424

2525
/**
26-
* Sets host name of the Built.io Contentstack server.
26+
* Sets host name of the Contentstack server.
2727
*
2828
* @param hostName
2929
* host name.
@@ -44,10 +44,10 @@ public void setHost(String hostName){
4444
}
4545

4646

47+
4748
/**
48-
* Get URL.
49-
*
5049
*
50+
* @return URL String
5151
* <br><br><b>Example :</b><br>
5252
* <pre class="prettyprint">
5353
* String url = config.getHost();
@@ -59,8 +59,8 @@ public String getHost(){
5959

6060

6161
/**
62-
* Get version of the Built.io Contentstack server.
63-
*
62+
* Get version of the Contentstack server.
63+
* @return VERSION String
6464
* <br><br><b>Example :</b><br>
6565
* <pre class="prettyprint">
6666
* String version = config.getVersion();
@@ -71,7 +71,7 @@ public String getVersion(){
7171
}
7272

7373
/**
74-
* Changes the Built.io Contentstack version to be used in the final URL.
74+
* Changes the Contentstack version to be used in the final URL.
7575
*
7676
* @param version
7777
* version string.
@@ -92,8 +92,7 @@ private void setVersion(String version){
9292
/**
9393
* set environment.
9494
*
95-
* @param environment
96-
* environment uid/name
95+
* @param environment uid/name
9796
*
9897
* <br><br><b>Example :</b><br>
9998
* <pre class="prettyprint">
@@ -109,6 +108,7 @@ protected void setEnvironment(String environment){
109108

110109
/**
111110
* Get environment.
111+
* @return param environment string
112112
* <br><br><b>Example :</b><br>
113113
* <pre class="prettyprint">
114114
* String environment = config.getEnvironment();

src/main/java/com/contentstack/sdk/ContentType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public Query query(){
145145
/**
146146
*
147147
*
148-
* @param callback ContentTypesCallback
148+
* @return callback ContentTypesCallback
149149
* This call returns information of a specific content type. It returns the content type schema, but does not include its entries.
150150
*
151151
* <br><br><b>Example :</b><br>

src/main/java/com/contentstack/sdk/Query.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public void setHeader(String key, String value){
8282

8383
/**
8484
* Remove header key @param key custom_header_key
85+
* @return key string
8586
* <br><br><b>Example :</b><br>
8687
* <pre class="prettyprint">
8788
* //'blt5d4sample2633b' is a dummy Stack API key

src/main/java/com/contentstack/sdk/utility/CSAppConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class CSAppConstants {
1111
public static final boolean debug = false;
1212
public static final String REQUEST_URL = "";
1313
public static String URLSCHEMA_HTTPS = "https://";
14-
public static final String SDK_VERSION = "1.3.0";
14+
public static final String SDK_VERSION = "1.3.1";
1515
public final static int NONETWORKCONNECTION = 408;
1616

1717
public static enum RequestMethod
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.0
1+
1.3.1

0 commit comments

Comments
 (0)