put

Java Hashtable put method slow down my application

試著忘記壹切 提交于 2019-12-11 03:13:05
问题 I need to do : Dictionary cache; cache = new Hashtable(); this.getDocument().putProperty("imageCache", cache); Then I have a method who does : cache.put(url, picture); Where picture is an Image object. I create this way : public Image getSmiley(String smileyName) { BufferedImage img = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); Graphics g = img.getGraphics(); ImageIcon myicon = new ImageIcon(getClass().getResource("/ola/smileys/" + smileyName + ".png")); myicon.paintIcon(null, g,

HTTP verbs - When to use GET/POST/PUT/Delete

允我心安 提交于 2019-12-11 02:50:02
问题 When you work on RESTFUL service you often hear the terms GET/POST/PUT/DELETE . My question is what is the idea behind so many verbs? I can achieve everything with the help of GET verb or if I want to post some large data in the body of the message, I can use POST verb. I do not think there is a need to think beyond these two verbs. Do we have any general guideline in terms of when to use which verb? Is there any advantage of using one verb over the other?? PS: I know the idea behind GET :

Slim PUT returns NULL

早过忘川 提交于 2019-12-11 02:21:50
问题 I have a problem with the Slim Framework and a PUT request. I have a litte jQuery script that that will update an expiry time when a button is clicked. $("#expiry-button").click(function(event) { event.preventDefault(); $.ajax({ url: 'http://www.domain.com/expiry/38/', dataType: 'json', type: 'PUT', contentType: 'application/json', data: {aid:'38'}, success: function(){ var text = "Time updated"; $('#expiry').text(text).addClass("ok"); }, error: function(data) { var text = "Something went

Laravel 5.2 Codeception functional test issue with PUT / PATCH requests

流过昼夜 提交于 2019-12-11 01:47:12
问题 I have a problem on the update treatment processed into my functional tests on Codeception : I systematically have a 404 error. Here are the details. Everything is going well for every other simulated http requests but when codeception tries to execute the update method on a put HTTP request (POST request with a "_method" param having the value "PUT") is never executed by my controller, which lead codeception on the update url without the redirection that should happen after the treatment in

Ember Data update POST when it should be PUT

被刻印的时光 ゝ 提交于 2019-12-10 21:34:10
问题 I'm working on an Ember.js app. I have an update function, part of an ObjectController. The function should save my updated model, however when I call save(); it sends a POST request not a PUT request. (Tested in Chrome.) Why would that happen? How can I make sure a PUT request is sent for updates? Here is my code: customer = this.get('model'); customer.set('name', 'New name'); customer.save(); For extra reference, when I log the "dirtyType" with console.log( customer.get('dirtyType') ); it

PUT and DELETE getting 404 in WCF REST service .net 4 when running in IIS 6.0

吃可爱长大的小学妹 提交于 2019-12-10 17:24:17
问题 I've added the wildcard application mapping for c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll and unchecked the "verify that file exist" checkbox. This gives me GET and POST ability but not PUT and DELETE. I have both prohibited and allowed WebDav under the web service extensions. Application works like a champ when running in development environment. PUT and DELETE don't work when running app in IIS. Any help is appreciated. 回答1: Have you defined the extra verbs in the ISAPI

how to send JSON data to an API using PUT method via cURL/PHP

回眸只為那壹抹淺笑 提交于 2019-12-10 15:13:00
问题 I am trying to connect to an API using cURL/PHP. I need to PUT a method to this API while sending JSON data. Here is my parameter $data = array('__type' => 'urn:inin.com:connection:workstationSettings'); Here is how I am doing the cURL call private function _makeCall($method, $uri, $data = false, $header = NULL, &$httpRespond = array()) { $ch = curl_init(); $url = $this->_baseURL . $uri; if( ($method == 'POST' || $method == 'PUT') && $data ){ $jsonString = json_encode( $data ); curl_setopt(

Vimeo API : streaming upload using HTTP PUT and blueimp's jQuery fileupload

半腔热情 提交于 2019-12-10 13:34:25
问题 I'm trying to implement an upload module on a website which would allow our users to upload videos to our Vimeo account. I'm using blueimp's jQuery File upload and Vimeo's new API. https://github.com/blueimp/jQuery-File-Upload/wiki/Options https://developer.vimeo.com/api/upload#http-put-uploading I think it's close to be working but I must be missing some detail. According to Vimeo's API, I need to : 1. Generate an upload ticket, which works fine 2. I then pass the upload_link_secure to

PHP : How to submit “JSON” via the PUT method?

依然范特西╮ 提交于 2019-12-10 11:51:35
问题 I'm making (and testing) my small PHP API. Both GET/POST methods are all fine while submitting the JSON as data-type. Problem in PUT I cannot submit the JSON data via PUT method. When i do, the Server-side got empty data. But when i DO NOT use json as data-type, (and just use the plain text data), then i can receive and parse the data, successfully . <----(( This is something weird! )) Here are my tested cases. Client Side (Submissions) (Submit via PHP) submit.php: $data = array("fruit"=>

PATCH vs PUT for Update Bill

核能气质少年 提交于 2019-12-10 11:25:32
问题 We have an inventory feature where we generate Bills. There is a Edit Bill API call. We are confused to implement this as PATCH Or PUT. let's say our BillLineItem consists of { stockId quantity rate } A Bill with id = 1 has 2 LineItems : | Stock Id | Qty | Rate | | 10 | 2 | 10 | | 11 | 3 | 20 | Now lets say I want to change the quantity for stock Id : 10 to 5 and I want to change the rate for stock Id : 11 to 40 Should I represent this as PUT Call like : bill : { id : 1 lineItems : [ {