Tag Archives: http

Downloading PDF file with GET request okhttp error

Questions: fellow community! So I have this simple request using Retrofit 2 @Headers(“Content-Type: application/pdf”) @GET(“endpoint/download/{id}”) Call<ResponseBody> downloadPdf(@Header(“Authorization”) String accessToken, @Path(“id”) int id); I’ve laso tried to add @Streaming annotation Which should trigger web server and start download I am always getting error HTTP FAILED: java.io.IOException: unexpected end of stream on Connection{server_ip_here , proxy=DIRECT@ hostAddress=/server_ip_address cipherSuite=none… Read More »

DataTables warning: table id=vendors – Ajax error. For more information about this error, please see http://datatables.net/tn/7

Questions: I am using laravel 5.4 and php version is 5.6. I am getting error “Class ‘Datatables’ not found”. I am following standard procedure. I have installed datatable using composer by following command: composer require yajra/laravel-datatables-oracle:”~7.0″ I added these two lines in config->app file in service provider and aliases: Yajra\DataTables\DataTablesServiceProvider::class, ‘DataTables’ => Yajra\DataTables\Facades\DataTables::class, then publish… Read More »

Tomcat: Attachment errors while using https

Questions: I’ve configured tomcat (8.5.16) to use https (using org.apache.coyote.http11.Http11NioProtocol), the application (based on spring framework) works fine (like before, with http) but frequently I have an error when the user upload an attachment. It happens randomly, sometime I have this error: Caused by: org.apache.tomcat.util.http.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Channel is in closing state… Read More »

JerseyClient With NettyConnectorProvider How To Use HTTPS Proxy

Questions: Now I Can Use Fiddler to Catch HTTPS Traffics From JerseyClient With HttpUrlConnectionProvider 。 I Import Fiddler’s Certificate To My TrustStore Which Contains All Certificate In “jre\lib\security\cacerts”. It Really Works But When I Use A JerseyClient With a NettyConnectorProvider It Does Not Work. I Want To Know What Is The Problem ? I Debuged… Read More »

Laravel 4.2: Force URL to be rendered as HTTP or HTTPS

Questions: We have a simple route defined like the following one: Route // Home Route::get(‘/home’, [ ‘as’ => ‘home::index’, ‘uses’ => ‘IndexController@home’ ]); View <a href=”{{ route(‘home::index’) }}”>Home</a> We need to force our link/route in view rendered as HTTP or in some cases as HTTPS route e.g. http://host.domain/home or https://host.domain/home. We cannot use URL::forceSchema(“http”) or… Read More »

HttpMethodBase vs HttpRequestBase

Questions: What is the difference in usage of org.apache.commons.httpclient.HttpMethodBase and org.apache.http.client.methods.HttpRequestBase to execute a Http request? So for example to execute a GET request I can do clientX.executeMethod(new GetMethod(uri)); or clientY.execute(new HttpGet(uri)); So why both is provided by apache? Respectively when I should use which one? Answers:

Setting Encoding=“http://www.w3.org/2000/09/xmldsig#base64” to <ds:Object>

Questions: I have problem with DSS ESIG sign (https://github.com/esig/dss) in Java. My code looks like: DSSDocument doc = new InMemoryDocument(textToSign.getBytes(StandardCharsets.UTF_8)); String alias = getNotExpiredAlias(); PrivateKey privateKey = instance.getPrivateKey(alias); DSSPrivateKeyEntry privateKeyEntry = new KSPrivateKeyEntry(new KeyStore.PrivateKeyEntry(privateKey, new Certificate[]{instance.getCertificate(alias)})); XAdESSignatureParameters parameters = createSignatureParameters(privateKeyEntry, cryptoCardProvider.is64bit()); XAdESService service = new XAdESService(new CommonCertificateVerifier()); ToBeSigned dataToSign = service.getDataToSign(doc, parameters); SignatureTokenConnection token =… Read More »

Sending info with HttpURLConnection to server

Questions: I’m having a problem with sending a string with some XML in it to a server with HttpURLConnection. I’m not using any of the well known networking solutions like Retrofit e.x. Here is the part of my code for sending the request: URL url = new URL(strings[0]); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setDoOutput(true); urlConnection.setRequestProperty(“Content-Type”,… Read More »