-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
project v1.1 #1
base: master
Are you sure you want to change the base?
project v1.1 #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dodaj .gradle do git ignore
hello/.idea/.name
Outdated
@@ -0,0 +1 @@ | |||
test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.idea add to gitignore
hello/build.gradle
Outdated
compile 'org.glassfish.jersey.core:jersey-server:2.7' | ||
compile 'org.glassfish.jersey.containers:jersey-container-servlet-core:2.7' | ||
compile 'org.glassfish.jersey.containers:jersey-container-jetty-http:2.7' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enter
<head> | ||
<meta charset="UTF-8"> | ||
<title>Simple Jersey</title> | ||
<style> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other file for styles
<a href="#" class="button" onclick="myFunction(4)"></a> | ||
|
||
|
||
<script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for js other file also
@@ -0,0 +1,109 @@ | |||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move file to hello/front
hello/src/main/java/dupa/Dupa.java
Outdated
config.packages("dupa"); | ||
ServletHolder servlet = new ServletHolder(new ServletContainer(config)); | ||
|
||
Server server = new Server(2222); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2222 to read from program arguments, shoudl start with argument -port 2222 etc.
hello/src/main/java/dupa/Dupa.java
Outdated
public static void main(String[] args) { | ||
ResourceConfig config = new ResourceConfig(); | ||
config.packages("dupa"); | ||
ServletHolder servlet = new ServletHolder(new ServletContainer(config)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if config might be read from file
public class Resource { | ||
@POST | ||
@Path("post") | ||
//@Consumes(MediaType.JSON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm
import javax.ws.rs.core.MediaType; | ||
|
||
|
||
@Path("home") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe api???
} | ||
} | ||
/* | ||
@POST |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make it working
gradle/* | ||
jav.iml | ||
gradlew* | ||
gradle-wrapper* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enter
src/main/java/frontend/index.html
Outdated
<title>Simple Jersey</title> | ||
<link rel="stylesheet" type="text/css" href="styles.css"> | ||
</head> | ||
<body>q |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code-formatting
src/main/java/frontend/index.html
Outdated
</script> | ||
|
||
</body> | ||
</html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enter
src/main/java/frontend/index.html
Outdated
<a href="#" class="button" onclick="myFunction(4)"></a> | ||
|
||
<p id="demo"></p> | ||
<script src="script.js"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
collapse to one tag <script .../>
src/main/java/frontend/script.js
Outdated
if (this.readyState == 4 && this.status == 200) { | ||
document.getElementById("demo").innerHTML = this.responseText; | ||
} else { | ||
document.getElementById("demo").innerHTML = this.readyState + " "+ this.status; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix indentation
context.addServlet(servlet, "/*"); | ||
|
||
try { | ||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what for 2 try blocks??? Make one with catch and finally
config.register(new CORSFilter()); | ||
ServletHolder servlet = new ServletHolder(new ServletContainer(config)); | ||
|
||
Server server = new Server(2222); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
port to program parameters
public class JettyServer { | ||
public static void main(String[] args) { | ||
ResourceConfig config = new ResourceConfig(); | ||
config.packages("server"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move packages to constant
src/main/java/server/Resource.java
Outdated
|
||
return "<h2>xD: " + json + "</h2>"; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enter
|
||
|
||
@Path("home") | ||
public class Resource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add typical ping method with pong response.
comment