Giter Club home page Giter Club logo

javaee7-samples's People

Contributors

abhirockzz avatar aheusingfeld avatar airborn avatar alexsm82 avatar arjantijms avatar arun-gupta avatar aslakknutsen avatar bartoszmajsak avatar cirix avatar dagguh avatar dependabot[bot] avatar fegalo avatar hasalex avatar jgauravgupta avatar johnament avatar juangon avatar kornelrabczak avatar kubamarchwicki avatar ladicek avatar mattgill98 avatar nickboldt avatar openwms avatar orelgenya avatar pandrex247 avatar pdudits avatar psakar avatar radcortez avatar rafabene avatar rhanus avatar xcoulon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javaee7-samples's Issues

Can't run stateless project due to arquillian/wildfly dependencies

On my system I get this error from the tests, I assume because I don't have wildfly installed:

org.jboss.arquillian.container.test.impl.client.deployment.ValidationException: DeploymentScenario contains a target (wildfly-arquillian) not matching any defined Container in the registry.

Add arquillian tests

Adding Arquillian tests would be a huge win the community, so they could see these working on all the other Java EE 7 containers.

With these and the work we've done at http://www.jboss.org/jdf/quickstarts/get-started/ we have quite a bit of both trivial and non-trival examples for people to use, unfortunately they both seem to be vendor specific :( It would be great to collaborate on making fully impl egnostic examples. Perhaps @pmuir would like to help too?

How to use Encoder/Decoder.TextStream correctly in Java WebSocket?

Hi,

I did not find a simple example of using TextStream or BinaryStream. Thus, I am trying to write a simple one to understand them better. The idea is simple. I write annotation based Server and Client Websocket by using Glassfish and Tyrus API. The message is encoded/decoded by using TextStream. When client connect to the server, the server send a JSON object to tell the client its session ID.

Unfortunately, my program does not work :(. But if I use encoder/decoder by Text<>, it works perfectly. I don't understand much about the different configuration for Text and TextStream.

Here are the codes:


ServerEnpoint (WSServer.java) will be exported in WSServer.war

@ServerEndpoint(value = "/test", encoders = {Msg.MsgEncoder.class}, decoders = {Msg.MsgDecoder.class})
public class WSServer{
     @OnOpen
     public void handleConnection(Session session){
        String  notification    =   "New connection : " + session.getId();
        System.out.println(notification);
        try {
            session.getBasicRemote().sendObject(new Msg(notification));
        } catch (Exception e) {
             e.printStackTrace();
        }
    }
}

ClientEndpoint (WSClient.java):

@ClientEndpoint(encoders = {Msg.MsgEncoder.class}, decoders = {Msg.MsgDecoder.class})
public class WSClient{  
      @OnMessage
      public void handleMessage(Msg msg){
      System.out.println(msg.getMessage());
 }

 public static void main(String[] args){
     WebSocketContainer  container   =   ContainerProvider.getWebSocketContainer();      
     String  uri =   "ws://localhost:8080/WSServer/test";        
        try {
            Session session =   container.connectToServer(WSClient.class, URI.create(uri));         
            while (session.isOpen()) {              
            Thread.sleep(1000);
            session.close();
            }           
        } catch (Exception e) {         
            e.printStackTrace();            
        } 
      }
}

Class Msg and its encoder/decoder

public class Msg {
String message;

public Msg(String message) {
    super();
    this.message = message;
}

public String getMessage() {
    return message;
}

public static class MsgEncoder implements Encoder.TextStream<Msg>{
    @Override
    public void encode(Msg msg, Writer writer) throws EncodeException,IOException {
        JsonWriter  jWriter =   Json.createWriter(writer);
        JsonObject  jsonObj =   Json.createObjectBuilder().add("message", msg.getMessage()).build();
        jWriter.writeObject(jsonObj);
    }
}

  public static class MsgDecoder implements Decoder.TextStream<Msg>{
    @Override
    public Msg decode(Reader reader) throws DecodeException, IOException {
        JsonReader  jReader =   Json.createReader(reader);
        JsonObject  jsonObj =   jReader.readObject();
        String  message =   jsonObj.getString("message");
        Msg msg =   new Msg(message);           
        return msg;
    }
   }
}

After deploying WSServer.war by GlassFish 4 server, I run WSClient but it does not print anything.

In the same way, instead of using Encoder/Decoder.TextStream<>, I use Encoder/Decoder.Text<>, the client will print the message "New connection : 087c959f-fae2-4d0a-97cb-727ceec6e2e3", which is what I expect to see.

I have been trying to understand the difference between using Text<> and TextStream<> to fix the problem without luck :(. Could you please tell me what I have done incorrectly in my code? Thank you.

Remove nb-configuration.xml from each sample

Each sample has nb-configuration.xml to define the Java EE server used at runtime. This should be defined at the top-level so that any IDE specific configurations are not defined in each sample.

Add Apache Camel integration sample

Suggestion,
integrate Apache Camel in order to facilitate EE solutions that need to use EIP and deal with a broad range of protocols not supported by a default EE container

Also apache camel has some really nice and remarkable components like

Cloud relative stuff

  • Amazon cloud component - http://camel.apache.org/aws-cw.html (http://aws.amazon.com/es/cloudwatch/) you can monitor your EC2 and RDS DB instances, and add or remove them dynamically when needed

  • JClouds component - http://camel.apache.org/jclouds.html . quote "ComputeService simplifies the task of managing machines in the cloud. For example, you can use ComputeService to start 5 machines and install your software on them."
    --> I think that jclouds is the defacto standard for Java cloud management, included in Camel, and therefore by using jclouds and some kind of "camel dynamic router builder"(@DynamicRouter), cloud instance governance could be done in an EE container (just and idea)
    --> A concrete sample ? Mmmm...thinking

    What do you think?

    Thanks

    J

@MailSessionDefintion sample is not working

Giving the following error:

WARNING: StandardWrapperValve[org.javaee7.javamail.definition.AnnotatedEmailServlet]: Servlet.service() for servlet org.javaee7.javamail.definition.AnnotatedEmailServlet threw exception
java.lang.RuntimeException: com.sun.mail.smtp.SMTPSendFailedException: 530-5.5.1 Authentication Required. Learn more at
530 5.5.1 http://support.google.com/mail/bin/answer.py?answer=14257 qf7sm13437126pac.14 - gsmtp
at org.javaee7.javamail.definition.AnnotatedEmailServlet.processRequest(AnnotatedEmailServlet.java:131)
at org.javaee7.javamail.definition.AnnotatedEmailServlet.doGet(AnnotatedEmailServlet.java:151)

ItemWriter not called in chunk-partition sample

I've an issue with the chunk-partition sample.
The Glassfish log shows that the ItemWriter is never called.

From the Glassfish batch console, everything seems ok (both batch and exist statuses are COMPLETED).

I'm using GlassFish Server Open Source Edition 4.0 (build 89)

Could you confirm that you have the same behavior?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.