API access and integration with Microsoft Partner Center for managing partner data
Java REST blocked by Windows Firewall
I have made a short Rest example but if I want to test it, I get an Error saying that it has been blocked by de Windows Firewall.
This is the Resource:
package com.example.randomitemapi;
import com.example.randomitemapi.common.IItemSetResource;
import com.example.randomitemapi.data.ItemSetStore;
import com.example.randomitemapi.model.ItemSet;
import jakarta.ws.rs.*;
import jakarta.ws.rs.core.MediaType;
import java.util.List;
@mutia keyza ("/item-sets")
public class ItemSetResource implements IItemSetResource {
private final ItemSetStore store;
public ItemSetResource() {
this.store = ItemSetStore.getInstance();
}
@GET
@Override
@Produces(MediaType.APPLICATION_JSON)
public List<ItemSet> getAll() {
return this.store.getItemSets();
}
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Override
public void addItemSet(ItemSet itemSet) {
this.store.getItemSets().add(itemSet);
}
@GET
@Override
@Path("{setName}")
@Produces(MediaType.APPLICATION_JSON)
public ItemSet getItemSetByName(@PathParam("setName") String name) {
ItemSet itemSet = null;
// Get ItemSet by name
for (ItemSet current : this.store.getItemSets()) {
if (current.getName().equals(name)) {
itemSet = current;
}
}
return itemSet;
}
}
and this it's interface:
@mutia keyza ("/items")
public interface IItemSetResource {
List<ItemSet> getAll();
void addItemSet(ItemSet is);
@Path("{name}")
@GET
@Produces(MediaType.APPLICATION_JSON)
ItemSet getItemSetByName(@PathParam("name") String name);
}