Hi I have a listgrid in smartgwt and I need to have a button to upload a file to the server, I created an ordinary servlet and have declared in the web.xml of my project but I can not make it work, make me 404 error to deploy . You can use regular servlets (with its post and get methods) with gwt?
Thanks in advance.
GWT transfers data between server side code (running on servlet container like tomcat or jetty) & client side code (GWT compiled client side JS files) in a special way called GWT-RPC.
Client required to know format of data that will send or receives to/from server & server also must knows about format of data that client can parse(we have serious limitation in serialization & deserialization of data because one side we have only javascript!). This is why you need to declare an interface for your remote servlet & GWT makes another async interface using it & restricts your service calls to that interface. & this is why you can't use any standard servlet with GWT.
HttpServlet can be used with smartgwt. You need to have DynamicForm and set .setCanSubmit(true);
Sample Code:
final String DEFAULT_FILE_UPLOAD_SERVICE_PATH = "upload";
final String TARGET = "uploadTarget";
VLayout body = new VLayout();
uploadForm = new DynamicForm();
// initialise the hidden frame
NamedFrame frame = new NamedFrame(TARGET);
frame.setWidth("1px");
frame.setHeight("1px");
frame.setVisible(false);
uploadForm.setEncoding(Encoding.MULTIPART);
uploadForm.setMethod(FormMethod.POST);
// set the (hidden) form target
uploadForm.setTarget(TARGET);
uploadForm.setAction(DEFAULT_FILE_UPLOAD_SERVICE_PATH);
// initialise the File name field
uploadItem = new UploadItem("filename");
uploadItem.setName("filename");
uploadItem.setTitle("File name");
// set the fields into the form
uploadForm.setFields(uploadItem);
// add the Upload Form and the (hidden) Frame to the main layout container
body.addMember(uploadForm);
body.addMember(frame);
Related
In my app, I am sending invitation to people to join my app. I am using AppInvitation IntentBuilder Class to create Intent. After these steps, one URL-link gets generated that we can send to invitees.
I have written below code to generated that link and start the activity to send the link. I am able to send invites and able to successfully launch the app by clicking the dynamiclinks. Both the dynamically and manually created ones.
IDictionary<string, string> values = new Dictionary<string, string>();
values.Add("utm_campaign", "Health");
values.Add("utm_medium", "GoIbibo");
values.Add("ad", "1");
values.Add("credit", "50");
values.Add("utm_source", "Yahoo");
values.Add("afl", "https://www.facebook.com");
var intentbuidl = new AppInviteInvitation.IntentBuilder(MainActivity.mainActivity.GetString(Resource.String.invitation_title))
.SetMessage(MainActivity.mainActivity.GetString(Resource.String.invitation_message))
.SetDeepLink(Android.Net.Uri.Parse(MainActivity.mainActivity.GetString(Resource.String.invitation_deep_link)))
.SetAdditionalReferralParameters(values)
.Build();
MainActivity.mainActivity.StartActivityForResult(Intent.CreateChooser(intentbuidl, "Install"),0);
Generated link: https://aku4q.app.goo.gl/i/619426442529-4a4105fd-33ea-4b0f-bf07-6f4063eef8f8
So my question is, when do invitees open the app using this link? Can we be able to get these additional parameters which I have set using IDictionary from the above generated link?
To my knowledge, no. This is one of the limitations of Firebase deep linking — you can't pass custom parameters and need to use the URL string for everything.
You could check out Branch.io (full disclosure: I'm on the Branch team) for an alternative approach that does allow custom parameters.
What is the JSON Format to set aspects to some folder or documents in alfresco via REST API.
You need to send POST request by the following url (Alfresco 4.1.5):
your_host/alfresco/s/slingshot/doclib/action/aspects/node/workspace/SpacesStore/{nodeUUID}
for Alfresco 5:
your_host/alfresco/s/slingshot/doclib/action/aspects/node/workspace/SpacesStore/{nodeUUID}
with the following body:
{
"added":["abc:doc"],
"removed":[]
}
The preferred approach is to use CMIS rather than the internal slingshot web script. Using CMIS you can add an aspect in a standard way, and you can do it via the browser binding (JSON), the Atom Pub binding (XML), or Web Services.
You can use a CMIS client, such as one of the ones available from http://chemistry.apache.org, or you can do it using the raw binding directly over HTTP.
In CMIS 1.1 you add an aspect by adding its ID to the multi-value property named cmis:secondaryObjectTypeIds.
Here's a gist that shows what this looks like in Java: https://gist.github.com/jpotts/7242070
You need to make one custom webscript.The code of webscript will be like below.In case of webscript you can use below link for learning purpose.
https://wiki.alfresco.com/wiki/Web_Scripts
var props = new Array(1);
props["cm:template"] = document.nodeRef;
document.addAspect("cm:templatable", props);
props = new Array(1);
props["cm:lockIsDeep"] = true;
document.addAspect("cm:lockable", props);
props = new Array(1);
props["cm:hits"] = 1;
document.addAspect("cm:countable", props);
How to set up the SQL Server database for Semantic logging.
Does the table for logging information needs to be created earlier?
If yes, what is the schema to be used.
I have the following code :
var listener = new ObservableEventListener();
string connectionString = #"Data Source=nibc2025;Initial Catalog=TreeDataBase;Integrated Security=True;User Id=sa;Password=nous#123";
listener.EnableEvents(AuditingEventSource.Log, EventLevel.LogAlways, Keywords.All);
databaseSubscription = listener.LogToSqlDatabase
(
"Test",
connectionString,
"Traces",
Buffering.DefaultBufferingInterval,
1,
Timeout.InfiniteTimeSpan, 500
);
// The following one line of code is not part of this function.
// It is just added here to show this is how I log my information.
// Inside LogInformation method I call the 'Write' method
AuditingEventSource.Log.LogInformation("sgsgg", "sgsg");
databaseSubscription.Sink.FlushAsync().Wait();
Well, Since this thread gets the most hits on Google regarding Semantic Logging onto SQL DB or even SLAB ...
The scripts to create the DB lies here
\packages\EnterpriseLibrary.SemanticLogging.Database.1.0.1304.0\scripts
And to create the EventSource and Fire the Blocks, information are given here, for a shortcut and quick fix solution
http://entlib.codeplex.com/discussions/540723
Regards,
OK. I got it. the script was in the packages folder. I had overlooked that.
I want to use Jmeter to update a document on solr using http post.
I want it to take a different file to update in every iteration, create a proper http post request and monitor the responses from the server.
Can someone guide me of how this can be done:
Taking a different file every time.
Creating a http post from it.
Your use case can be split into 2 parts:
Get list of files to send
Send them to server
In regards to point 1, I would suggest to obtain file list via scripting.
Assuming following Test Plan Structure:
Add a Thread Group (all defaults)
Add a JSR223 Sampler as a child of Thread Group
Select "beanshell" as language
In "Script" area add following code:
File folder = new File("PATH TO FOLDER WITH YOUR FILES");
File [] files2send = folder.listFiles();
int counter = 1;
for (File file : files2send)
{
vars.put("FILE_" + counter, file.getPath());
counter++;
}
This will save files, you will be sending as JMeter Variables like:
FILE_1=d:\2solr\sometxtfile.txt
FILE_2=d:\2solr\somewordfile.docx
FILE_3=d:\2solr\someexcelfile.xlsx
After that you can use For Each Controller to iterate through files and add them to your request
Add For Each Controller as a child of Thread Group (same level as JSR223 Sampler)
Make sure that For Each Controller has following configuration:
Input variable prefix: FILE
Output variable name: CURRENTFILE
Add _ before number is checked
Add HTTP Request as a child of For Each Controller
Access file you want to send as ${CURRENTFILE} in "Send Files With The Request" stanza of the HTTP Request
It's just one of the approaches, if you are not very comfortable with JSR233 or Beanshell you may wish to use CSV Data Set Config instead.
i want to enable http compression for my jax-ws webservice. i found out that i have to do it with a custom handlerchain that can modify the http-headers.
all tutorials i found refer to the annotation #HandlerChain that points to a handler chain configuration xml-file but my problem is that my webservice has to be as lightweight as possible therefore i cant define my handler chain in an external xml file.
i tried the following but did not succeed:
final Endpoint ep = Endpoint.publish("http://localhost:8878/mywebservice",
new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
does anyone know how to do this? is it even possible?
It doesn't appear that you can change the handler chain when the service has already been published.
If your actual use case is as above, it's easy to fix by simply create()ing and then publish()ing.
final Endpoint ep = Endpoint.create(new WebserviceImpl() );
final Binding binding = ep.getBinding();
final List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new MySuperbSOAPHandler());
binding.setHandlerChain(handlerChain);
ep.publish("http://localhost:8878/mywebservice");