First, let me show you the code
package com.memio4.mod;
import com.memio4.mod.proxy.CommonProxy;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.SidedProxy;
#Mod(modid = Reference.MOD_ID, name = Reference.NAME, version = Reference.VERSION, acceptedMinecraftVersions = Reference.ACCEPTED_VERSIONS)
public class Tutorial {
#Instance
public static Tutorial instance;
#SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
}
And well, I don't know what to do, I have tried to put a semi-colon, leave it without it, but it turns even worse. I have not solve this issue yet, so please help me.
Thanks a lot.
Related
elemental2.dom.PushSubscription (v2.25, July 2019) has endpoint but not p256dh and auth keys, anyone know how to access these?
Any help greatly appreciated.
Phil.
You can do this, but note that this is not included in elemental2 because it is a Firefox-only method (actually looks like it is already supported in most browsers, although here said that it is Firefox-only).
{
PushSubscription subscription = …;
FirefoxPushSubscription firefoxPushSubscription = Js.cast(subscription);
}
#JsType(isNative = true, name = "PushSubscription", namespace = JsPackage.GLOBAL)
public static class FirefoxPushSubscription extends PushSubscription {
public native ArrayBuffer getKey(String name);
}
I know that with rest-assured we can set a base path globally using RestAssured.basePath = "/resource".
However I need to set it locally for a request specification. Anyone tried this, don't see any API for that.
This is not supported. Please add it as an issue at the issue tracker and state your use case. The closest thing to a work-around would probably be to set a baseUri.
Update: This is now supported in 2.3.2.
Below is an example where I have shown how to set a basepath globally.
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.jayway.restassured.builder.RequestSpecBuilder;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.specification.RequestSpecification;
import static com.jayway.restassured.RestAssured.*;
public class RequestSpecificationTest {
RequestSpecification rspec;
RequestSpecBuilder build;
#BeforeClass
public void requestSpec () {
build = new RequestSpecBuilder();
build.setBaseUri ("https://maps.googleapis.com");
build.setBasePath ("maps/api/place/textsearch/json");
build.addParam ("query", "restaurants in mumbai");
build.addParam ("key", "XYZ");
rspec = build.build ();
}
#Test
public void test01 () {
given()
.spec (rspec)
.when ()
.get ("")
.then ()
.contentType (ContentType.JSON)
.statusCode (200);
}
}
You can also follow my tutorial on the same topic:
Using RequestSpecBuilder in Rest Assured ( Code Reuse )
I've been reading a lot on StackOverflow but this is my first question! I've read the rules but bear with me if I miss something :). Don't hesitate to let me know if I'm missing something in my question.
I'm trying to learn jax-rs but it is a little bit confusing as I'm new to it. I'm trying mykong's tutorial and it works ok.
I've been working under Eclipse and here is the exact code from the tutorial that I have :
package com.mkyong.rest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
#Path("/hello")
public class HelloWorldService {
#GET
#Path("/{param}")
public Response getMsg(#PathParam("param") String msg) {
String output = "Jersey say : " + msg;
return Response.status(200).entity(output).build();
}
}
I've been trying just to modify the line with :
String output = "Jersey say : " + msg;
to let'say :
String output = "Another message : " + msg;
When I restart Tomcat in Debug, it still gives me "Jersey say :..." message, even in Debug when I look in the output value, it gives me this value...
Do I have to republish? or maybe delete the server and reconfigure one each time I modify the source code?
Thank you in advance!
This tutorial may help you configure it : http://ducquoc.wordpress.com/2010/11/06/eclipse-wtp-tomcat-hot-deploy/
Thanks in advance for your assistance. I have the following exported part:
[Export (typeof(INewComponent))] // orignally tried just [Export} here and importing NewComponent below
public class NewComponent : INewComponent
{
// does stuff including an import
}
The Console test program imports the above:
public class Program
{
[Import] // have tried variations on importing "NewComponent NewComponent" etc
public INewComponent NewComponent
{
get;
set;
}
public static void Main(string[] args)
{
var p = new Program();
var catalog = new AssemblyCatalog(typeof(Program).Assembly);
var container = new CompositionContainer(catalog);
container.ComposeParts(p);
}
The Composition fails with these CompositionExceptions (I removed the namespace to protect the guilty :)):
1) No valid exports were found that match the constraint
'((exportDefinition.ContractName == "INewComponent") AndAlso
(exportDefinition.Metadata.ContainsKey("ExportTypeIdentity") AndAlso
"INewComponent".Equals(exportDefinition.Metadata.get_Item("ExportTypeIdentity"))))',
invalid exports may have been rejected.
The Composition works successfully if I do the composition in the main program like this:
public class Program
{
public static void Main(string[] args)
{
INewComponent newComponent = new NewComponent();
var catalog = new AssemblyCatalog(typeof(Program).Assembly);
var container = new CompositionContainer(catalog);
container.ComposeParts(newComponent);
}
}
Thank You
Is your Exported part contained in the same Assembly as Program? If it is in a separate DLL, you need to include that Assembly in your catalog as well, like this:
var aggregateCatalog = new AggregateCatalog();
aggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Program).Assembly));
aggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(NewComponent).Assembly));
var container = new CompositionContainer(aggregateCatalog);
// etc...
If that's doesn't work, then there is a nice open source tool called Visual MEFx that can help you analyze your catalog. Here is a short article about setting it up:
Getting Started With Visual MEFx
In your NewComponent class you wrote this:
// does stuff including an import
If there is a problem with that unshown import, then MEF will complain about the Program.NewComponent import instead of the actual deeper cause. This is called "stable composition". Stable composition can be useful, but it also complicates the debugging of a failed composition.
You can follow the instructions in the MEF documentation about Diagnosing Composition Errors to home in on the actual cause.
In a small program, you can also try to call container.GetExportedValue<ISomeExport>() for a few exports until you find the one that is causing problems.
I've tried hard to solve this and I couldn't. I'm trying to use httpClient 4.1.2 from apache. As logic I started with the example, the problem is that I'm having some strange error that I don't understand. This is the deal:
package ClientWithResponseHandler;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
public class Main {
public final static void main(String[] args) throws Exception {
HttpClient httpclient = new DefaultHttpClient();
try {
HttpGet httpget = new HttpGet("http://www.google.com/");
System.out.println("executing request " + httpget.getURI());
// Create a response handler
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String responseBody = **httpclient.execute(httpget, responseHandler);**
System.out.println("----------------------------------------");
System.out.println(responseBody);
System.out.println("----------------------------------------");
} finally {
// When HttpClient instance is no longer needed,
// shut down the connection manager to ensure
// immediate deallocation of all system resources
httpclient.getConnectionManager().shutdown();
}
}
}
The error is with "httpclient.execute(httpget, responseHandler);" IT says that it cannot find the method execute(HttpGet,ResponseHandler)
The question shouldn't the example work? What am I doing wrong?! :S
I got the same error too. I resolved it by adding the "httpcore-4.2.1.jar". Then it started complaining about the Class Def not found for logging. So I added "commons-logging-1.1.1.jar" and now I think it works fine. Both these files can be found along with "httpclient-4.2.1.jar".
Hope this helps.