可以解决URL DECODE代码吗?

时间:2014-06-26 11:44:09

标签: java android web-services rest restful-url

我正在开发android应用程序。我正在使用RestFull webService.I已在客户端GET_SEARCH中对我的URL进行编码,如下所示

    private HttpResponse doResponse(String url) {
        HttpClient httpclient = new DefaultHttpClient(getHttpParams());
        HttpResponse response = null;

        try {
            switch (taskType) {
            case POST_TASK:
                HttpPost httppost = new HttpPost(url);
                response = httpclient.execute(httppost);
                break;
            case GET_SEARCH:
                String restUrl1 = URLEncoder.encode(url, "UTF-8");
                HttpGet httpget1 = new HttpGet(restUrl1);
                response = httpclient.execute(httpget1);
                break;
            }
        } catch (Exception e) {
            Log.e("ERRRORRRRRRR", e.getLocalizedMessage(), e);
        }
        return response;
    }

现在,我需要在服务器端解码我的URL,而我的服务器端代码就是这样。

@Path("/search")
@GET
@Produces(MediaType.APPLICATION_JSON)
public CustomerEntryDataList getSearchedDetails(
        @QueryParam("cusName") String cusName,
        @QueryParam("compName") String compName,
        @QueryParam("fromDate") String fromDate,
        @QueryParam("endDate") String endDate,
        @QueryParam("status") String status) throws SQLException,
        ParseException {




}

在这里如何从@QueryParam解码我的URL?

0 个答案:

没有答案